1

I have a JFreeChart TimeSeries chart that has 2 data item.
I need to mark points in it.
For example I need it show at a specific time what is the line's value (while there is not actually any value and JFreeChart created line).
Example:

TimeSeries t=new TimeSeries("Test",Second.class);
Dataset.addSeries(t);

Calendar C=Calendar.getInstance();
t.add(new Second(C.getTime()), 100);

C.setTimeInMillis(C.setTimeInMillis+10*60*60*1000);
t.add(new Second(C.getTime()),200);


// Now I want Something like this psudo code
C.setTimeInMillis(C.setTimeInMillis-5*60*60*1000);
t.mark(new Second(C.getTime()));

How Can I mark points on a series by their domain value (So the range value should be calculated automatically)?

Thanks

Ariyan
  • 14,760
  • 31
  • 112
  • 175

1 Answers1

2

One convenient way to show interpolated values is to enable the axis trace feature, as shown in this example.

chartPanel.setHorizontalAxisTrace(true);
chartPanel.setVerticalAxisTrace(true);

Addendum: An alternative is to add the interpolated values to the data set and suppress the display of their Shape, as shown here. The (unmarked) value will then be available to a tool tip generator, label generator, chart mouse listener, etc.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Hi Thanks but this only helps be to find value on the axis itself while I need exact value in some (exactly 3) point in the between two points. – Ariyan Jan 03 '12 at 21:36
  • You'll have to do your own [linear interpolation](http://en.wikipedia.org/wiki/Linear_interpolation) to translate _view_ to _model_ coordinates; the `drawXxxAxisTrace()` methods show how to get the _view_ bounds. – trashgod Jan 04 '12 at 03:08