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.
How to resolve ChartViewer?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How to resolve ChartViewer?
The default JFreeChart build is made to run on Java 1.6 so the JavaFX classes (which require Java 1. 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.
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: How to resolve ChartViewer?
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!
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!
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How to resolve ChartViewer?
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program