A library for creating simple plots in Dart and exporting them as SVG. One may need this if they want to generate a PDF report with plots in Dart.
Can generate simple 2D line and scatter plots. Styles are customized using CSS directly.
TODO: List prerequisites and provide or point to information on how to start using the package.
List<double> x = List.generate(55, (i) => i / 5);
final plot = SvgGraphFigure(
absoluteGeometry: Rect.fromLTWH(0, 0, 453.5, 283.5),
lengthUnit: SvgGraphUnit.point
);
final ax = plot.axis(
labelTextStyle: {
'font-size': '14'
},
tickLabelTextStyle: {
'font-size': '11'
},
xlabel: 'Time, s',
ylabel: 'Signal, V',
);
ax.plot(
x.map((x) => Point(x, sin(x))).toList(),
marker: SvgGraphMarker.circle,
lineStyle: {
'stroke': 'none'
}
);
ax.plot(
x.map((x) => Point(x, 1.5 * cos(x))).toList(),
lineStyle: {
'stroke': '#0000ff',
},
);
final document = plot.toSvgXml();
(await File('example.svg')).writeAsString(document.toXmlString());