
This example demonstrates the basic steps in creating a discrete heat map.
A discrete heat map consists of rectangular cells in a grid of which the cell color depends on its data value.
- 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.
- Add a discrete heat map layer using XYChart.addDiscreteHeatMapLayer.
- Specify the labels on the x-axis and y-axis using Axis.setLabels. Shift the labels by 0.5 units using Axis.setOffset to align the labels with the cell center. (The default is to align the labels with the grid lines.)
- The color axis (visually represented as the color legend) is positioned vertically to the right of the plot area using DiscreteHeatMapLayer.setColorAxis.
- Generate the chart using BaseChart.makeChart.
- Pass the chart to the CChartViewer for display using CChartViewer.setChart (MFC version) or QChartViewer.setChart (Qt version), or generate the chart as an image file using BaseChart.makeChart (Command Line version).
- Generate tool tips for the chart using BaseChart.getHTMLImageMap (MFC/Qt version)