1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # Visualize Yew
//!
//! `Visualize Yew` is a simple crate to help you visualize your data in the browser using Yew. It is a wrapper around the yew crate that provides a simple API to create charts.
//!
//! ## Features
//!
//! - `BarChart` — Renders a standard bar chart.
//! - `PieChart` — Renders a pie chart.
//! - `LineCurveChart` — Renders a line chart with optional curve smoothing.
//! - `DoughnutChart` — Renders a doughnut chart similar to a pie chart but with a hole in the center.
//!
//! Enable the desired chart(s) in your `Cargo.toml`:
//!
//! ```toml
//! visualize-yew = { version = "0.2x.x", features = ["BarChart", "PieChart"] }
//! ```
//!
//! ## Example
//!
//! ```rust
//! use visualize_yew::pie_chart::{DataPoint as PieChartData, PieChart};
//!
//! #[function_component]
//! fn Home() -> Html {
//! let mut pie_chart_config = PieChartConfig::default();
//! pie_chart_config.show_legend = true;
//!
//! let pie_data = vec![
//! PieChartData::new("A", 10, ""),
//! PieChartData::new("B", 20, ""),
//! PieChartData::new("C", 30, ""),
//! PieChartData::new("D", 40, ""),
//! ];
//!
//! html! {
//! // Chart will take the full width of the parent container
//! <div>
//! <PieChart data={pie_chart_data} config={pie_chart_config} />
//! </div>
//! }
//! }
//! ```
/// Renders a bar chart.
///
/// This feature is enabled by default.
pub use bar_chart;
/// Renders a pie chart.
///
/// Enable this via the `PieChart` feature in Cargo.toml.
pub use pie_chart;
/// Renders a line chart with optional curves.
///
/// Enable this via the `LineCurveChart` feature in Cargo.toml.
pub use line_chart;
/// Renders a doughnut chart.
///
/// Enable this via the `DoughnutChart` feature in Cargo.toml.
pub use doughnut_chart;