MCPcopy Create free account
hub / github.com/JakkuSakura/plotters-gpui / plot

Method plot

examples/area-chart.rs:63–93  ·  view source on GitHub ↗
(
        &mut self,
        root: &DrawingArea<GpuiBackend, Shift>,
    )

Source from the content-addressed store, hash-verified

61
62impl PlottersChart for AreaChart {
63 fn plot(
64 &mut self,
65 root: &DrawingArea<GpuiBackend, Shift>,
66 ) -> Result<(), plotters_gpui::DrawingErrorKind> {
67 let mut chart = ChartBuilder::on(root)
68 .set_label_area_size(LabelAreaPosition::Left, 60)
69 .set_label_area_size(LabelAreaPosition::Bottom, 60)
70 .caption("Area Chart Demo", ("sans-serif", 40))
71 .build_cartesian_2d(0..(self.data.len() - 1), 0.0..1500.0)
72 .unwrap();
73
74 chart
75 .configure_mesh()
76 .disable_x_mesh()
77 .disable_y_mesh()
78 .draw()
79 .unwrap();
80
81 chart
82 .draw_series(
83 AreaSeries::new(
84 (0..).zip(self.data.iter()).map(|(x, y)| (x, *y)),
85 0.0,
86 RED.mix(0.2),
87 )
88 .border_style(RED),
89 )
90 .unwrap();
91
92 Ok(())
93 }
94}
95
96fn main_viewer(cx: &mut App) -> MainViewer {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected