Expand description
§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:
visualize-yew = { version = "0.2x.x", features = ["BarChart", "PieChart"] }§Example
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>
}
}Re-exports§
pub use charts::bar_chart::bar_chart;