A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
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 » Thu Jul 03, 2014 10:10 pm
JFreeChart 1.0.18 has been uploaded to SourceForge. From the README:
Code: Select all
JFreeChart 1.0.18
-----------------
3 July 2014
Added JavaFX support with a new ChartViewer control that supports tooltips,
mouse clicks, panning, zooming and a context menu. Modified LogAxis to
support super-scripted labels, improved the tick label generation for
NumberAxis, added a new ProbabilityAxis (patch from John St. Ledger),
enhanced XYStepAreaRenderer to support a 'stepPoint' attribute (patch from
Lukasz Rzeszotarski), provided configurable direction labels in
CompassFormat (patch from Simon Legner), added methods to add data item
objects to VectorSeries, XIntervalSeries, YIntervalSeries and
XYIntervalSeries (for consistency with other data series objects),
improved the TimeSeries range calculations, provided center text support
for the RingPlot class, and updated JCommon to version 1.0.22 (this fixes
a bug in pie label rendering).
Bug Fixes:
- BarRenderer3D now observes the 'visibleSeries' settings;
- TimeSeriesCollection now takes xRange into account when calculating the
range bounds;
- added missing localisation for 'Save As' option on ChartPanel;
- inverted SymbolAxis not displaying bands correctly;
- fixed fillDomainGridBand() method in AbstractXYItemRenderer;
- replaced ObjectList with java.util.Map to avoid bug in equals() methods.
-
DullingWine
- Posts: 7
- Joined: Fri Jun 27, 2014 2:01 am
- antibot: No, of course not.
Post
by DullingWine » Fri Jul 04, 2014 1:07 am
Hi
Great news but the jfreechart-1.0.18.jar in lib doesn't contain the fx package? I built a jar the other day from the source, and got it working...with some problems that i was going to tell you about but...when i updated to 1.0.18 from the zip posted on sourceforge i see that the fx package is missing from the jar, though it is in the class?
The problems i saw:
- it only seems to be rendering one plot - i have a CombinedDomainXYPlot, and its only rendering the top plot.
- some mouse exceptions - but this one i need to investigate further before reporting it.
The better news though, is that it is working on the mac as well as PC. I was very stuck on the mac, with it basically hanging in low level graphics calls continuously, this seems to have fixed, although won't know for sure until everything is plotted.
Thanks vm
-
DullingWine
- Posts: 7
- Joined: Fri Jun 27, 2014 2:01 am
- antibot: No, of course not.
Post
by DullingWine » Fri Jul 04, 2014 1:44 am
When i added in the fx classes into the jar, i saw the same issues with my chart:
- I haven't yet figured out why it isn't rendering the second plot of CombinedDomainXYPlot - its making room for it and drawing the X axis, but no actual second plot, even though seems to go through the rendering code fine. It does work fine when combined with a conventional ChartPanel and SwingNode.
- any kind of mouse zooming etc. results in an NPE - this is because
Code: Select all
ZoomHandlerFX .handleMouseReleased()
is passing a null third argument to zoomRangeAxes which results in an NPE in
Code: Select all
CombinedDomainXYPlot.findSubPlot()
:
Code: Select all
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Null 'info' argument.
at org.jfree.chart.util.ParamChecks.nullNotPermitted(ParamChecks.java:65)
at org.jfree.chart.plot.CombinedDomainXYPlot.findSubplot(CombinedDomainXYPlot.java:621)
at org.jfree.chart.plot.CombinedDomainXYPlot.zoomRangeAxes(CombinedDomainXYPlot.java:568)
at org.jfree.chart.fx.interaction.ZoomHandlerFX.handleMouseReleased(ZoomHandlerFX.java:243)
at org.jfree.chart.fx.ChartCanvas.handleMouseReleased(ChartCanvas.java:478)
-
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 » Fri Jul 04, 2014 3:59 am
DullingWine wrote:Great news but the jfreechart-1.0.18.jar in lib doesn't contain the fx package? I built a jar the other day from the source, and got it working...with some problems that i was going to tell you about but...when i updated to 1.0.18 from the zip posted on sourceforge i see that the fx package is missing from the jar, though it is in the class?
The pre-built jar file in the distribution is compiled for JRE/JDK 1.6.0, so the JavaFX support classes are omitted. You can run the ant/build-fx.xml script (this requires JDK 1.8 ) to build a version of JFreeChart with the JavaFX support classes included.
DullingWine wrote:- it only seems to be rendering one plot - i have a CombinedDomainXYPlot, and its only rendering the top plot.
I'll take a look, most likely it is a clip region issue in the FXGraphics2D class. There will be a JFreeChart 1.0.19 release before too long, most likely in August, to fix some of the initial problems with the JavaFX support (I'm presuming there will be more).
-
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 » Fri Jul 04, 2014 6:01 am
This patch looks like it fixes the first issue:
Code: Select all
# Above lines and this line are ignored by the patching process.
Index: FXGraphics2D.java
--- FXGraphics2D.java Base (BASE)
+++ FXGraphics2D.java Locally Modified (Based On LOCAL)
@@ -109,6 +109,8 @@
private final GraphicsContext gc;
+ private int saveCount = 0;
+
private boolean clippingDisabled = false;
/** Rendering hints (all ignored). */
@@ -1105,14 +1107,33 @@
*/
@Override
public void setClip(Shape shape) {
+ boolean restored = false;
+ while (this.saveCount > 0) {
+ this.gc.restore();
+ restored = true;
+ this.saveCount--;
+ }
+ if (restored) {
+ reapplyAttributes();
+ }
// null is handled fine here...
this.clip = this.transform.createTransformedShape(shape);
- if (clip != null) { // FIXME: this is not the correct handling for null
+ if (clip != null) {
+ this.gc.save();
+ this.saveCount++;
shapeToPath(shape);
- //this.gc.clip();
+ this.gc.clip();
}
}
+ private void reapplyAttributes() {
+ setPaint(this.paint);
+ setBackground(this.background);
+ setStroke(this.stroke);
+ setFont(this.font);
+ setTransform(this.transform);
+ }
+
/**
* Clips to the intersection of the current clipping region and the
* specified shape.
@@ -1135,19 +1156,23 @@
return;
}
Shape ts = this.transform.createTransformedShape(s);
+ Shape clipNew;
if (!ts.intersects(this.clip.getBounds2D())) {
- setClip(new Rectangle2D.Double());
+ clipNew = new Rectangle2D.Double();
} else {
Area a1 = new Area(ts);
Area a2 = new Area(this.clip);
a1.intersect(a2);
- this.clip = new Path2D.Double(a1);
- shapeToPath(this.clip);
+ clipNew = new Path2D.Double(a1);
+ }
+ this.clip = clipNew;
if (!this.clippingDisabled) {
+ this.gc.save();
+ this.saveCount++;
+ shapeToPath(this.clip);
this.gc.clip();
}
}
- }
/**
* Clips to the intersection of the current clipping region and the
-
DullingWine
- Posts: 7
- Joined: Fri Jun 27, 2014 2:01 am
- antibot: No, of course not.
Post
by DullingWine » Sat Jul 05, 2014 12:16 am
Hi
Thanks for the amazingly fast response on this.
I can confirm that this fixes both of the issues i found + the Mac version works as well (though the Java devs have committed a fix for the hang as well).
Thanks!
PS I note that the ant build for the fx version doesn't bundle the chart-viewer.css file, not sure if this is deliberate or not.
-
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 » Sat Jul 05, 2014 6:34 am
DullingWine wrote:PS I note that the ant build for the fx version doesn't bundle the chart-viewer.css file, not sure if this is deliberate or not.
No, that's an error, thanks for spotting it. I've fixed it for the next release (which should be out before the end of July).
-
whaid
- Posts: 2
- Joined: Tue Jul 15, 2014 3:20 pm
- antibot: No, of course not.
Post
by whaid » Tue Jul 15, 2014 3:32 pm
Hi,
today I tried version 1.0.18 and discovered a different behaviour to version 1.0.17:
the lines (e.g. x,y axsis and border lines) of the charts are a little bit blurred(thicker and gray). Is this a bug or did I miss some new configuration parameters in version 1.0.18?
Regards,
Wolfgang
-
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 » Thu Jul 17, 2014 2:53 pm
I suspect this will be because I added the following code to the JFreeChart constructor:
Code: Select all
// added the following hint because of
// http://stackoverflow.com/questions/7785082/
this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
-
whaid
- Posts: 2
- Joined: Tue Jul 15, 2014 3:20 pm
- antibot: No, of course not.
Post
by whaid » Fri Jul 18, 2014 12:59 pm
david.gilbert wrote:I suspect this will be because I added the following code to the JFreeChart constructor:
Code: Select all
// added the following hint because of
// http://stackoverflow.com/questions/7785082/
this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
Thx for your response.
We solved this issue in our code by setting:
Code: Select all
chart.getRenderingHints().put(
RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE
);
works also with
Code: Select all
RenderingHints.VALUE_STROKE_DEFAULT
Will this beahaviour remain also in future versions or have you planned to switch back to 1.0.17 behaviour?
Have a nice weekend,
Wolfgang
-
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 » Mon Jul 21, 2014 9:21 pm
I want to keep this new setting, but I am testing a patch for 1.0.19 where some pixel-alignment is performed for axis lines, gridlines and tick marks when the output target is pixel-based.
-
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 » Tue Jul 22, 2014 9:54 am
In fact, I will selectively apply the STROKE_NORMALIZE rendering hint (for axis lines, gridlines, tick marks, cross-hairs) and leave the (new) default STROKE_PURE for everything else.
-
bsarter
- Posts: 2
- Joined: Fri Jul 26, 2013 1:49 pm
- antibot: No, of course not.
Post
by bsarter » Thu Jul 24, 2014 4:36 pm
Hi,
It seems that SWT classes (eg. ChartComposite) are no longer in the 'experimental' binary jar that comes with 1.0.18 (they were in 1.0.16, and I admit that I didn't checked 1.0.17).
Is this done by intention ? How to get a binary package supporting SWT ?
Thanks & best regards,
Bernard.
-
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 » Thu Jul 24, 2014 6:55 pm
No, it wasn't intentional…I'll get them back in for the 1.0.19 release. But I am dropping the SWT support from JFreeChart 2, if someone else wants to maintain the code then they are welcome.