Page 1 of 1

ArrayIndexOutOfBoundsException when creating line chart

Posted: Mon Jun 16, 2008 9:17 pm
by 7667591
Hi,

Thanks for your reply to my previous query. I have a different issue now.
I am getting the below mentioned exception when I tried to add large number of points to a line chart. I have seen a similar query in the forum.
I am also using a dual core machine. Is this because of the machine type or something else ? If the number of points are small then I am able to create a line chart.

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2000
at com.steema.teechart.axis.AxisDraw.addTick(AxisDraw.java:432)
at com.steema.teechart.axis.AxisDraw.drawThisLabel(AxisDraw.java:463)
at com.steema.teechart.axis.AxisDraw.internalDrawLabel(AxisDraw.java:447)
at com.steema.teechart.axis.AxisDraw.doDefaultLabels(AxisDraw.java:623)
at com.steema.teechart.axis.AxisDraw.doNotCustomLabels(AxisDraw.java:687)
at com.steema.teechart.axis.AxisDraw.doCustomLabels(AxisDraw.java:715)
at com.steema.teechart.axis.AxisDraw.draw(AxisDraw.java:1034)
at com.steema.teechart.axis.Axis.draw(Axis.java:2521)
at com.steema.teechart.axis.Axes.draw(Axes.java:410)
at com.steema.teechart.Chart.internalDraw(Chart.java:645)
at com.steema.teechart.Chart.paint(Chart.java:1807)
at com.steema.teechart.TChart.paintComponent(TChart.java:568)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Thanks,
Varun

Posted: Fri Jun 27, 2008 10:03 am
by Marc
Hello Varun,

Sorry for the delay with this reply. We've been unable to reproduce the problem. Do you have a sample project or code that we could use to generate the error?

If the problem is a TeeChart process-cycle error then it may be that it appears more readily on a dual core machine, though the problem is most likely to be applicable to all machine types by nature.

With thanks.
Regards,
Marc Meumann

Posted: Fri Jun 27, 2008 2:40 pm
by 7667591
Hi,

This issue may be related to setIncrement() of TChart.

teeChartAxis.setIncrement(teeChartAxis.getMinAxisIncrement());

If my x-axis represent date values, then setting axis label increment to "min axis increment" throws this exception.

Hope that you have understood the issue now.
Now I am checking for date explicitly, is there any other way I could do this ?

Thanks,
Varun

Posted: Fri Jun 27, 2008 4:21 pm
by Marc
Hello Varun,

Thanks, we can provoke a failure using teeChartAxis.setIncrement(teeChartAxis.getMinAxisIncrement()) in that way. We'll make some checks and get back to you.

Regards,
Marc

Posted: Mon Jun 30, 2008 3:10 pm
by Marc
Hello Varun,

We believe we've found the cause of the problem. A fix is being tested for inclusion in the next maintenance release.

Regards,
Marc

Posted: Mon Jun 30, 2008 8:58 pm
by 7667591
Hi,

That is encouraging.
I have another question, Can we draw rectangles in the chart panel using mouse ?

Thanks,
Varun

Posted: Tue Jul 01, 2008 9:25 am
by narcis
Hi Varun,

Yes, you can custom draw on TeeChart's canvas as shown in Tutorial 10 - Custom drawing on the Chart Panel. For defining rectangle coordinates you could use mouse pressed and released events as shown on this thread.

Hope this helps!