1# Drawing a line chart 2 3[Reference](http://wiki.pchart.net/doc.chart.drawlinechart.html) 4 5```php 6require '/path/to/your/vendor/autoload.php'; 7 8use CpChart\Data; 9use CpChart\Image; 10 11/* Build a dataset */ 12$data = new Data(); 13$data->addPoints([-4, VOID, VOID, 12, 8, 3], "Probe 1"); 14$data->addPoints([3, 12, 15, 8, 5, -5], "Probe 2"); 15$data->addPoints([2, 7, 5, 18, 19, 22], "Probe 3"); 16$data->setSerieTicks("Probe 2", 4); 17$data->setSerieWeight("Probe 3", 2); 18$data->setAxisName(0, "Temperatures"); 19$data->addPoints(["Jan", "Feb", "Mar", "Apr", "May", "Jun"], "Labels"); 20$data->setSerieDescription("Labels", "Months"); 21$data->setAbscissa("Labels"); 22 23/* Create the 1st chart */ 24$image = new Image(700, 230, $data); 25$image->setGraphArea(60, 60, 450, 190); 26$image->drawFilledRectangle(60, 60, 450, 190, [ 27 "R" => 255, 28 "G" => 255, 29 "B" => 255, 30 "Surrounding" => -200, 31 "Alpha" => 10 32]); 33$image->drawScale(["DrawSubTicks" => true]); 34$image->setShadow(true, ["X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10]); 35$image->setFontProperties(["FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6]); 36$image->drawLineChart(["DisplayValues" => true, "DisplayColor" => DISPLAY_AUTO]); 37$image->setShadow(false); 38 39/* Create the 2nd chart */ 40$image->setGraphArea(500, 60, 670, 190); 41$image->drawFilledRectangle(500, 60, 670, 190, ["R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10]); 42$image->drawScale(["Pos" => SCALE_POS_TOPBOTTOM, "DrawSubTicks" => true]); 43$image->setShadow(true, ["X" => -1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10]); 44$image->drawLineChart(); 45$image->setShadow(false); 46 47/* Write the legend */ 48$image->drawLegend(510, 205, ["Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL]); 49$image->autoOutput("example.drawLineChart.png"); 50``` 51