NoSuchElement exception when chart has no samples

Hello,

We are getting NoSuchElementException where there are no samples in the chart.
We tried this java also, and the following is the stack trace,
Could you please help us here?


Exception in thread “JavaFX Application Thread” java.util.NoSuchElementException

at io.data2viz.charts.axis.internal.DefaultAxisRenderer.computeLabelSpaceAndRotation(DefaultAxisRenderer.kt:140)

at io.data2viz.charts.axis.internal.DefaultAxisRenderer.getSize(DefaultAxisRenderer.kt:72)

at io.data2viz.charts.chart.internal.ChartImpl.getPreferredDisplayZone$core(ChartImpl.kt:165)

at io.data2viz.charts.chart.internal.ChartImpl.(ChartImpl.kt:866)

at io.data2viz.charts.chart.ChartKt.chart(Chart.kt:40)

at io.data2viz.charts.chart.ChartKt.chart$default(Chart.kt:35)

at com.camline.space.chartskt.common.SpaceChartKt.createChart(SpaceChart.kt:148)

at com.camline.space.chartskt.SpaceMainJvm.addChart(SpaceMainJvm.kt:484)

at com.camline.space.chartskt.SpaceMainJvm.updateCharts(SpaceMainJvm.kt:438)

at com.camline.space.chartskt.SpaceMainJvm.showChart(SpaceMainJvm.kt:387)

at com.camline.space.chartskt.SpaceMainJvm.start$lambda-30$lambda-29$lambda-28$lambda-27(SpaceMainJvm.kt:138)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)

at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)

at javafx.event.Event.fireEvent(Event.java:198)

at javafx.scene.Node.fireEvent(Node.java:8411)

Many Thanks!

Hi, this should be fixed with the upcoming 1.0.8-RC7, Gaëtan is working on the release.

I handle the fact that we can have missing labels or empty labels, I hope this will fix your issue.


Tested with :

  • empty dataset ( data = listOf<Sample>() )
  • empty formatted ( formatter = { "" } )

We released the 1.0.8-RC7 just now, hope this helps.

Yes, it works now…
Thank you.

1 Like