PHP jpgraph Introduction Configuration and Application

Source: Internet
Author: User

What is PHP jpgraph?

A class library dedicated to charting. It makes the drawing a very simple thing. Generate a chart from a non-artist person. Two-dimensional code algorithm.

Download to the official website.

The Docportal Help manual src contains the main code.

There are methods for Contour_dev development.

The case cannot be used directly, and it needs to be example adjusted.

Include_once (' src/jpgraph.php ');

Include_once (' src/jpgraph_line.php ');

Note: The examples folder contains more than 400 files and cannot be used directly when used. It must be pointed to the correct path. Cut SRC into the example folder. At the same time, we modify our src to jpgraph.

=============================================================================

Jpgraph Chinese font and background settings in php100:85:php

1.JPGraph Chinese font settings: You only need to modify the default configuration. A Chinese font library needs to be installed, and the font must be a font that can be recognized in Chinese, such as boldface. You can do it. $graph->title->set ("www.php100.com"); $graph->title->setfont (ff_font1,fs_bold);//English font $graph->title->setfont (ff_simsun,fs_bold,24);// Set font type, size, blackbody $graph->title->setcolor (' Red ');

$graph->title->setfont (Ff_simsun,fs_bold); Set Title Chinese font

$graph->legend->setfont (Ff_simsun,fs_bold); Set Chinese font for lines

$graph->yaxis->setfont (Ff_simsun,fs_bold); Set y-axis bar Chinese font

$graph->xaxis->setfont (Ff_simsun,fs_bold); Set X axis bar Chinese font *****************************************************************************

2.JPGraph background and background image settings $graph->setcolor (' Red '); $graph->setbackgroungimage ("Picture Address", 1);

It also includes the position of the layer $graph->img->setmargin (0,0,0,0);//The vacant four-corner margin, all 0 means the position is not empty.

*****************************************************************************

3.jpgraph3d settings. $graph->set3dperspective (skew3d_left,700,600,true);

You can also set whether to skew from top to bottom, or from left to right, and the last parameter to indicate if there is a border, the two parameters in the middle represent the angle to the horizon//skew3d_left//skew3d_right//skew3d_up//skew3d_down

Example demonstrates Example28.

Many people use jpgraph will appear garbled problem, but there are many and no effect on the online solution, after repeated testing and on-line to see other people's experience, summed up in the 2.3 version of the final more perfect solution 1, the SIMSUN.TTC font copied to the server/usr/x11r6/lib/   X11/fonts/truetype, of course, this directory can be customized 2, do not need to change $aff = = = Ff_simsun or $aff = = Ff_chinese, directly with the following code can $title = "jpgraph Chinese test";   $title = Iconv ("UTF-8", "gb2312", $title);   $graph->title->set ($title); Can perfectly solve the Chinese problem 3, there is a problem, is the top right of the Chinese display problem, is the Setlegend function, the solution is as follows open jpgraph.php file, find private $font _family=ff_font1, $font _   Style=fs_normal, $font _size=12; With private $font _family=ff_simsun, $font _style=fs_normal, $font _size=8;

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.