Skip to main content

SVGExporter

SVGExporter

SVG export utility for DataViewer plots. More…

#include <SVGExporter.hpp>

Public Functions

Name
SVGExporter(OpenGLWidget * gl_widget)
Construct SVG exporter with references to plot state.
QString exportToSVG()
Export current plot to SVG format.
void setCanvasSize(int width, int height)
Set SVG canvas dimensions.
int getCanvasWidth() const
Get current SVG canvas width.
int getCanvasHeight() const
Get current SVG canvas height.
void enableScalebar(bool enabled, int length)
Enable or disable scalebar in SVG output.

Detailed Description

class SVGExporter;

SVG export utility for DataViewer plots.

Exports the current plot state to SVG format by building a RenderableScene from the DataViewer series data and rendering it to SVG via PlottingSVG. This ensures that the SVG output matches the on-screen visualization exactly, as it uses the same batch building and coordinate transformation code.

Architecture:

  • Builds RenderableBatches from series data (same as OpenGL rendering)
  • Uses PlottingSVG::buildSVGDocument() for SVG generation
  • Shared View/Projection matrices ensure coordinate consistency

Features:

  • Fixed canvas size (1920x1080) with viewBox for clean scaling
  • Supports analog time series, digital events, and digital intervals
  • Preserves colors, transparency, and visual styles
  • Uses same coordinate transformations as OpenGL rendering

Public Functions Documentation

function SVGExporter

explicit SVGExporter(
    OpenGLWidget * gl_widget
)

Construct SVG exporter with references to plot state.

Parameters:

  • gl_widget OpenGL widget containing plot data and state (including view state parameters)

function exportToSVG

QString exportToSVG()

Export current plot to SVG format.

Return: QString containing complete SVG document

Builds a RenderableScene from the current plot state and converts it to SVG using PlottingSVG export functions.

function setCanvasSize

inline void setCanvasSize(
    int width,
    int height
)

Set SVG canvas dimensions.

Parameters:

  • width SVG canvas width in pixels
  • height SVG canvas height in pixels

function getCanvasWidth

inline int getCanvasWidth() const

Get current SVG canvas width.

function getCanvasHeight

inline int getCanvasHeight() const

Get current SVG canvas height.

function enableScalebar

inline void enableScalebar(
    bool enabled,
    int length
)

Enable or disable scalebar in SVG output.

Parameters:

  • enabled Whether to include a scalebar
  • length Length of the scalebar in time units

Updated on 2026-11-13 at 20:25:39 +0000