Hi David,
you suggested in some other post, that jxlayer can be used with Jfreechart. so here is i am thinking.
I need to show TextAnnotation on chart. (real time, updates about 4 times a second)
when i change the value of annotation i have to call chart.setNotify(true) which will repaint the whole chart which will be cpu intensive.
instead if i use JXlayer to show TextAnnotation on top of chart and just update that instead of updating whole chart ?
is this idea of mine is even considerable ? should i even try or just forget about that?
i will really appreciate some thoughts here. and some idea about reducing cpu load.
Thanks
jxlayer and annotation
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: jxlayer and annotation
I have used JXLayer on a client project to draw crosshairs over a plot. It works quite nicely, but I'm wondering now if JXLayer is strictly necessary for this. It still results in a repaint of the underlying chart, but if the chart doesn't change and the ChartPanel uses an offscreen image buffer then the performance is still good. What I'm experimenting with right now is to do away with the JXLayer dependency and just add the concept of an Overlay for the ChartPanel, where the Overlay interface has a method something like this:
...and the ChartPanel manages list of 0, 1 or many overlays that it draws AFTER the chart has been drawn/painted. I'm pretty sure this will work for plain drawing, I'm less sure that it will offer the same facilities as JXLayer when it comes to capturing mouse and keyboard events.
Code: Select all
public void paintOverlay(Graphics2D g2, ChartPanel chartPanel);
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: jxlayer and annotation
Thanks david for reply, can you roughly say how much time it will take before this overlay functionality incorporated into jfreechart ?
does this concept can be used to improve performance of overall chart ?
i agree with you about not creating dependency on jxlayer after reading your reply.
Thanks
does this concept can be used to improve performance of overall chart ?
i agree with you about not creating dependency on jxlayer after reading your reply.
Thanks
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: jxlayer and annotation
I might get it into the 1.0.13 release (which is already late). It does increase performance, but only to the extent that it does the layer rendering separately from the chart rendering, which means that you can rely on the off-screen chart buffer to "blit" the chart onto the panel (assuming nothing in the underlying chart has changed) then use Java2D calls to draw the layer stuff on top of that.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: jxlayer and annotation
Thanks a lot for reply.
This would definitely help. i cant wait to see 1.0.13
This would definitely help. i cant wait to see 1.0.13