example-12.fan 914 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using fwt
  2. using gfx
  3. using swtChartWrapper
  4. class Example12
  5. {
  6. private static Float[] createSeries ()
  7. {
  8. size := 1048576 // Fantom runs very slow with such a large value
  9. series := List.make(Float#, size)
  10. for (Int i := 0; i < size; i++)
  11. {
  12. series.add (((Float.pi * 33.0f * i).sin / size) + ((Float.pi * 15.0f * i).sin / size))
  13. }
  14. return series
  15. }
  16. public static Void main ()
  17. {
  18. // define the series of data points to display
  19. series := LineSeries
  20. {
  21. label = "line series"
  22. points = createSeries ()
  23. symbolType = PlotSymbolType.none
  24. }
  25. // define a window to display the chart in
  26. Window
  27. {
  28. title = "Example Chart"
  29. size = Size(450, 350)
  30. Chart
  31. {
  32. title.text = "Large Dataset Example"
  33. xAxis.title.text = "Data Points"
  34. yAxis.title.text = "Amplitude"
  35. data = [series]
  36. },
  37. }.open
  38. }
  39. }