Skip to main content

render_to_png

Function render_to_png 

Source
pub fn render_to_png(
    chartml: &ChartML,
    yaml: &str,
    width: u32,
    height: u32,
    density: u32,
) -> Result<Vec<u8>, RenderError>
Expand description

Render a ChartML YAML spec to PNG bytes (synchronous).

Runs the full pipeline: parse YAML → render ChartElement → SVG → PNG. Use this for specs with inline data and no async transforms (sql/forecast).

§Arguments

  • chartml — configured ChartML instance with renderers registered
  • yaml — ChartML YAML specification string
  • width — chart width in CSS pixels
  • height — chart height in CSS pixels
  • density — DPI (72 = 1x, 144 = 2x for PDF)