Gabriel95 / scalafx

Automatically exported from code.google.com/p/scalafx
Other
0 stars 0 forks source link

It should be possible to create chart data without using JavaFX type parameters #79

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
See also Issue 72

Original comment by jpsacha on 6 Sep 2013 at 3:54

GoogleCodeExporter commented 8 years ago

Original comment by jpsacha on 6 Sep 2013 at 3:55

GoogleCodeExporter commented 8 years ago

Original comment by jpsacha on 8 Sep 2013 at 4:07