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)
Problem on getMaximumRangeValue()
RE: Problem on getMaximumRangeValue()
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.
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.
RE: Problem on getMaximumRangeValue()
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?
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?