discreteheatmap.php
Back to Chart Graphics
get2DSeries(count($xLabels), count($yLabels), 0, 100);
# Create an XYChart object of size 520 x 470 pixels.
$c = new XYChart(520, 470);
# Set the plotarea at (50, 30) and of size 400 x 400 pixels.
$p = $c->setPlotArea(50, 30, 400, 400);
# Create a discrete heat map with 10 x 10 cells
$layer = $c->addDiscreteHeatMapLayer($zData, count($xLabels));
# Set the x-axis labels. Use 8pt Arial Bold font. Set axis stem to transparent, so only the labels
# are visible. Set 0.5 offset to position the labels in between the grid lines.
$c->xAxis->setLabels($xLabels);
$c->xAxis->setLabelStyle("Arial Bold", 8);
$c->xAxis->setColors(Transparent, TextColor);
$c->xAxis->setLabelOffset(0.5);
$c->xAxis->setTitle("X Axis Title Placeholder", "Arial Bold", 12);
# Set the y-axis labels. Use 8pt Arial Bold font. Set axis stem to transparent, so only the labels
# are visible. Set 0.5 offset to position the labels in between the grid lines.
$c->yAxis->setLabels($yLabels);
$c->yAxis->setLabelStyle("Arial Bold", 8);
$c->yAxis->setColors(Transparent, TextColor);
$c->yAxis->setLabelOffset(0.5);
$c->yAxis->setTitle("Y Axis Title Placeholder", "Arial Bold", 12);
# Position the color axis 20 pixels to the right of the plot area and of the same height as the plot
# area. Put the labels on the right side of the color axis. Use 8pt Arial Bold font for the labels.
$cAxis = $layer->setColorAxis($p->getRightX() + 20, $p->getTopY(), TopLeft, $p->getHeight(), Right);
$cAxis->setLabelStyle("Arial Bold", 8);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='<*cdml*>({xLabel}, {yLabel}) = {z|2}'"));
?>
Discrete Heat Map
Discrete Heat Map
renderHTML(); ?>