A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
-
Mala
- Posts: 8
- Joined: Tue Jan 28, 2014 1:06 pm
- antibot: No, of course not.
Post
by Mala » Fri Jan 31, 2014 11:58 am
Hi,
I have created a SVG for 3D Bar chart and viewed in different browsers
Linear gradient used is as following
Code: Select all
// set up gradient paints for series...
GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue,
0.1f, 0.0f, new Color(64, 0, 64));
GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green,
0.0f, 0.0f, new Color(0, 64, 0));
Foloowig are th results I obtained in IE/Chrome and Firefox.
IE :
http://postimg.org/image/mnrfrlsgh/
Chrome :
http://postimg.org/image/q4thukrip/
Firefox:
http://postimg.org/image/zdvo4p0ep/
Why there are differences.?
Thanks in advance
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Sun Feb 02, 2014 5:15 pm
I can reproduce the problem (or at least something similar). So far, I don't see any issue in the SVG that is being generated by JFreeSVG...but I will try a few more things and see if I can narrow down the issue.
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Sun Feb 02, 2014 5:28 pm
In fact, for the second gradient you specify (0, 0) for both the start and the end of the gradient. The SVG spec says:
If ‘x1’ = ‘x2’ and ‘y1’ = ‘y2’, then the area to be painted will be painted as a single color using the color and opacity of the last gradient stop.
I see Firefox doing this correctly, Chrome choosing the color of the first stop, and Safari somehow using both stops and drawing a gradient anyway.