This example demonstrates the basic steps in creating area charts.
- Create an XYChart object using XYChart.XYChart.
- Specify the plot area of the chart using XYChart.setPlotArea. The plot area is the rectangle bounded by the x and y axes. You should leave some margin on the outside of the plot area for axis labels, chart titles, etc.
- Specify the labels on the x-axis using Axis.setLabels.
- An area chart may contain many points and therefore many x-axis labels. In this example, Axis.setLabelStep is used to specify showing only a subset of the labels on the x-axis to avoid over-crowding.
- Add an area layer and specify the data for the area using XYChart.addAreaLayer.
- Assign the chart to the WebChartViewer using WebChartViewer.setChart, and insert it to the web page using WebChartViewer.renderHTML.
- Generate tool tips for the chart using BaseChart.getHTMLImageMap.