20) $colors[$i] = 0x00ff00; else $colors[$i] = 0xffff00; } $borderColor = 0x000000; #chart width, margin and rotation angle $chartWidth = 600; $margin = 10; $angle = 30; #compute cell size and adjust chart width to a multiple of cell size $cellWidth = ($chartWidth - $margin * 2) / $width; $chartWidth = $cellWidth * $width + $margin * 2; #plot the cells $c = new XYChart($chartWidth, $chartWidth); $d = $c->getDrawArea(); for ($x = 0; $x < $width; ++$x) { for ($y = 0; $y < $width; ++$y) { $leftX = $margin + $cellWidth * $x; $topY = $margin + $cellWidth * $y; $rightX = $leftX + $cellWidth; $bottomY = $topY + $cellWidth; $d->rect($leftX, $topY, $rightX, $bottomY, $borderColor, $colors[$y * $width + $x]); } } #rotate the chart $d->rotate($angle); # #clip to a circle # $mask = new DrawArea(); $mask->setSize($chartWidth, $chartWidth, Transparent); $radius = $cellWidth * $width / 2; $mask->circle($margin + $radius, $margin + $radius, $radius, $radius, 0x000000, Transparent); $mask->fill(0, 0, 0xffffff); $d = $c->makeChart3(); $d->merge($mask, 0, 0, TopLeft, 0); #output the chart using the WebChartViewer $viewer = new WebChartViewer("chart1"); #output the chart $chartQuery = $c->makeSession($viewer->getId()); #set the chart URL to the viewer $viewer->setImageUrl("getchart.php?".$chartQuery); #output Javascript chart model to the browser to support mouse events $viewer->setChartModel($c->getJsChartModel()); ?> renderHTML()?>