The area chart is actually a line chart, but with added ability to communicate the scope of its coverage with a solid fill color under its line. It is basically a colored line chart with two or more line plots.
Create a Chart
and ChartModel
object and then an AreaChart
object for each area you want to plot, each having an appropriate label/legend and color with its setText()
and setColour()
methods respectively. The ChartModel
can then be set on the chart
object after giving the model a XAxis
and YAxis
object.
Once the data is ready, we build a list of Label
objects for XAxis
and then a list of Number
values for each area in the chart. The values built are then given to their respective AreaChart
object with areaChart.addValues()
and then they are in turn added to ChartModel
using model.addChartConfig()
for each.
@Override public void onModuleLoad() { // create the Chart object Chart chart = new Chart("resources/chart/open-flash-chart.swf"); // create...