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

Function render_to_svg_string

crates/plotlars-plotters/src/render/mod.rs:139–150  ·  view source on GitHub ↗
(plot: &impl Plot)

Source from the content-addressed store, hash-verified

137}
138
139pub fn render_to_svg_string(plot: &impl Plot) -> String {
140 let (w, h) = resolve_dimensions(plot.ir_layout());
141 let mut svg_string = String::new();
142 let dashes;
143 {
144 let root = SVGBackend::with_string(&mut svg_string, (w, h)).into_drawing_area();
145 dashes = render_to_backend(plot, root);
146 }
147 smooth_svg_lines(&mut svg_string);
148 apply_svg_dash_patterns(&mut svg_string, &dashes);
149 svg_string
150}
151
152/// Apply `stroke-dasharray` only to `<polyline>` elements whose stroke color
153/// matches a dash entry. `<line>`, `<rect>`, and other elements are left untouched

Callers 2

to_svgMethod · 0.85
plot_interactiveFunction · 0.85

Calls 5

resolve_dimensionsFunction · 0.85
render_to_backendFunction · 0.85
smooth_svg_linesFunction · 0.85
apply_svg_dash_patternsFunction · 0.85
ir_layoutMethod · 0.45

Tested by

no test coverage detected