John Donoghue
John Donoghue

Reputation:

Export ChartFX7 to SVG in Java

Can anybody give an example of exporting a ChartFX7 chart to SVG?

I've tried:

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    m_chart.setOutputWriter(new SvgWriter());
    m_chart.exportChart(FileFormat.EXTERNAL, baos);
    
and :
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    m_chart.setRenderFormat("SVG");
    m_chart.renderToStream();
    
But both result in a null pointer exception.

The following successfully outputs to XML:

    FileOutputStream fos = new FileOutputStream(Debug.getInstance().createExternalFile("chart.xml"));
    m_chart.exportChart(FileFormat.XML, fos);
    

Upvotes: 0

Views: 472

Answers (1)

WolfmanDragon
WolfmanDragon

Reputation: 7952

batik is a libary that you can import into your java libary to convert or create svg images. I dont know chartfx7 but that is the standard way to create svg in java.

Upvotes: 1

Related Questions