Multiple series - shared RangeAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
nubiste
Posts: 13
Joined: Mon Aug 04, 2008 9:53 am

Multiple series - shared RangeAxis

Post by nubiste » Wed Nov 05, 2008 1:49 pm

Hi,

I get a nullPointerException on trying to draw a
CombinedDomainXYPlot with a subplot of type: XYPlot,
2 datasets type: TimeSeriesCollection
1 Range Axis type: NumberAxis

I've succesfuly drawn multiple series with shared RangeAxis with the same setup as above, the only differences being:
XYSeriesCollection instead of TimeSeriesCollection
In the problematic case the combinedPlot is being serialized/deserialized over the web and then drawn on the applet.
The test case that works, all happens localy.

I can send more details as needed.
Any help appreciated.

Thanks
Stelios

nubiste
Posts: 13
Joined: Mon Aug 04, 2008 9:53 am

Post by nubiste » Wed Nov 05, 2008 3:40 pm

ok I now have the demo (the one that runs locally)
and the "real" app (the one which the plot gets serialized/deserialized)

to be exactly the same, same number and types of combinedPlot, subplot, datasets, range etc. The only difference being the size of the series and the modCount of the subplot ArrayList which in the "demo" version is 1 and in the "real" is 0. As fas as I understand this is because the object I get upon deserialization doesn't detect a change in the subplot ArrayList.

The demo still works while the other fails. Is there any issue with serialization that is causing this?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Nov 05, 2008 4:02 pm

Can you post the full stack trace? The serialization should work as far as I know...some code to reproduce the error would be excellent.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

nubiste
Posts: 13
Joined: Mon Aug 04, 2008 9:53 am

Stacktrace

Post by nubiste » Wed Nov 05, 2008 4:09 pm

here is the stacktrace: I'll try to make a dame asap.

Code: Select all

Exception in thread "AWT-EventQueue-13" java.lang.NullPointerException
	at org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.drawPrimaryLine(XYLineAndShapeRenderer.java:879)
	at org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.drawItem(XYLineAndShapeRenderer.java:785)
	at org.jfree.chart.plot.XYPlot.render(XYPlot.java:2627)
	at org.jfree.chart.plot.XYPlot.draw(XYPlot.java:2205)
	at org.jfree.chart.plot.CombinedDomainXYPlot.draw(CombinedDomainXYPlot.java:453)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1058)
	at org.jfree.chart.ChartPanel.paintComponent(ChartPanel.java:1274)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintToOffscreen(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)
I still believe there is some error somewhere in my code. The thing that I can't understand though is that in the debugger the plot seems identical...
After the deserialization that is.

Thanks
Stelios

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Nov 05, 2008 4:23 pm

Which version of JFreeChart? (I'm trying to match up the line numbers in the stack trace).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

nubiste
Posts: 13
Joined: Mon Aug 04, 2008 9:53 am

SOLVED

Post by nubiste » Wed Nov 05, 2008 4:34 pm

False alert, it was my error as suspected...
I had a wrong mapping (mapDatasetToRangeAxis) hence it was giving the NPE.

apologies
stelios

Locked