addTitle("Multiple Axes Demonstration", "arialbi.ttf", 15); $textBoxObj->setBackground(0xaaaaff); # Set the plotarea at (100, 70) and of size 400 x 180 pixels, with white background. # Turn on both horizontal and vertical grid lines with light grey color (cccccc) $plotAreaObj = $c->setPlotArea(100, 70, 400, 180, 0xffffff); $plotAreaObj->setGridColor(0xcccccc, 0xcccccc); # Add a legend box at (300, 70) (top center of the chart) with horizontal layout. Use # 8 pts Arial Bold font. Set the background and border color to Transparent. $legendBox = $c->addLegend(300, 70, false, "arialbd.ttf", 8); $legendBox->setAlignment(BottomCenter); $legendBox->setBackground(Transparent, Transparent); # Set the labels on the x axis. $c->xAxis->setLabels($labels); # Display 1 out of 3 labels on the x-axis. $c->xAxis->setLabelStep(3); # Add a title to the x-axis $c->xAxis->setTitle("Hour of Day"); # Add a title on top of the primary (left) y axis. $textBoxObj = $c->yAxis->setTitle("Power\n(Watt)"); $textBoxObj->setAlignment(TopLeft2); # Set the axis, label and title colors for the primary y axis to red (c00000) to # match the first data set $c->yAxis->setColors(0xcc0000, 0xcc0000, 0xcc0000); # Add a title on top of the secondary (right) y axis. $textBoxObj = $c->yAxis2->setTitle("Load\n(Mbps)"); $textBoxObj->setAlignment(TopRight2); # Set the axis, label and title colors for the secondary y axis to green (00800000) # to match the second data set $c->yAxis2->setColors(0x008000, 0x008000, 0x008000); # Add the third y-axis at 50 pixels to the left of the plot area $leftAxis = $c->addAxis(Left, 50); # Add a title on top of the third y axis. $textBoxObj = $leftAxis->setTitle("Temp\n(C)"); $textBoxObj->setAlignment(TopLeft2); # Set the axis, label and title colors for the third y axis to blue (0000cc) to match # the third data set $leftAxis->setColors(0x0000cc, 0x0000cc, 0x0000cc); # Add the fouth y-axis at 50 pixels to the right of the plot area $rightAxis = $c->addAxis(Right, 50); # Add a title on top of the fourth y axis. $textBoxObj = $rightAxis->setTitle("Error\n(%)"); $textBoxObj->setAlignment(TopRight2); # Set the axis, label and title colors for the fourth y axis to purple (880088) to # match the fourth data set $rightAxis->setColors(0x880088, 0x880088, 0x880088); # Add a line layer to for the first data set using red (c00000) color, with a line # width of 2 pixels $layer0 = $c->addLineLayer($data0, 0xcc0000, "Power"); $layer0->setLineWidth(2); # Add a line layer to for the second data set using green (00c0000) color, with a # line width of 2 pixels. Bind the layer to the secondary y-axis. $layer1 = $c->addLineLayer($data1, 0x008000, "Load"); $layer1->setLineWidth(2); $layer1->setUseYAxis2(); # Add a line layer to for the third data set using blue (0000cc) color, with a line # width of 2 pixels. Bind the layer to the third y-axis. $layer2 = $c->addLineLayer($data2, 0x0000cc, "Temperature"); $layer2->setLineWidth(2); $layer2->setUseYAxis($leftAxis); # Add a line layer to for the fourth data set using purple (880088) color, with a # line width of 2 pixels. Bind the layer to the fourth y-axis. $layer3 = $c->addLineLayer($data3, 0x880088, "Error Rate"); $layer3->setLineWidth(2); $layer3->setUseYAxis($rightAxis); # output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>