TimeSeriesChart mark datapoint

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

TimeSeriesChart mark datapoint

Post by Traxer » Thu Feb 09, 2012 10:17 am

Hi!

I use a TimeSeriesChart with continous data input. The chart is only a simple line. Now I like to mark some incoming datapoints in the chart with a point or something like that. (I don't like to mark all points, only this ones that matches to my specified criterias)

Any idea how I can get this?

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: TimeSeriesChart mark datapoint

Post by Traxer » Thu Feb 09, 2012 4:31 pm

Ok, I have an idea! I will draw a second chart with an invisible line and a shader....

But, how
- can I set the visibility of a TimeSeries
- and how can I use different shades (one timeseries with shade and an other one without)?

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: TimeSeriesChart mark datapoint

Post by matinh » Thu Feb 09, 2012 5:22 pm

Try adding another dataset to your chart with a different renderer (XYLineAndShapeRenderer with only shapes enabled for example). To this dataset, just add the datapoint you want to mark.

You could also have a look at the XYAnnotation class if this is suitable for your needs.

hth,
- martin

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: TimeSeriesChart mark datapoint

Post by Traxer » Thu Feb 09, 2012 5:44 pm

Hi!

I get it working! :P

Now I am using two TimeSeries (one for the chart(1) and one for the "points"(0))
Then using XYLineAndShapeRenderer (renderer):

Code: Select all

renderer.setSeriesShape(0, new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0)); // shapes for the "points"
renderer.setSeriesLinesVisible(0, false); // no line for the "points"

renderer.setSeriesShapesVisible(1, false); // no shapes for the chart
Maybe this helps somebody else...

Traxer
Posts: 15
Joined: Tue Jan 31, 2012 9:06 pm
antibot: No, of course not.

Re: TimeSeriesChart mark datapoint

Post by Traxer » Thu Feb 09, 2012 5:59 pm

Anybody an idea how to get the values (labels?) of the points into the chart???

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: TimeSeriesChart mark datapoint

Post by paradoxoff » Fri Feb 10, 2012 6:20 pm

Have a look at the method setBaseItemLabelGenerator(XYItemLabelGenerator generator), which is declared in the XYItemRenderer interface.

Locked