setPlotArea(50, 25, 500, 250); $plotAreaObj->setGridColor(0xc0c0c0, 0xc0c0c0); # Add a title to the chart $c->addTitle("Universal Stock Index on Jan 2001"); # Add a custom text at (50, 25) (the upper left corner of the plotarea). Use 12 pts # Arial Bold/blue (4040c0) as the font. $c->addText(50, 25, "(c) Global XYZ ABC Company", "arialbd.ttf", 12, 0x4040c0); # Add a title to the x axis $c->xAxis->setTitle("Jan 2001"); # Set the labels on the x axis. Rotate the labels by 45 degrees. $labelsObj = $c->xAxis->setLabels($labels); $labelsObj->setFontAngle(45); # Add a title to the y axis $c->yAxis->setTitle("Universal Stock Index"); # Draw the y axis on the right hand side of the plot area $c->setYAxisOnRight(true); # Reserve 10% margin at the top and bottom of the plot area during auto-scaling. This # is to leave space for the high and low data labels. $c->yAxis->setAutoScale(0.1, 0.1); # Add a CandleStick layer to the chart using green (00ff00) for up candles and red # (ff0000) for down candles $layer = $c->addCandleStickLayer($highData, $lowData, $openData, $closeData, 0x00ff00, 0xff0000); # Set the line width to 2 pixels $layer->setLineWidth(2); # output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>