ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  SVG Outp
Posted by Sean Laks on May-28-2022 02:00
Hi

  I have a need to generate the SVG file for the chart data I pass in batch mode i.e. the chart will never be rendered in  BROWSER.

  The goal is to capture the SVG output and then embed that in a pre-stored HTML report template. This HTML template with some static data along with the chart in <SVG> tag will then be passed to a PDF converter to generate the final report.

Thanks in advance

  Re: SVG Outp
Posted by Peter Kwan on May-28-2022 15:00
Hi Sean,

You can use BaseChart.makeChart to save the chart as SVG. The exact syntax depends on your programming language. For example, in C#, it is like:

c.makeChart("c:pathtoabc.svg");

See:

https://www.advsofteng.com/doc/cdnet.htm#BaseChart.makeChart.htm

Note that the SVG created is a complete SVG image file. It starts with the <?xml ...> tag, followed by <!DOCTYPE ....> tag, and then the <svg ...> tag. It is like:

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20010904//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg .....> .... </svg>

If you embed it in HTML, and you only need to <svg ...> part, you may insert only the part of the file starting from "<svg ".


Best Regards
Peter Kwan

  Re: SVG Outp
Posted by Sean Laks on May-28-2022 17:44
Thanks Peter for the quick response (especially on a 3 day holiday weekend). One quick follow up - Can I run your sample code in a microservice by including the necessary modules? (Eg. If microservice is in Java or C#, do I just need to import/include the necessary libraries? If so, is there a sample of those includes?)