JpGraph application and basic installation configuration

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.