Problem on getMaximumRangeValue()

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

Problem on getMaximumRangeValue()

Post by Anthony Pippen » Wed Apr 25, 2001 10:53 pm

I got the following erro when running my program.
I don't know what the problem cause this, pls kindly
help and tell me what's the prossible cause that make this error msg.
Thx very much!!

Exception occurred during event dispatching:
java.lang.NullPointerException
at com.jrefinery.chart.DataSources.getMaximumRangeValue(Unknown Source)
at com.jrefinery.chart.VerticalBarPlot.getMaximumVerticalDataValue(Unkno
wn Source)
at com.jrefinery.chart.VerticalNumberAxis.autoAdjustRange(Unknown Source
)
at com.jrefinery.chart.VerticalNumberAxis.configure(Unknown Source)
at com.jrefinery.chart.Plot.setChart(Unknown Source)
at com.jrefinery.chart.JFreeChart.<init>(Unknown Source)
at com.jrefinery.chart.JFreeChart.createVerticalBarChart(Unknown Source)

at Balance.genDataSource(Balance.java:438)
at Balance.actionPerformed(Balance.java:301)
at javax.swing.Timer.fireActionPerformed(Timer.java:150)
at javax.swing.Timer$DoPostEvent.run(Timer.java:108)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:317)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

David Gilbert

RE: Problem on getMaximumRangeValue()

Post by David Gilbert » Thu Apr 26, 2001 12:08 am

Anthony,

You should set a breakpoint in this method and step through the code to determine the line that it generates the exception on.

It's possible that your data source is null. Alternatively, if you haven't implemented the CategoryDataSource (or XYDataSource) interface correctly, you could also get a null pointer exception (for example, your getValue() method returns null).

Regards,

DG.

Anthony Pippen

RE: Problem on getMaximumRangeValue()

Post by Anthony Pippen » Thu Apr 26, 2001 1:12 am

Number[][] data = new Double[3][10];

Anthony Pippen

RE: Problem on getMaximumRangeValue()

Post by Anthony Pippen » Thu Apr 26, 2001 1:16 am

Thanks, David

I have initialize the data,

Number[][] data = new Double[3][10];

and assign value into it,

for(int i=0; i<2; i++){
data[0] = new Double(taMean[i+1]);
data[1] = new Double(tsMean[i+1]);
data[2] = new Double(tfMean[i+1]);
}

where taMean[i+1] must have value in it when checking

also, I have implement DefaultCategoryDataSource,

CategoryDataSource myDataSource = new DefaultCategoryDataSource(data);

One more question, Is the initialization of data[][] correct?
and should I assign value to all data[3][10] array element?

Locked