Closed Zelenyy closed 5 years ago
I suggest to provide the error.
@Zelenyy Could you specify the error? It should work as long as you pass the typed list. As far as I remember, current design of DataForge numberlist
delegate accepts Any
in order to work both with arrays and lists. I do not like this solution. Maybe we should hide direct access to those field by custom setters?
@altavir @natanfudge Code:
val x = emptyList<Double>()
val y = emptyList<Double>()
val plot = Plotly.plot2D {
trace(x, y) {
name = "for a single trace in graph its name would be hidden"
}
layout {
title = "Graph name"
xaxis {
title = "x axis"
}
yaxis {
title = "y axis"
}
}
}
Error:
Exception in thread "main" java.lang.IllegalArgumentException: Can't create list value from empty list
at hep.dataforge.values.ListValue.<init>(Value.kt:171)
at hep.dataforge.values.Value$Companion.of(Value.kt:59)
at hep.dataforge.meta.MutableValueDelegate$transform$1.invoke(Delegates.kt:187)
at hep.dataforge.meta.MutableValueDelegate$transform$1.invoke(Delegates.kt:169)
at hep.dataforge.meta.ReadWriteDelegateWrapper.setValue(Delegates.kt:371)
at scientifik.plotly.models.Trace.setX(Trace.kt)
at scientifik.plotly.models.Trace$Companion.build(Trace.kt:54)
at scientifik.plotly.Plot2D.trace(Plot2D.kt:26)
at scientifik.plotly.Plot2DKt.trace(Plot2D.kt:46)
at StaticPlotKt$main$plot$1.invoke(staticPlot.kt:16)
at StaticPlotKt$main$plot$1.invoke(staticPlot.kt)
at scientifik.plotly.Plotly.plot2D(Plotly.kt:15)
at StaticPlotKt.main(staticPlot.kt:15)
at StaticPlotKt.main(staticPlot.kt)
OK, it is a DataForge issue. I will fix it in next release.
Fixed via b27a4fd
An error occurs if pass
emptyList
intrace
.