jfree/jfreechart

`org.jfree.chart.ChartUtilities` renamed to `org.jfree.chart.ChartUtils` without deprecated paper-trail

ronreynolds2 opened this issue · 25 comments

more of a comment; tho also the javadocs don't mention this move (in fact Google has yet to hear of org.jfree.chart.ChartUtils; it was only by cracking open the 1.5.0 jar that we were able to find where ChartUtilities went).

Please correct me if I am wrong but I believe the same happened with org.jfree.chart.util.ParamChecks. It's named org.jfree.chart.util.Args now.

The change you mention can be found in this commit: 0763be8ec6b44c7fd782fd497aadcd455f0491f0

The change I mention can be found in this one: 22701c9ec4cd5bd88f8a7f17ae11c18099dd1ec7

Also many getBase/setBase methods were renamed to getDefault/setDefault (e.g., XYLineAndShapeRenderer.setBaseLinesVisible() -> XYLineAndShapeRenderer.setDefaultLinesVisible(). I had to correct about 200 compilation errors in my project after upgrading JFreeChart from 1.0.19 to 1.5.0. That's life, I guess. But wasn't the https://github.com/jfree/jfreechart-fse project started for that purpose (updating the API)?

jfree commented

Please list all the changes you spot, I'll add migration notes to the README. And I'll get the latest API docs uploaded and update the website.

This is what noted when ported my application from jfreechart 1.10.19:

  • org.jfree.ui became org.jfree.chart.ui

And

  • (Stacked)BarRenderer3D
  • Axis3D
  • setToolTipGenerator()
  • org.jfree.ui.about

disapperead? These changes impact my exisitng functionality.

org.jfree.ui.RefineryUtilities -> org.jfree.chart.ui.UIUtils

import org.jfree.ui. ... -> import org.jfree.chart.ui. ...

But most important: The 1.5.0 charts looks as good as the 1.0.19 charts -> everything is working fine after the manual code migration :-) Thank you @jfree for this library!

@Petikoch - Did you use any of 3D Bar Charts, Custom Tooltips, Context Menus? It seems they went AWOL?

@krheinwald I don’t know, I’m using only 2D stuff

Thanks! Any experience with the other sstuff -Tooltips, Context Menus?

jfree commented

I successfully migrated to JFreeChart 1.5, only lots of (painful but) trivial class name changes / fix imports.

One question:
I just figured out the (default) legend has no more a visible border, is it wanted ?
You can see it in jfreechart demos v1.0.19 but no more in v1.5

Will see if there are new legend properties...

DatasetUtilities moved to DatasetUtils

ShapeUtilities renamed to ShapeUtils
TextUtilities renamed to TextUtils

isPointInRect moved from AbstractXYItemRenderer to ShapeUtils

I had used custom calculateDomainMarkerTextAnchorPoint() in CombinedDomainXYPlot.
I change method from RectangleAnchor.coordinates(Rectangle2D anchorRect. RectangleAnchor anchor) to anchor.getAnchorPoint(RectangleAnchor anchorRect).

Method RectangleAnchor.coordinates() disappeared.

I see that change here in the v1.5.3 branch. The changes may guide your revised approach.

When migrating from JFreeChart 1.0.17 to 1.5.4, I changed :

setStroke(Stroke) -> setDefaultStroke(Stroke)
setBaseShapesVisible(boolean) -> setDefaultShapesVisible(boolean)

And

rendererBlue.setDefaultStroke(new BasicStroke(3.0f));

became

 renderer.setDefaultStroke(new BasicStroke(3.0f));
 ((AbstractRenderer) renderer).setAutoPopulateSeriesStroke(false);

(See jfree.org/forum for the last change justification)

See also Migration.

Right clicking a chart and selecting "save as ... png" I got this error msg : "java.lang.NoClassDefFoundError: org/jfree/chart/ChartUtilities". (Jfreechart vers. 1.5.4, maven dependency)

Right clicking a chart and selecting "save as ... png" I got this error msg : "java.lang.NoClassDefFoundError: org/jfree/chart/ChartUtilities". (Jfreechart vers. 1.5.4, maven dependency)

I can't reproduce this using jfreechart-1.5.4 from here, which uses org.jfree.chart.ChartUtils. Any chance you have an older version in the classpath?

Probably this issue comes from this MAVEN dependency I used:

org.jfree jfreechart 1.5.4

In fact, replacing this dependency with your jfreechart-1.5.4.jar file directly in my java build path all runs OK.

Note: I compared with Windows FC command your jfreechart-1.5.4.jar file with my maven downloaded file and they seem identical, so I don't understand why the second solution works fine

Thank you for your support

Yes, the files have identical checksums. Did any older version(s) turn up on the classpath? You might search for errant JARs in the directories found in the system property java.library.path or your IDE's project library.

Found, it's my fault. My Java application is designed in the SWT framework, so I thought I should use both MAVEN dependencies for jfreechart-1.5.4.jar and jfreechart-swt-1.0.jar. It was a big mistake, only the latter is necessary!!
In fact, jfreechart-swt-1.0.jar has embedded jfreechart-1.0.19.jar (and other jars...) as you can see in the attached file
By doing so everything really works well!!
Your last comment, trashgod, put me on the right track, thanks

sorry, this is the file
Screenshot 2024-04-25 170308