Reputation: 167
I'm using this curious SVG-Library for C# and I'd like to create some SVG's. I am able to draw a simple polyline with some fix points:
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<polyline stroke="red" stroke-width="2" points="230,180 235,199 ..."/>
</svg>
Now, how can I add points (respectively attributes) programmatically to my polyline? Are there any good tutroials?
There is no Documentation nor could I find something helpful. If you colud help be, I would be very grateful
Upvotes: 2
Views: 922
Reputation: 389
follow these steps to manage that:
1) you'll need a list with some values (ex. Y-Values)
2) add every value form this list to a polyline and dont forget the X-Value as well as the space between the points
3) generate your chart with using Stream
and File.Create(path)
4) create a new svgdocument and set width, height and viewbox.
5) create a svgpolyline and add it as a group to your svgdocument with coordinates from your polyline
6) call Write(stream)
on your svgdocument. It will create a file at your before setted path
Upvotes: 2