├── charming
├── src
│ ├── component
│ │ ├── brush.rs
│ │ ├── graphic.rs
│ │ ├── timeline.rs
│ │ ├── grid3d.rs
│ │ ├── axis3d.rs
│ │ ├── polar_coordinate.rs
│ │ ├── parallel_axis.rs
│ │ ├── mod.rs
│ │ ├── calendar.rs
│ │ ├── single_axis.rs
│ │ ├── radius_axis.rs
│ │ ├── geo_map.rs
│ │ ├── angle_axis.rs
│ │ ├── parallel_coordinate.rs
│ │ ├── geo.rs
│ │ └── data_zoom.rs
│ ├── series
│ │ ├── map.rs
│ │ ├── bar3d.rs
│ │ ├── candlestick.rs
│ │ ├── boxplot.rs
│ │ ├── treemap.rs
│ │ ├── radar.rs
│ │ ├── lines.rs
│ │ ├── heatmap.rs
│ │ ├── pictorial_bar.rs
│ │ ├── scatter.rs
│ │ ├── parallel.rs
│ │ ├── custom.rs
│ │ ├── bar.rs
│ │ ├── pie.rs
│ │ ├── funnel.rs
│ │ ├── line.rs
│ │ └── effect_scatter.rs
│ ├── element
│ │ ├── cursor.rs
│ │ ├── shape.rs
│ │ ├── orient.rs
│ │ ├── parallel_layout.rs
│ │ ├── border_type.rs
│ │ ├── link_target.rs
│ │ ├── name_location.rs
│ │ ├── coordinate.rs
│ │ ├── sampling.rs
│ │ ├── split_area.rs
│ │ ├── scale_limit.rs
│ │ ├── text_align.rs
│ │ ├── axis_type.rs
│ │ ├── blur.rs
│ │ ├── minor_split_line.rs
│ │ ├── formatter.rs
│ │ ├── select.rs
│ │ ├── split_line.rs
│ │ ├── minor_tick.rs
│ │ ├── symbol_size.rs
│ │ ├── dimension_encode.rs
│ │ ├── axis_tick.rs
│ │ ├── area_style.rs
│ │ ├── line_style.rs
│ │ ├── easing.rs
│ │ ├── js_function.rs
│ │ ├── coordinate_tooltip.rs
│ │ ├── axis_label.rs
│ │ ├── emphasis.rs
│ │ ├── anchor.rs
│ │ ├── animation_time.rs
│ │ ├── pointer.rs
│ │ ├── range.rs
│ │ ├── item_style.rs
│ │ ├── background.rs
│ │ ├── tooltip.rs
│ │ ├── cell_size.rs
│ │ ├── mark_area.rs
│ │ ├── sort.rs
│ │ ├── mark_point.rs
│ │ ├── text_style.rs
│ │ ├── axis_pointer.rs
│ │ ├── step.rs
│ │ ├── smoothness.rs
│ │ ├── mod.rs
│ │ ├── symbol.rs
│ │ ├── icon.rs
│ │ └── boundary_gap.rs
│ ├── datatype
│ │ ├── mod.rs
│ │ ├── dimension.rs
│ │ └── value.rs
│ ├── asset
│ │ ├── runtime.js
│ │ └── charts.html.hbs
│ ├── renderer
│ │ ├── mod.rs
│ │ └── html_renderer.rs
│ └── theme
│ │ └── mod.rs
├── tests
│ ├── line.rs
│ ├── image_snapshots.rs
│ └── dz_test.rs
└── Cargo.toml
├── gallery
├── src
│ ├── geo
│ │ ├── mod.rs
│ │ └── organ_data.rs
│ ├── aria
│ │ ├── mod.rs
│ │ └── default_decal.rs
│ ├── treemap
│ │ ├── mod.rs
│ │ └── disk_usage.rs
│ ├── bar3d
│ │ ├── mod.rs
│ │ └── bar3d_with_dataset.rs
│ ├── dataset
│ │ └── mod.rs
│ ├── sunburst
│ │ └── mod.rs
│ ├── heatmap
│ │ └── mod.rs
│ ├── pictorial_bar
│ │ ├── mod.rs
│ │ └── water_content.rs
│ ├── theme_river
│ │ └── mod.rs
│ ├── funnel
│ │ ├── mod.rs
│ │ └── funnel_chart.rs
│ ├── calendar
│ │ ├── mod.rs
│ │ ├── simple_calendar.rs
│ │ └── heatmap_calendar.rs
│ ├── graph
│ │ ├── mod.rs
│ │ ├── hide_overlapped_label.rs
│ │ └── les_miserables.rs
│ ├── tree
│ │ └── mod.rs
│ ├── candlestick
│ │ ├── mod.rs
│ │ └── basic_candlestick.rs
│ ├── gauge
│ │ ├── mod.rs
│ │ ├── gauge_basic.rs
│ │ └── gauge_simple.rs
│ ├── parallel
│ │ ├── mod.rs
│ │ └── basic_parallel.rs
│ ├── radar
│ │ ├── mod.rs
│ │ ├── basic_radar.rs
│ │ └── proportion_of_browsers.rs
│ ├── sankey
│ │ ├── mod.rs
│ │ ├── basic_sankey.rs
│ │ └── sankey_orient_vertical.rs
│ ├── scatter
│ │ ├── clustering_process.rs
│ │ ├── mod.rs
│ │ └── basic_scatter.rs
│ ├── pie
│ │ ├── mod.rs
│ │ ├── referer_of_a_website.rs
│ │ ├── nightingale.rs
│ │ └── doughnut_chart_with_rounded_corner.rs
│ ├── boxplot
│ │ ├── data_transform_simple_aggregate.rs
│ │ ├── mod.rs
│ │ └── basic_boxplot.rs
│ ├── bar
│ │ ├── mod.rs
│ │ ├── basic_bar.rs
│ │ ├── bar_with_background.rs
│ │ ├── set_style_of_single_bar.rs
│ │ ├── tangential_polar_bar.rs
│ │ ├── radial_polar_bar_label_position.rs
│ │ ├── world_population.rs
│ │ └── waterfall.rs
│ ├── line
│ │ ├── basic_line.rs
│ │ ├── smoothed_line.rs
│ │ ├── mod.rs
│ │ ├── basic_area.rs
│ │ ├── different_symbols.rs
│ │ ├── two_value_axes_in_polar.rs
│ │ ├── step_line.rs
│ │ ├── time_axis.rs
│ │ ├── split_legend.rs
│ │ ├── large_scale_area.rs
│ │ ├── area_pieces.rs
│ │ ├── stacked_line.rs
│ │ └── stacked_area.rs
│ ├── gallery.rs
│ └── images.rs
├── templates
│ └── index.html
├── Cargo.toml
└── asset
│ └── sports-facilities-usage.csv
├── examples
├── yew-demo
│ ├── screenshot.png
│ ├── Cargo.toml
│ ├── README.md
│ ├── index.html
│ └── src
│ │ └── main.rs
├── dioxus-web-demo
│ ├── public
│ │ └── favicon.ico
│ ├── README.md
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── Dioxus.toml
│ ├── LICENSE
│ └── src
│ │ └── main.rs
├── dioxus-desktop-demo
│ ├── .gitignore
│ ├── README.md
│ ├── Dioxus.toml
│ ├── Cargo.toml
│ └── src
│ │ └── main.rs
├── sycamore-demo
│ ├── Cargo.toml
│ ├── README.md
│ ├── index.html
│ └── src
│ │ └── main.rs
└── leptos-demo
│ ├── README.md
│ ├── Cargo.toml
│ ├── index.html
│ └── src
│ └── main.rs
├── .gitignore
├── .envrc
├── devenv.yaml
├── img
├── geo
│ └── organ_data.svg
├── scatter
│ └── clustering_process.svg
├── boxplot
│ └── data_transform_simple_aggregate.svg
├── treemap
│ └── disk_usage.svg
└── pictorial_bar
│ └── water_content.svg
├── Cargo.toml
├── .github
└── workflows
│ └── devenv.yaml
├── charming_macros
└── Cargo.toml
├── LICENSE-MIT
└── devenv.nix
/charming/src/component/brush.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/charming/src/component/graphic.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/charming/src/component/timeline.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/gallery/src/geo/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod organ_data;
2 |
--------------------------------------------------------------------------------
/gallery/src/aria/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod default_decal;
2 |
--------------------------------------------------------------------------------
/gallery/src/treemap/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod disk_usage;
2 |
--------------------------------------------------------------------------------
/gallery/src/bar3d/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod bar3d_with_dataset;
2 |
--------------------------------------------------------------------------------
/gallery/src/dataset/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod encode_and_matrix;
2 |
--------------------------------------------------------------------------------
/gallery/src/sunburst/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod drink_flavors;
2 |
--------------------------------------------------------------------------------
/gallery/src/heatmap/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod heatmap_on_cartesian;
2 |
--------------------------------------------------------------------------------
/gallery/src/pictorial_bar/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod water_content;
2 |
--------------------------------------------------------------------------------
/gallery/src/theme_river/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod theme_river_lastfm;
2 |
--------------------------------------------------------------------------------
/gallery/src/funnel/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod funnel_chart;
2 | pub mod multiple_funnels;
3 |
--------------------------------------------------------------------------------
/gallery/src/calendar/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod heatmap_calendar;
2 | pub mod simple_calendar;
3 |
--------------------------------------------------------------------------------
/gallery/src/graph/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod hide_overlapped_label;
2 | pub mod les_miserables;
3 |
--------------------------------------------------------------------------------
/gallery/src/tree/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod from_left_to_right_tree;
2 | pub mod multiple_trees;
3 |
--------------------------------------------------------------------------------
/gallery/src/candlestick/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod basic_candlestick;
2 | pub mod ohlc;
3 | pub mod shanghai_index;
4 |
--------------------------------------------------------------------------------
/gallery/src/gauge/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod gauge_barometer;
2 | pub mod gauge_basic;
3 | pub mod gauge_simple;
4 |
--------------------------------------------------------------------------------
/gallery/src/parallel/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod basic_parallel;
2 | pub mod parallel_aqi;
3 | pub mod parallel_nutrients;
4 |
--------------------------------------------------------------------------------
/gallery/src/radar/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod basic_radar;
2 | pub mod multiple_radar;
3 | pub mod proportion_of_browsers;
4 |
--------------------------------------------------------------------------------
/examples/yew-demo/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuankunzhang/charming/HEAD/examples/yew-demo/screenshot.png
--------------------------------------------------------------------------------
/gallery/src/sankey/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod basic_sankey;
2 | pub mod node_align_left_sankey;
3 | pub mod sankey_orient_vertical;
4 |
--------------------------------------------------------------------------------
/gallery/src/scatter/clustering_process.rs:
--------------------------------------------------------------------------------
1 | use charming::Chart;
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | }
6 |
--------------------------------------------------------------------------------
/gallery/src/pie/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod doughnut_chart_with_rounded_corner;
2 | pub mod nightingale;
3 | pub mod referer_of_a_website;
4 |
--------------------------------------------------------------------------------
/examples/dioxus-web-demo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuankunzhang/charming/HEAD/examples/dioxus-web-demo/public/favicon.ico
--------------------------------------------------------------------------------
/gallery/src/boxplot/data_transform_simple_aggregate.rs:
--------------------------------------------------------------------------------
1 | use charming::Chart;
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | }
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | dist/
3 | .idea/
4 | img_test
5 |
6 | # Devenv
7 | .devenv*
8 |
9 | # direnv
10 | .direnv
11 |
12 | # pre-commit
13 | .pre-commit-config.yaml
14 |
--------------------------------------------------------------------------------
/.envrc:
--------------------------------------------------------------------------------
1 | source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="
2 |
3 | use devenv
--------------------------------------------------------------------------------
/gallery/src/scatter/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod anscombe_quartet;
2 | pub mod basic_scatter;
3 | pub mod bubble_chart;
4 | pub mod clustering_process;
5 | pub mod effect_scatter;
6 | pub mod punch_card_of_github;
7 |
--------------------------------------------------------------------------------
/charming/src/series/map.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone)]
4 | #[serde(rename_all = "camelCase")]
5 | pub struct Map {}
6 |
--------------------------------------------------------------------------------
/examples/dioxus-desktop-demo/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | /target
4 | .DS_Store
5 |
6 | # These are backup files generated by rustfmt
7 | **/*.rs.bk
8 |
--------------------------------------------------------------------------------
/gallery/src/boxplot/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod basic_boxplot;
2 | pub mod boxplot_light_velocity;
3 | pub mod boxplot_light_velocity2;
4 | pub mod data_transform_simple_aggregate;
5 | pub mod multiple_categories;
6 |
--------------------------------------------------------------------------------
/devenv.yaml:
--------------------------------------------------------------------------------
1 | inputs:
2 | nixpkgs:
3 | url: github:cachix/devenv-nixpkgs/rolling
4 | rust-overlay:
5 | url: github:oxalica/rust-overlay
6 | inputs:
7 | nixpkgs:
8 | follows: nixpkgs
9 |
--------------------------------------------------------------------------------
/examples/sycamore-demo/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "sycamore-demo"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | charming = { path = "../../charming", features = ["wasm"] }
8 | sycamore = "0.9.1"
9 |
--------------------------------------------------------------------------------
/charming/src/element/cursor.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum Cursor {
6 | Pointer,
7 | }
8 |
--------------------------------------------------------------------------------
/charming/src/element/shape.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum Shape {
6 | Polygon,
7 | Circle,
8 | }
9 |
--------------------------------------------------------------------------------
/charming/src/element/orient.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum Orient {
6 | Horizontal,
7 | Vertical,
8 | }
9 |
--------------------------------------------------------------------------------
/img/geo/organ_data.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/charming/src/component/grid3d.rs:
--------------------------------------------------------------------------------
1 | use charming_macros::CharmingSetters;
2 | use serde::{Deserialize, Serialize};
3 |
4 | #[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, PartialOrd, Clone)]
5 | #[serde(rename_all = "camelCase")]
6 | pub struct Grid3D {}
7 |
--------------------------------------------------------------------------------
/gallery/src/bar/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod bar_with_background;
2 | pub mod basic_bar;
3 | pub mod radial_polar_bar_label_position;
4 | pub mod set_style_of_single_bar;
5 | pub mod stacked_column;
6 | pub mod tangential_polar_bar;
7 | pub mod waterfall;
8 | pub mod world_population;
9 |
--------------------------------------------------------------------------------
/img/scatter/clustering_process.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/charming/src/element/parallel_layout.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum ParallelLayout {
6 | Horizontal,
7 | Vertical,
8 | }
9 |
--------------------------------------------------------------------------------
/examples/yew-demo/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "yew-demo"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | charming = { path = "../../charming", features = ["wasm"] }
8 | yew = { version = "0.20.0", features = ["csr"] }
9 | yew-hooks = "0.2.0"
10 |
--------------------------------------------------------------------------------
/gallery/src/treemap/disk_usage.rs:
--------------------------------------------------------------------------------
1 | use charming::{Chart, component::Title, element::Tooltip};
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | .title(Title::new().text("Disk Usage").left("center"))
6 | .tooltip(Tooltip::new().formatter("{b}: {c}"))
7 | }
8 |
--------------------------------------------------------------------------------
/img/boxplot/data_transform_simple_aggregate.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/charming/src/element/border_type.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum BorderType {
6 | Solid,
7 | Dashed,
8 | Dotted,
9 | }
10 |
--------------------------------------------------------------------------------
/examples/yew-demo/README.md:
--------------------------------------------------------------------------------
1 | # charming with yew
2 |
3 | ## Prerequisites
4 | - [Rust](https://www.rust-lang.org/)
5 | - [trunk](https://trunkrs.dev/)
6 | - Rust target for WebAssembly: `wasm32-unknown-unknown`
7 |
8 | ## Running the example
9 | ```sh
10 | trunk serve
11 | ```
12 |
--------------------------------------------------------------------------------
/gallery/src/geo/organ_data.rs:
--------------------------------------------------------------------------------
1 | use charming::{Chart, element::Tooltip};
2 |
3 | pub fn chart() -> Chart {
4 | let svg = include_str!("../../asset/veins-medical-diagram.svg");
5 | Chart::new()
6 | .geo_map(("organ_diagram", svg))
7 | .tooltip(Tooltip::new())
8 | }
9 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = ["charming", "charming_macros", "gallery"]
4 | exclude = [
5 | "examples/dioxus-web-demo",
6 | "examples/dioxus-desktop-demo",
7 | "examples/leptos-demo",
8 | "examples/sycamore-demo",
9 | "examples/yew-demo",
10 | ]
11 |
--------------------------------------------------------------------------------
/examples/leptos-demo/README.md:
--------------------------------------------------------------------------------
1 | # charming with leptos
2 |
3 | ## Prerequisites
4 | - [Rust](https://www.rust-lang.org/)
5 | - [trunk](https://trunkrs.dev/)
6 | - Rust target for WebAssembly: `wasm32-unknown-unknown`
7 |
8 | ## Running the example
9 | ```sh
10 | trunk serve
11 | ```
12 |
--------------------------------------------------------------------------------
/examples/sycamore-demo/README.md:
--------------------------------------------------------------------------------
1 | # charming with sycamore
2 |
3 | ## Prerequisites
4 | - [Rust](https://www.rust-lang.org/)
5 | - [trunk](https://trunkrs.dev/)
6 | - Rust target for WebAssembly: `wasm32-unknown-unknown`
7 |
8 | ## Running the example
9 | ```sh
10 | trunk serve
11 | ```
12 |
--------------------------------------------------------------------------------
/charming/src/element/link_target.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum LinkTarget {
6 | #[serde(rename = "self")]
7 | Self_,
8 | Blank,
9 | }
10 |
--------------------------------------------------------------------------------
/examples/dioxus-web-demo/README.md:
--------------------------------------------------------------------------------
1 | # charming with dioxus-web
2 |
3 | ## Prerequisites
4 | - [Rust](https://www.rust-lang.org/)
5 | - [Dioxus CLI](https://dioxus.org/)
6 | - Rust target for WebAssembly: `wasm32-unknown-unknown`
7 |
8 | ## Running the example
9 | ```sh
10 | dx serve
11 | ```
12 |
--------------------------------------------------------------------------------
/gallery/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 | {% for (type, charts) in collections %}
3 |
{{ type|capitalize }} Charts
4 |
5 | {% for chart in charts %}
6 | - {{ chart }}
7 | {% endfor %}
8 |
9 | {% endfor %}
10 |
--------------------------------------------------------------------------------
/charming/src/element/name_location.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum NameLocation {
6 | Start,
7 | Middle,
8 | Center,
9 | End,
10 | }
11 |
--------------------------------------------------------------------------------
/charming/src/datatype/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod dataframe;
2 | pub mod datapoint;
3 | pub mod dataset;
4 | pub mod dimension;
5 | pub mod source;
6 | pub mod value;
7 |
8 | pub use dataframe::*;
9 | pub use datapoint::*;
10 | pub use dataset::*;
11 | pub use dimension::*;
12 | pub use source::*;
13 | pub use value::*;
14 |
--------------------------------------------------------------------------------
/examples/dioxus-desktop-demo/README.md:
--------------------------------------------------------------------------------
1 | # charming with dioxus-desktop
2 |
3 | ## Prerequisites
4 | - [Rust](https://www.rust-lang.org/)
5 | - [Dioxus CLI](https://dioxus.org/)
6 | - Platform specific dependencies for dioxus desktop applications
7 |
8 | ## Running the example
9 | ```sh
10 | dx serve
11 | ```
12 |
--------------------------------------------------------------------------------
/charming/src/element/coordinate.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum CoordinateSystem {
6 | Cartesian2d,
7 | Polar,
8 | Single,
9 | Geo,
10 | Calendar,
11 | Parallel,
12 | }
13 |
--------------------------------------------------------------------------------
/charming/src/element/sampling.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Clone, Debug, Default, Serialize, Deserialize, Copy, PartialEq, PartialOrd)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum Sampling {
6 | #[default]
7 | Lttb,
8 | Average,
9 | Min,
10 | Max,
11 | Minmax,
12 | Sum,
13 | }
14 |
--------------------------------------------------------------------------------
/examples/yew-demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Yew App
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/sycamore-demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Sycamore App
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/leptos-demo/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "leptos-tutorial"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | charming = { path = "../../charming", features = ["wasm"] }
10 | leptos = { version = "0.7", features = ["csr"] }
11 | leptos-use = "0.15"
12 |
--------------------------------------------------------------------------------
/examples/leptos-demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Leptos App
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/examples/dioxus-web-demo/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | /target/
4 |
5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7 | Cargo.lock
8 |
9 | # These are backup files generated by rustfmt
10 | **/*.rs.bk
11 |
12 |
13 | # Added by cargo
14 |
15 | /target
16 |
--------------------------------------------------------------------------------
/charming/src/element/split_area.rs:
--------------------------------------------------------------------------------
1 | use charming_macros::CharmingSetters;
2 | use serde::{Deserialize, Serialize};
3 |
4 | #[serde_with::apply(
5 | Option => #[serde(skip_serializing_if = "Option::is_none")],
6 | Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
7 | )]
8 | #[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, PartialOrd, Clone)]
9 | #[serde(rename_all = "camelCase")]
10 | pub struct SplitArea {
11 | show: Option,
12 | }
13 |
--------------------------------------------------------------------------------
/gallery/src/bar/basic_bar.rs:
--------------------------------------------------------------------------------
1 | use charming::{Chart, component::Axis, element::AxisType, series::Bar};
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | .x_axis(
6 | Axis::new()
7 | .type_(AxisType::Category)
8 | .data(vec!["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]),
9 | )
10 | .y_axis(Axis::new().type_(AxisType::Value))
11 | .series(Bar::new().data(vec![120, 200, 150, 80, 70, 110, 130]))
12 | }
13 |
--------------------------------------------------------------------------------
/gallery/src/gauge/gauge_basic.rs:
--------------------------------------------------------------------------------
1 | use charming::{
2 | Chart,
3 | element::Tooltip,
4 | series::{Gauge, GaugeDetail},
5 | };
6 |
7 | pub fn chart() -> Chart {
8 | Chart::new()
9 | .tooltip(Tooltip::new().formatter("{a}
{b} : {c}%"))
10 | .series(
11 | Gauge::new()
12 | .name("Pressure")
13 | .detail(GaugeDetail::new().formatter("{value}"))
14 | .data(vec![(50, "Score")]),
15 | )
16 | }
17 |
--------------------------------------------------------------------------------
/examples/dioxus-desktop-demo/Dioxus.toml:
--------------------------------------------------------------------------------
1 | [application]
2 |
3 | # App (Project) Name
4 | name = "dioxus-desktop-demo"
5 |
6 | [web.app]
7 |
8 | # HTML title tag content
9 | title = "dioxus-desktop-demo"
10 |
11 | # include `assets` in web platform
12 | [web.resource]
13 |
14 | # Additional CSS style files
15 | style = []
16 |
17 | # Additional JavaScript files
18 | script = []
19 |
20 | [web.resource.dev]
21 |
22 | # Javascript code file
23 | # serve: [dev-server] only
24 | script = []
25 |
--------------------------------------------------------------------------------
/gallery/src/line/basic_line.rs:
--------------------------------------------------------------------------------
1 | use charming::{Chart, component::Axis, element::AxisType, series::Line};
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | .x_axis(
6 | Axis::new()
7 | .type_(AxisType::Category)
8 | .data(vec!["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]),
9 | )
10 | .y_axis(Axis::new().type_(AxisType::Value))
11 | .series(Line::new().data(vec![150, 230, 224, 218, 135, 147, 260]))
12 | }
13 |
--------------------------------------------------------------------------------
/charming/src/element/scale_limit.rs:
--------------------------------------------------------------------------------
1 | use charming_macros::CharmingSetters;
2 | use serde::{Deserialize, Serialize};
3 |
4 | #[serde_with::apply(
5 | Option => #[serde(skip_serializing_if = "Option::is_none")],
6 | Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
7 | )]
8 | #[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, PartialOrd, Clone)]
9 | #[serde(rename_all = "camelCase")]
10 | pub struct ScaleLimit {
11 | min: Option,
12 | max: Option,
13 | }
14 |
--------------------------------------------------------------------------------
/gallery/src/candlestick/basic_candlestick.rs:
--------------------------------------------------------------------------------
1 | use charming::{Chart, component::Axis, df, series::Candlestick};
2 |
3 | pub fn chart() -> Chart {
4 | Chart::new()
5 | .x_axis(Axis::new().data(vec!["2017-10-24", "2017-10-25", "2017-10-26", "2017-10-27"]))
6 | .y_axis(Axis::new())
7 | .series(Candlestick::new().data(df![
8 | [20, 34, 10, 38],
9 | [40, 35, 30, 50],
10 | [31, 38, 33, 44],
11 | [38, 15, 5, 42]
12 | ]))
13 | }
14 |
--------------------------------------------------------------------------------
/charming/src/component/axis3d.rs:
--------------------------------------------------------------------------------
1 | use crate::element::AxisType;
2 | use charming_macros::CharmingSetters;
3 | use serde::{Deserialize, Serialize};
4 |
5 | #[serde_with::apply(
6 | Option => #[serde(skip_serializing_if = "Option::is_none")],
7 | Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
8 | )]
9 | #[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, PartialOrd, Clone)]
10 | #[serde(rename_all = "camelCase")]
11 | pub struct Axis3D {
12 | type_: Option,
13 | }
14 |
--------------------------------------------------------------------------------
/charming/src/element/text_align.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
4 | #[serde(rename_all = "snake_case")]
5 | pub enum TextAlign {
6 | Auto,
7 | Left,
8 | Right,
9 | Center,
10 | }
11 |
12 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
13 | #[serde(rename_all = "snake_case")]
14 | pub enum TextVerticalAlign {
15 | Auto,
16 | Top,
17 | Bottom,
18 | Middle,
19 | }
20 |
--------------------------------------------------------------------------------
/gallery/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "charming-gallery"
3 | version = "0.1.0"
4 | edition = "2024"
5 | license = "MIT OR Apache-2.0"
6 |
7 | [dependencies]
8 | askama = "0.12.0"
9 | axum = "0.6.18"
10 | image = "0.25.0"
11 | chrono = "0.4"
12 | rand = "0.9.0"
13 | tokio = "1.29.1"
14 | charming = { path = "../charming", features = ["ssr"] }
15 | serde_json = "1.0.99"
16 | serde = "1.0.164"
17 |
18 | [[bin]]
19 | name = "gallery"
20 | path = "src/gallery.rs"
21 |
22 | [[bin]]
23 | name = "generate_images"
24 | path = "src/images.rs"
25 |
--------------------------------------------------------------------------------
/charming/src/element/axis_type.rs:
--------------------------------------------------------------------------------
1 | use serde::{Deserialize, Serialize};
2 |
3 | /// Type of axis.
4 | #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
5 | #[serde(rename_all = "snake_case")]
6 | pub enum AxisType {
7 | /// Numerical axis, suitable for continuous data.
8 | Value,
9 | /// Category axis, suitable for discrete category data.
10 | Category,
11 | /// Time axis, suitable for continuous time series data.
12 | Time,
13 | /// Log axis, suitable for log data.
14 | Log,
15 | }
16 |
--------------------------------------------------------------------------------
/charming/src/element/blur.rs:
--------------------------------------------------------------------------------
1 | use super::{item_style::ItemStyle, label::Label};
2 | use charming_macros::CharmingSetters;
3 | use serde::{Deserialize, Serialize};
4 |
5 | #[serde_with::apply(
6 | Option => #[serde(skip_serializing_if = "Option::is_none")],
7 | Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
8 | )]
9 | #[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, Clone)]
10 | #[serde(rename_all = "camelCase")]
11 | pub struct Blur {
12 | label: Option