Currently to create data for a chart it has to be parameterized using JavaFX
types. For instance, you need to write something like this, pay attention to
`jfxsc`:
import javafx.scene.{chart => jfxsc}
import scalafx.scene.chart.{AreaChart, NumberAxis}
import scalafx.collections.ObservableBuffer
...
val xySeries4 = new jfxsc.XYChart.Series[Number, Number]("Series 4",
ObservableBuffer(
new jfxsc.XYChart.Data[Number, Number](0, 4),
new jfxsc.XYChart.Data[Number, Number](2, 16),
new jfxsc.XYChart.Data[Number, Number](4, 12),
new jfxsc.XYChart.Data[Number, Number](6, 8),
new jfxsc.XYChart.Data[Number, Number](8, 9),
new jfxsc.XYChart.Data[Number, Number](10, 11)
)
)
val data = ObservableBuffer(xySeries4)
val chart = AreaChart(xAxis, yAxis, data)
It should be possible to do it without using JavaFX types explicitly, relaying
on implicit conversions and `apply` methods, for instance something like this:
import scalafx.scene.chart.{AreaChart, NumberAxis, XYChart}
import scalafx.collections.ObservableBuffer
...
val xySeries4 = XYChart.Series[Number, Number]("Series 4",
ObservableBuffer(
XYChart.Data[Number, Number](0, 4),
XYChart.Data[Number, Number](2, 16),
XYChart.Data[Number, Number](4, 12),
XYChart.Data[Number, Number](6, 8),
XYChart.Data[Number, Number](8, 9),
XYChart.Data[Number, Number](10, 11)
)
)
val data = ObservableBuffer(xySeries4)
val chart = AreaChart(xAxis, yAxis, data)
There should be no need to import or refer to of JavaFX packages.
Original issue reported on code.google.com by jpsacha on 6 Sep 2013 at 3:53
Original issue reported on code.google.com by
jpsacha
on 6 Sep 2013 at 3:53