setRoundedFrame(); # Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white (ffffff) # background. Set horizontal and vertical grid lines to grey (cccccc). $c->setPlotArea(55, 58, 520, 195, 0xffffff, -1, -1, 0xcccccc, 0xcccccc); # Add a legend box at (55, 30) (top of the chart) with horizontal layout. Use 10 pts # Arial Bold Italic font. Set the background and border color to Transparent. $legendObj = $c->addLegend(55, 30, false, "arialbi.ttf", 10); $legendObj->setBackground(Transparent); # Add a title box to the chart using 15 pts Times Bold Italic font. The text is white # (ffffff) on a purple (400040) background, with soft lighting effect from the right # side. $textBoxObj = $c->addTitle("Multi-Symbol Line Chart Demo", "timesbi.ttf", 15, 0xffffff); $textBoxObj->setBackground(0x400040, -1, softLighting(Right)); # Set the y axis label format to display a percentage sign $c->yAxis->setLabelFormat("{value}%"); # Set axis titles to use 9pt Arial Bold Italic font $c->yAxis->setTitle("Axis Title Placeholder", "arialbi.ttf", 9); $c->xAxis->setTitle("Axis Title Placeholder", "arialbi.ttf", 9); # Set axis labels to use Arial Bold font $c->yAxis->setLabelStyle("arialbd.ttf"); $c->xAxis->setLabelStyle("arialbd.ttf"); # We add the different data symbols using scatter layers. The scatter layers are # added before the line layer to make sure the data symbols stay on top of the line # layer. # We select the points with pointType = 0 (the non-selected points will be set to # NoValue), and use yellow (ffff00) 15 pixels high 5 pointed star shape symbols for # the points. (This example uses both x and y coordinates. For charts that have no x # explicitly coordinates, use an empty array as dataX.) $tmpArrayMath1 = new ArrayMath($dataY); $tmpArrayMath1->selectEQZ($pointType, NoValue); $c->addScatterLayer($dataX, $tmpArrayMath1->result(), "Point Type 0", StarShape(5), 15, 0xffff00); # Similar to above, we select the points with pointType - 1 = 0 and use green (ff00) # 13 pixels high six-sided polygon as symbols. $tmpArrayMath2 = new ArrayMath($pointType); $tmpArrayMath2->sub(1); $tmpArrayMath1 = new ArrayMath($dataY); $tmpArrayMath1->selectEQZ($tmpArrayMath2->result(), NoValue); $c->addScatterLayer($dataX, $tmpArrayMath1->result(), "Point Type 1", PolygonShape(6 ), 13, 0x00ff00); # Similar to above, we select the points with pointType - 2 = 0 and use red (ff0000) # 13 pixels high X shape as symbols. $tmpArrayMath2 = new ArrayMath($pointType); $tmpArrayMath2->sub(2); $tmpArrayMath1 = new ArrayMath($dataY); $tmpArrayMath1->selectEQZ($tmpArrayMath2->result(), NoValue); $c->addScatterLayer($dataX, $tmpArrayMath1->result(), "Point Type 2", Cross2Shape(), 13, 0xff0000); # Finally, add a blue (0000ff) line layer with line width of 2 pixels $layer = $c->addLineLayer($dataY, 0x0000ff); $layer->setXData($dataX); $layer->setLineWidth(2); # output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>