Svg from jfreechart distorsion.

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
Locked
FedorkZ
Posts: 6
Joined: Wed Sep 03, 2014 3:15 pm
antibot: No, of course not.

Svg from jfreechart distorsion.

Post by FedorkZ » Wed Sep 03, 2014 3:31 pm

Hi
I use jfreechart 1.0.19 with jfreesvg 2.1
Exported svg files from jfreechart (even from jfreechart demo) are wrongly showed being opened by Corel Draw.
Seems like every chart shape has a not fully transparent backgound and if a large amount of them is presented in output - some of them become darked or totally disappear like being masked.
Is there some kind of workaround?

Exported file (jfreechart demo).
Image

Exported file with about 2000 poins.
Image

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Svg from jfreechart distorsion.

Post by david.gilbert » Thu Sep 18, 2014 8:39 am

Sorry for the delay responding. I don't have Corel Draw so it is hard for me to test this. I have seen a similar issue earlier with SVG containing rgba() colors...rgba() is not yet part of the SVG standard, even though the browsers handle it just fine. But this issue was fixed in JFreeSVG 2.0 (now it writes rgb() colors and a separate opacity attribute). But just in case I missed something, could you search through the SVG and see if there are any rgba colours specified?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

FedorkZ
Posts: 6
Joined: Wed Sep 03, 2014 3:15 pm
antibot: No, of course not.

Re: Svg from jfreechart distorsion.

Post by FedorkZ » Wed Sep 24, 2014 1:30 pm

Sorry for long delay too.
No, there are only rgb items.

Can I set layer/figure background clolr to be transparent? Even is there a backgrund property or soething like that in svg. Sorry I'm new to SVG format.

FedorkZ
Posts: 6
Joined: Wed Sep 03, 2014 3:15 pm
antibot: No, of course not.

Re: Svg from jfreechart distorsion.

Post by FedorkZ » Wed Sep 24, 2014 1:38 pm

And yes it looks perfect it browser.

Here is an example file:
https://drive.google.com/file/d/0B_KFbS ... sp=sharing

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Svg from jfreechart distorsion.

Post by david.gilbert » Mon Sep 29, 2014 9:05 pm

Thanks for the test file. My first step is trying it out in a browser, this gives me a file encoding error until I replace all the thousands separators for the numerical labels on the axes. Are you doing anything special there? After replacing those, the chart renders fine in all the browsers I have. I'll keep digging.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Svg from jfreechart distorsion.

Post by david.gilbert » Tue Sep 30, 2014 6:50 pm

When you write the SVG to file, do you use the SVGUtils class? It creates an OutputStreamWriter with UTF-8 for the encoding:

Code: Select all

OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
...but according to the error that I'm seeing in FireFox, your file is not UTF-8 encoded. I'd like to at least rule that out as the cause of the issue.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

FedorkZ
Posts: 6
Joined: Wed Sep 03, 2014 3:15 pm
antibot: No, of course not.

Re: Svg from jfreechart distorsion.

Post by FedorkZ » Thu Oct 02, 2014 2:11 pm

This file was generated from context menu of a ChartPanel. "Save as -> SVG..."

Is there any documentation for SVG format that I can use to check.

Locked