JpGraph is actually a chart class library, which makes it very convenient for developers to plot. just a few lines of code can be used to draw a very dazzling chart. Official website: http://jpgraph.net/download/jpgraphconfiguration
JpGraph is actually a chart class library, which makes it very convenient for developers to plot. just a few lines of code can be used to draw a very dazzling chart.
Official: http://jpgraph.net/download/
JpGraph configuration is very simple. First, it requires the support of the gd Library. by default, the php base package does not support the gd Library. open the php. ini file and open the php_gd2 extension!
Note that the php file path in examples is incorrect for officially downloaded files. you need to move the file. I did this: remove the Examples file from the outer layer.
Then, change the src file name to jpgraph, and then move the jpgraph file to Examples. in this way, you can view many Examples in Examples.
You only need to change some parameters to find the desired file in Examples.
The following uses a bar chart as an example:
SetScale ("textlin"); $ graph-> img-> SetMargin (,); // Set the icon margin $ graph-> title-> SetFont (FF_SIMSUN, FS_BOLD, 24); // Set the font, type, size $ graph-> title-> Set ('www .phpddt.com '); // the title of the image header $ graph-> title-> SetColor ('red'); // The title font color $ graph-> xaxis-> SetFont (FF_FONT1 ); // set the English font $ graph-> yaxis-> SetFont (FF_FONT1); $ bplot = new BarPlot ($ datay); $ bplot-> SetWidth (0.4 ); // the width of the column $ bplot-> SetFillGradient ("navy", "lightsteelblue", GRAD_MIDVER); $ Bplot-> SetColor ("navy"); $ graph-> Add ($ bplot); $ graph-> Stroke ();?>
Note the font settings for special tables. for example, if it is set to FF_FONT1, Chinese characters cannot be correctly displayed.
How to set the Chinese font:
$ Graph-> title-> Set ("www.phpddt.com ");
$ Graph-> title-> SetFont (FF_FONT1, FS_BOLD); // English font
$ Graph-> title-> SetFont (FF_SIMSUN, FS_BOLD); // set the font, type, and size.
$ Graph-> title-> SetColor ('red'); // you can specify the font color.
$ Graph-> title-> SetFont (FF_SIMSUN, FS_BOLD); // set the Chinese font of the title
$ Graph-> legend-> SetFont (FF_SIMSUN, FS_BOLD); // you can specify the font of a line.
$ Graph-> yaxis-> title-> SetFont (FF_SIMSUN, FS_BOLD); // Set the y axis line to indicate the font.
$ Graph-> xaxis-> title-> SetFont (FF_SIMSUN, FS_BOLD); // Set the x axis line to indicate the font.