2.18 HChart class. Making various charts

The HChart class is very similar to the HPlot one. The HChart canvas allows the user to create various charts (pie chart, bar char, histogram chart, line chart, area chart). All charts are based on the jFreeChart package library[14]. This is a simple example of how to create a Pie chart:

>>> c1 = HChart("Canvas")
>>> c1.setGTitle("Chart examples")
>>> c1.visible()
>>>
>>> c1.setChartPie()
>>> c1.setName("Pie example")
>>> c1.valuePie("Hamburg",1.0)
>>> c1.valuePie("London",2.0)
>>> c1.valuePie("Paris",1.0)
>>> c1.valuePie("Bern",1.0)
>>> c1.update()
More complicated examples can be found in the example directory. When the HChart canvas is created, one can set the following charts:

>>> c1.setChartXY()    # create a XY chart
>>> c1.setChartPie()   # create a Pie chart
>>> c1.setChartPie3D() # create a Pie chart in 2D
>>> c1.setChartLine()  # create a line chart
>>> c1.setChartAre()   # create an area  chart
>>> c1.setChartBar()   # create a bar  chart
>>> c1.setChartBar3D()     # create a 2D bar  chart
>>> c1.setChartHistogram() # create a histogram  chart
Then one can add values using value+ChartName() method. For example, to add a values to Bar chart use valueBar() method. Check the HChart API for details. Finally, to display a chart, execute the c1.update() method.

One can access many jFreeChart components via several get() methods. For example, c1.getChar() will return JFreeChart class for further manipulations.