How can I draw a begging point at middle of plot?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Juyoun Kim

How can I draw a begging point at middle of plot?

Post by Juyoun Kim » Mon Jan 20, 2003 4:00 am

I use HorizontalDateAxis, VerticalNumberAxis, BasicTimeSeries, XYPlot.

When I add a value to BasicTimeSeries, the value was added at tail of the plot.

So recent data are located at most right position.

But I'd like to add a value at middle of the plot. Of couse current time is located at middle of the plot.

How can I solve this problem?

David Gilbert

Re: How can I draw a begging point at middle of plot?

Post by David Gilbert » Mon Jan 20, 2003 6:47 pm

It's not so easy, unless you want to manually set the axis range and adjust it every time you add a new value.

Or you could try setting the upper margin on the axis to a large percentage value, something like this:

XYPlot plot = myChart.getXYPlot();
ValueAxis domainAxis = plot.getDomainAxis();
domainAxis.setUpperMargin(0.50);

You might even be able to set the value to 1.0, I forget exactly how it calculates the margin. Take a look in the source code to see how it gets used...

Regards,

Dave Gilbert

Locked