views:

195

answers:

2

Can anybody give an example for 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 also:

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    m_chart.setRenderFormat("SVG");
    m_chart.renderToStream();

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);
+1  A: 

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.

WolfmanDragon
A: 

I am also having the same issue... did you find a solution to this?

java.lang.NullPointerException at com.softwarefx.chartfx.server.internal.Writer.Svg.SvgWriter.a(SourceFile:236) at com.softwarefx.chartfx.server.internal.Chart.a(SourceFile:4481) at com.softwarefx.chartfx.server.internal.Chart.a(SourceFile:4684) at com.softwarefx.chartfx.server.internal.Chart.a(SourceFile:4738) at com.softwarefx.chartfx.server.Chart.renderToStream(SourceFile:787)

The class files have been obfuscated too so I can't even decompile to see the cause of the NPE

Lance