1
0
Fork 0
php-coding/12.test4.php

33 lines
1.1 KiB
PHP

<?php
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
$datay = array(8320, 9360, 14956, 17028, 13060, 15376, 25428, 16216, 28548, 18632, 22724, 28460);
$graph = new Graph(600, 300,'auto');
$graph->img->SetMargin(50,40,30,40);
$graph->img->SetAntiAliasing();
$graph->SetScale('textlin');
$graph->SetShadow();
$graph->title->Set('图书销售折线图');
$graph->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->SetMarginColor('lightblue');
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->yaxis->SetPos('min');
$graph->yaxis->hideZeroLabel();
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
$a = array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月', '11月','12月');
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_SIMSUN);
$graph->yscale->SetGrace(20);
$linePlot = new LinePlot($datay);
$linePlot->mark->SetType(MARK_FILLEDCIRCLE);
$linePlot->mark->SetFillColor('red');
$linePlot->mark->SetWidth(4);
$linePlot->SetColor('blue');
$linePlot->SetCenter();
$graph->Add($linePlot);
$graph->Stroke();