I have not posted for a while. Nor Have I looked at JFreeChart since 1.09. I have been following the forum posts and have seen questions about JFreeChart and interactivity. Interactive zooming, drawing panning.
I just wanted to post an example of a program I created in my last job that had to include interactivity. You can see a demo of it here :-
http://www.jsfx.com/java/chart.jnlp
I just wanted to let people know that ChartPanel is a swing components and as such you can add any interactivity you like.
In fact in this demo I did away with ChartPanel and created my own InteractiveChartPanel that extended JComponent and not JPanel.
In this demo you can see context sensitive menus (right click in the axes, the main chart area and over annotations).
You can draw annotations using the buttons to the right H V C T F f n\X S P. To draw. Click a button then click the mouse at a start point then move (not drag) to a secod point and click again. Some annotations require 3 clicks. Right click to cancel drawing. At any point you can drag and it will pan the chart. Mouse wheel will zoom in out.
You can drag in the chart axes to zoom in and out. This was done by calculating when the mouse was out of the chart area - which axis it was over. I have been reading that ChartDetails may contain this info in later releases so may be easier to implement.
One thing it does not demonstrate is the chart is updated in real time. The last bar of the chart updates as trades come in.
Anyway, please take a look and let me know what you think.
Interactive JFreeChart
Interactive JFreeChart
The answer does not come from thinking outside the box, rather the answer comes from realizing the truth; There is no Box. my js site
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Interactive JFreeChart
Hi Roy,
Nice work! The last release of JFreeChart included some new features to support this kind of interactivity (panning by mouse drag, zooming by mouse wheel) but there is of course more to do. I like the way you have done zooming on the axis area - someone already suggested that I modify the mouse wheel zooming to work on just one axis when the mouse pointer is over the axis area, which would give a similar result to what you have. Anyway, thanks for posting your example, it's great to see what is possible...
Nice work! The last release of JFreeChart included some new features to support this kind of interactivity (panning by mouse drag, zooming by mouse wheel) but there is of course more to do. I like the way you have done zooming on the axis area - someone already suggested that I modify the mouse wheel zooming to work on just one axis when the mouse pointer is over the axis area, which would give a similar result to what you have. Anyway, thanks for posting your example, it's great to see what is possible...
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: Interactive JFreeChart
This seems a old post but, good to have a way of doing this on a webpage.
i.e. "Interactive chart on a webpage" like this http://www.highcharts.com/. how can we add a javascripts to a generated chart?
i.e. "Interactive chart on a webpage" like this http://www.highcharts.com/. how can we add a javascripts to a generated chart?