MCPcopy Create free account
hub / github.com/alceal/plotlars / render_to_backend

Function render_to_backend

crates/plotlars-plotters/src/render/mod.rs:65–102  ·  view source on GitHub ↗
(
    plot: &impl Plot,
    root: DrawingArea<DB, plotters::coord::Shift>,
)

Source from the content-addressed store, hash-verified

63}
64
65fn render_to_backend<DB: DrawingBackend>(
66 plot: &impl Plot,
67 root: DrawingArea<DB, plotters::coord::Shift>,
68) -> Vec<numeric::DashEntry> {
69 let layout = plot.ir_layout();
70 let traces = plot.ir_traces();
71
72 root.fill(&WHITE).unwrap();
73
74 let mut unsupported = Vec::new();
75 let mut dash_entries = Vec::new();
76
77 if traces.is_empty() {
78 root.present().unwrap();
79 return dash_entries;
80 }
81
82 match &traces[0] {
83 TraceIR::BarPlot(_) => {
84 if is_horizontal_bar(traces) {
85 bar::render_bar_horizontal(&root, layout, traces, &mut unsupported);
86 } else {
87 bar::render_bar_vertical(&root, layout, traces, &mut unsupported);
88 }
89 }
90 TraceIR::BoxPlot(_) => {
91 boxplot::render_boxplot(&root, layout, traces, &mut unsupported);
92 }
93 TraceIR::HeatMap(_) => {
94 heatmap::render_heatmap(&root, layout, traces, &mut unsupported);
95 }
96 _ => numeric::render_numeric(&root, layout, traces, &mut unsupported, &mut dash_entries),
97 }
98
99 enforce_strict("plotters", &unsupported);
100 root.present().unwrap();
101 dash_entries
102}
103
104pub fn plot_interactive(plot: &impl Plot) {
105 if std::env::var("EVCXR_IS_RUNTIME").is_ok() {

Callers 2

save_to_fileFunction · 0.85
render_to_svg_stringFunction · 0.85

Calls 10

is_horizontal_barFunction · 0.85
render_bar_horizontalFunction · 0.85
render_bar_verticalFunction · 0.85
render_boxplotFunction · 0.85
render_heatmapFunction · 0.85
render_numericFunction · 0.85
enforce_strictFunction · 0.85
ir_layoutMethod · 0.45
ir_tracesMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected