PHP Report jpgraph example Code _php tutorial

Source: Internet
Author: User
Novice first know Jpgraph certainly will encounter a variety of problems, such as garbled what, this case is jpgraph3.0.7 production, also through my many experiments, solve garbled problem
Copy CodeThe code is as follows:
$datay =array (); Ordinate data
$datax =array (); Horizontal axis Data
foreach ($usernums as $key = = $value) {
$datay [] = $value;
$datax [] = $userids [$key];
}
Require_once (' jpgraph-3.0.7/jpgraph/jpgraph.php ');
Require_once (' jpgraph-3.0.7/jpgraph/jpgraph_bar.php ');
Create the graph. These calls is always required
$graph = new Graph (800,600); High image width
$graph->setscale ("Textlin");
$graph->xaxis->setticklabels ($datax);
$graph->xaxis->setfont (ff_verdana,fs_normal,10);
$graph->xaxis->setlabelangle (30);
$graph->yaxis->scale->setgrace (20);
$graph->xaxis->scale->setgrace (20);
Add a drop Shadow
$graph->setshadow ();
Adjust the margin a bit to make more hostel for titles
$graph->img->setmargin (40,30,20,40);
Create a bar pot
$bplot = new Barplot ($datay);
Adjust Fill Color
$bplot->setfillcolor (' orange ');
$bplot->value->show ();
$bplot->value->setfont (ff_arial,fs_bold,10);
$bplot->value->setangle (45);
$bplot->value->setformat ('%d ');
$graph->add ($bplot);
Setup the titles
$graph->title->set (Iconv ("Utf-8″," Gb2312″, "User consumption statement diagram"));
$graph->xaxis->title->set (Iconv ("Utf-8″," Gb2312″, "user name"));
$graph->yaxis->title->set (Iconv ("Utf-8″," Gb2312″, "Number of User Orders"));
$graph->xaxis->title->setfont (Ff_simsun,fs_bold);
$graph->yaxis->title->setfont (Ff_simsun,fs_bold);
$graph->title->setfont (Ff_simsun,fs_bold);
Display the graph
$graph->stroke ();
?>

:

Official website http://jpgraph.net/download/script home download address http://www.jb51.net/codes/38194.html

http://www.bkjia.com/PHPjc/324129.html www.bkjia.com true http://www.bkjia.com/PHPjc/324129.html techarticle Novice First Knowledge jpgraph certainly will encounter a variety of problems, such as garbled what, this case is jpgraph3.0.7 production, also through my many experiments, solve garbled problem copy code code such as ...

  • 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.