Possible to update/refresh time series chart renderer?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
stillLearning
Posts: 2
Joined: Tue Sep 16, 2014 2:43 am
antibot: No, of course not.

Possible to update/refresh time series chart renderer?

Post by stillLearning » Tue Sep 16, 2014 3:04 am

Hello all,

Like the subject says, I'm looking to update or refresh the chart renderer. My end goal is to have a slider underneath the chart and have a shape move along the time series line along with the slider. I have created a time series chart and set a renderer to it, then added it to a plot (CombinedDomainXYPlot). I can get the chart to display and show a shape at a single data point using getItemShapeVisible, but I can't get it to change positions. I believe I need to update the renderer? It feels like I've been spinning my wheels for the last couple of days, so if it is possible, would anyone mind sharing some example code or insight on how this might be done? Also, if there is a post regarding this already then I apologize, as I have not yet been able to find it by searching.

Thanks in advance,
Andrew

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Possible to update/refresh time series chart renderer?

Post by david.gilbert » Wed Sep 17, 2014 8:26 pm

One option would be to use the Overlay mechanism on the ChartPanel. Take a look at the CrosshairOverlay class (particularly the paintOverlay() method) to see how it draws some crosshairs for a point on a series nearest to the mouse pointer location. It would not be hard to adapt this to draw some shape at the same (x, y) location.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

stillLearning
Posts: 2
Joined: Tue Sep 16, 2014 2:43 am
antibot: No, of course not.

Re: Possible to update/refresh time series chart renderer?

Post by stillLearning » Thu Sep 18, 2014 2:20 am

Thanks David, I'll look into the crosshair. Also, I tried a domain value marker which would possibly follow the slider by providing a vertical line, but I could only get it to draw on creation of the chart. Essentially not updating it's position. Any idea if having a "moving" value marker is possible?

Locked