// -------------- Line chart
Function imageLine (){
$ Item_array = Split ($ this-> ARRAYSPLIT, $ this-> ITEMARRAY );
$ Num = Count ($ item_array );
$ Item_max = 0;
For ($ I = 0; $ I <$ num; $ I ++ ){
$ Item_max = Max ($ item_max, $ item_array [$ I]);
}
// $ Xx = $ this-> BORDER;
// Draw a column chart
For ($ I = 0; $ I <$ num; $ I ++ ){
Srand (double) microtime () * 1000000 );
If ($ this-> R! = 255 & $ this-> G! = 255 & $ this-> B! = 255 ){
$ R = Rand ($ this-> R, 200 );
$ G = Rand ($ this-> G, 200 );
$ B = Rand ($ this-> B, 200 );
} Else {
$ R = revert (50,200 );
$ G = revert (50,200 );
$ B = revert (50,200 );
}
$ Color = ImageColorAllocate ($ this-> IMAGE, $ R, $ G, $ B );
// Column height
$ Height_now = ($ this-> Y-$ this-> BORDER)-($ this-> Y-$ this-> BORDER * 2) * ($ item_array [$ I]/$ item_max );
If ($ I! = "0 "){
ImageLine ($ this-> IMAGE, $ xx, $ height_next, $ xx + $ this-> BORDER, $ height_now, $ color );
}
ImageString ($ this-> IMAGE, $ this-> FONTSIZE, $ xx + $ this-> BORDER, $ height_now-$ this-> BORDER/2, $ item_array [$ I], $ this-> FONTCOLOR );
$ Height_next = $ height_now;
// Used for interval
$ Xx = $ xx + $ this-> BORDER;
}
}
// -------------- Print the graphic http://knowsky.com
Function printAll (){
ImageGIF ($ this-> IMAGE );
ImageDestroy ($ this-> IMAGE );
}
// -------------- Debug
Function debug (){
Echo "X:". $ this-> X ."
Y: ". $ this-> Y;
Echo"
BORDER: ". $ this-> BORDER;
$ Item_array = split ($ this-> ARRAYSPLIT, $ this-> ITEMARRAY );
$ Num = Count ($ item_array );
Echo"
Number of values: ". $ num ."
Value :";
For ($ I = 0; $ I <$ num; $ I ++ ){
Echo"
". $ Item_array [$ I];
}
}
}
$ Report = new ImageReport;
$ Report-> setImage (600,300,255,255,255, 1); // parameter (length, width, background color R, G, B, whether transparent 1 or 0)
$ Temparray = "50, 25, 100,250,180,200,150,220,200,150, 50, 25, 100,250,180,200,150,220,200,150"; // value, separated by a specified symbol
$ Report-> setItem (',', $ temparray, 3,20); // parameter (separates the specified symbol of the value, numerical variable, and style 1 is a line chart with the vertical column as the horizontal column, distance)
$ Report-> setFont (1); // font size: 1-10
$ Report-> PrintReport ();
// $ Report-> debug (); // call for debugging
?>
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