How to resolve ChartViewer?

A discussion forum for FXGraphics2D (adds a Java2D API to the JavaFX Canvas).

How to resolve ChartViewer?

Postby desp » Mon Oct 24, 2016 9:30 pm

I am trying to embed JFreeChart into an FX application. I thought I followed the examples correctly but I get an error message that ChartViewer cannot be resolved to a type. When I add the import org.jfree.chart.fx.ChartViewer, it cannot be resolved either. ChartViewer is not in the jFreeChart nor in the FXGraphics2D library. Anyone a suggestion how to solve this problem?

Being a Java newbie I (think) I have searched the net rather exhaustively but couldn't find an exact answer for this problem. The libraries are in the build path, have been recompiled with ant and I have the examples with the ApplicationFrame running.

Thank you in advance.
desp
 
Posts: 2
Joined: Mon Oct 24, 2016 9:20 pm

Re: How to resolve ChartViewer?

Postby david.gilbert » Mon Oct 24, 2016 9:52 pm

The default JFreeChart build is made to run on Java 1.6 so the JavaFX classes (which require Java 1.8) are excluded. You can easily build a version that includes the JavaFX classes using the Ant script build-fx.xml that you'll find in the 'ant' directory in the distribution.

I'm planning to make this much easier in the next release, probably by releasing two separate versions, one including JavaFX support and another specifically for Java 1.6.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11600
Joined: Fri Mar 14, 2003 10:29 am

Re: How to resolve ChartViewer?

Postby desp » Tue Oct 25, 2016 6:59 am

Hi David, thanks for your reply, it worked! I was going to advise to document that feature, but I searched again and I found it documented as well. It's just a matter of looking :-). I had to solve the visibility of getUserAgentStyle. Fortunately that popped up in the searches.

Just for my understanding: jfreechart-1.0.19 *replaces* jfreechart-1.0.19-fx? And some methods have a different signature? I used ChartFactory.createXYAreaChart with 8 parameters using jfreechart-1.0.19. When using jfreechart-1.0.19-fx I had to remove the last 4 parameters. Any pointer to a url I may have overlooked is welcome :-)

Thanks a lot!
desp
 
Posts: 2
Joined: Mon Oct 24, 2016 9:20 pm

Re: How to resolve ChartViewer?

Postby david.gilbert » Thu Oct 27, 2016 8:27 pm

The method signatures should be the same (the build for JavaFX adds some additional classes but doesn't modify anything). The original methods in ChartFactory had 8 parameters but I introduced simpler versions with the last 4 parameters taking default values, so you should see two versions of createXYAreaChart().
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11600
Joined: Fri Mar 14, 2003 10:29 am


Return to FXGraphics2D

Who is online

Users browsing this forum: No registered users and 1 guest