Getting a reference to ChartCanvas (JavaFX)
Getting a reference to ChartCanvas (JavaFX)
Hi,
It seems there is no way to get a reference to ChartCanvas from the corresponding ChartViewer node. I need the reference to manipulate the mouse listeners, which are properties of the canvas, not of the ChartViewer.
Perhaps this is an easy thing to add to version 1.0.20?
Tomas
It seems there is no way to get a reference to ChartCanvas from the corresponding ChartViewer node. I need the reference to manipulate the mouse listeners, which are properties of the canvas, not of the ChartViewer.
Perhaps this is an easy thing to add to version 1.0.20?
Tomas
Re: Getting a reference to ChartCanvas (JavaFX)
In a related comment, it seems there used to be an option to enable/disable domain/range axis mouse-wheel zooming, but that option is not present in the JavaFX ChartViewer.
See this line: https://github.com/jfree/jfreechart/blo ... .java#L133
It would be nice to have that option, though.
See this line: https://github.com/jfree/jfreechart/blo ... .java#L133
It would be nice to have that option, though.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
Thanks for the feedback. I agree this is necessary, I will add it for the 1.0.20 release.plusik wrote:It seems there is no way to get a reference to ChartCanvas from the corresponding ChartViewer node. I need the reference to manipulate the mouse listeners, which are properties of the canvas, not of the ChartViewer.
Perhaps this is an easy thing to add to version 1.0.20?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
I will add this too.plusik wrote:In a related comment, it seems there used to be an option to enable/disable domain/range axis mouse-wheel zooming, but that option is not present in the JavaFX ChartViewer.
See this line: https://github.com/jfree/jfreechart/blo ... .java#L133
It would be nice to have that option, though.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
Here is the change to add the reference to the ChartCanvas:
https://github.com/jfree/jfreechart/com ... 3b2c41e78d
https://github.com/jfree/jfreechart/com ... 3b2c41e78d
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
Actually I'm considering doing away with the ChartViewer control and just building everything into the ChartCanvas class, I don't see much real need for the separation anymore.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Getting a reference to ChartCanvas (JavaFX)
Why not remove ChartCanvas and put everything into ChartViewer, for the sake of backwards compatibility?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
Maybe. Whatever the name of the class, it will have to extend the JavaFX Canvas (as ChartCanvas does now). I think it won't be possible to keep backward compatibility completely, but I'm not so worried about that for the JavaFX code (it's mentioned in the API docs that the API is subject to change, since I knew it would probably have to).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Getting a reference to ChartCanvas (JavaFX)
I guess ChartViewer extending Control makes some sense, because Control is for components that the user interacts with, while Canvas is for plain drawing.
JFreeChart seems more like Control to me, because it has zooming, context menus, tooltips, etc.
JFreeChart seems more like Control to me, because it has zooming, context menus, tooltips, etc.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
Yes, I agree with that. But what I'm finding is that extending Control isn't bringing a lot of benefits and it's making the implementation more complex. So why not just merge ChartViewer and ChartCanvas into a single class extending Canvas? I think for the typical use case, it will be easier to work with.
I also notice that the JavaFX chart classes don't extend Control, although I don't know why they chose to do that.
I also notice that the JavaFX chart classes don't extend Control, although I don't know why they chose to do that.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Getting a reference to ChartCanvas (JavaFX)
If it becomes a Canvas extension, please keep the contextMenu property (as a JavaFX property), so the context menu can be defined it FXML.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting a reference to ChartCanvas (JavaFX)
In the end I decided to keep the ChartViewer class as a Control subclass, partly for the contextMenu that you mention.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

