DomainAxis - ClassCastException

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

DomainAxis - ClassCastException

Post by John » Sun Aug 25, 2002 7:57 pm

When trying to work with the domain axis (horizintal axis) on an XYChart, I get the following exception:

java.lang.ClassCastException: com.jrefinery.chart.HorizontalNumberAxis

Can anyone help me figure out what I am doing wrong?

Here is what I have -

1) Data is in a BasicTimeSeries, using the Millisecond class.
2) I get a reference to a plot,
XYPlot plot = chart.getXYPlot();
3) I get a reference to the HorizontalDateAxis,
HorizontalDateAxis axis = (HorizontalDateAxis)plot.getDomainAxis();

At this point, I get the exception.

David Gilbert

Re: DomainAxis - ClassCastException

Post by David Gilbert » Mon Aug 26, 2002 8:28 am

The horizontal axis could be a HorizontalNumberAxis or a HorizontalDateAxis, depending on how you generated your chart. It looks like you have a HorizontalNumberAxis.

Regards,

DG

Locked