#1441 chart pod

peter Sun 6 Mar 2011

Hi,

I've created an swtchart library as a Fantom pod: downloadable tarball. The readme inside contains instructions for installing - be warned, fwt needs modifying, for access privileges.

Nearly all the examples from the swtchart website are working, and included in the download. There is little or no error handling yet. Comments or feedback would be appreciated.

As a taster, the following example creates a bar chart with two stacked series:

using fwt
using gfx
using chart

class Example6
{
  public static Void main ()
  {
    // define two series of data points to display
    series1 := BarSeries
    {
      label = "bar series 1"
      points = [2.0f, 3.2f, 2.4f, 5.7f, 1.9f]
      enableStack = true
    }
    series2 := BarSeries
    {
      label = "bar series 2"
      points = [4.0f, 2.2f, 3.4f, 1.7f, 0.9f]
      color = Color.green
      enableStack = true
    }
    // define a window to display the chart in
    Window
    {
      title = "Example Chart"
      size = Size(450, 350)
      // create the chart
      Chart
      {
        title.text = "Stacked Chart Example"
        xAxis.title.text = "Month"
        xAxis.categories = ["Mar", "Apr", "May", "Jun", "Jul"]
        yAxis.title.text = "Amplitude"
        data = [series1, series2]
      },
    }.open
  }
}

andy Wed 9 Mar 2011

Looks cool Peter.

peter Wed 9 Mar 2011

Thanks for looking Andy. I've cleaned up the wrapper code inside, trapped some likely errors, and finished adding all the features I care about. Revised version on the same link.

Login or Signup to reply.