Phplot generates Image class details. I personally use phplot, which is an automatic generation class written using the php image function. First of all, I only know about it. detailed description of generating image classes in the original php Tutorial lot
I personally use phplot, which is an automatic generation class written using php image functions. First of all, I only know about it. in some previous versions, it seems that you still need to configure and support multiple aspects, but now you are using the php5 series. you only need to understand some commonly used functions, just like learning a software, we only need to know how to use it. if you are interested, you can study it in depth, but for most of our friends, you only need to use it. after all, it is not commonly used. it is used only when php is used for plotting. So we only need to know how to use it.
He must know the role of his function. just like we are learning discuz, we need to know how to use him!
Phplot is http://www.sourceforge.net/projects/phplot/the latest version is phplot5.0.
Common functions include configuration functions, display functions, and color functions.
1. configuration function: configure the type of phplot and the way in which the image is displayed.
A. SetDataType ($ which_dt): sets the data type in use, which can be of multiple types.
(1) text-date: the data is ranked along the x-column, equi-spacing. Each array element represents a point at a certain position on the x axis. it is also an array. The first element represents the x coordinate, followed
All elements represent y coordinates.
(2) data-data: similar to the above type, the difference is that the second element of the numerical array represents the x coordinate, and the latter represents the y coordinate, while the first element is just a label.
(3) data-error: similar to data-data, the difference is that there are two elements behind the value array that represent error_plus and error_minus, such
(Data_labl, x_position, y_position, error_plus, error_minus ).
B. SetDataValues ($ which_dv): assign an array $ which_dv to a variable $ this-> data_values of the class. this function is called before plotting.
C. SetPlotType ($ which_pt): Set the chart type, such as bars, lines, linepoints, area, points, and pie.
D. SetErrorBarLineWidth ($ wd): set the width of the error bar.
E. SetFileFormat ($ which_file_format): set the format of the output image file, such as GIF, PNG, and JPEG. It also depends on whether your GD library supports this function.
F. SetUseTTF ($ which_ttf): Set whether to use TTF. If php compilation supports TTF, use SetUseTTF ("1"); otherwise, set it to 0.
2. display function: displays the image to set the line type, width, and other parameters used by the output chart. you can also set the distance between the Axis scales and the chart size.
A. SetErrorBarShape ($ which_ebs): Set the precision line type, which can be line or tee. if it is tee, set the half degree of the T-line to SetErrorBarSize.
B. SetErrprBarSize ($ which_ebs): set the width of the precision line.
C. SetHorizTickIncreament ($ which_ti): sets the spacing of the scale displayed on the x axis.
D. SetHorizTicks ($ whick_nt): sets the number of scales displayed on the x axis. (Cannot match SetHorizTickIncreament)
E. SetNumVertTicks ($ which_nt): sets the number of scales displayed on the x axis. (Cannot match SetVertTickIncreament)
F. SetPlotArearpixels ($ x1, $ y1, $ x2, $ y2): Set the chart size.
G. SetPointShape ($ which_pt): Set the fixed point shape: rect, circle, diamond, triangle, dot, line, halfline.
H. SetPointSize ($ whick_ps tutorial): set the width of the vertex.
I. SetPrecisionX ($ whick_prec): sets the precision of the x axis. $ Whick_prec indicates the number of digits after the decimal point.
J. SetPrecisiony ($ whick_prec) sets the y axis precision. $ Whick_prec indicates the number of digits after the decimal point.
K. SetSjading ($ whick_s): Set the shadow width.
L. SetTickLength ($ which_tl): set the length of the marking line on the coordinate axis, in pixel.
M. SetTile ($ title): Set the title of the chart.
N. SetVertTickIncreament ($ whick_ti): and SetHorizTicks ($ whick_nt) are two functions used to set the vertical and horizontal intervals of the marking lines on the axis.
O. SetXDataLabelMaxlength ($ which_xdlm): sets the maximum length of the label on the x axis.
P. SetXGridLabelType ($ which_xtf): Set the tag type of the x axis, which can be time, title, data, none, or default.
(1). time: set by the strftime () function.
(2). title: text type.
(3). data: format a number using the number_format () function.
(4). none: no tags.
(5). default: output in input format.
3. color function: color function is used to set the display color of each element in the chart, including the background color of the image, the color of the delete grid line, and the title color!
A. SetBackgroundColor ($ which_color): sets the background color of the entire image.
B. SetGridColor ($ which_color): set the color of the delete grid line.
C. SetLegend ($ which_legend): the parameter is a text array whose content is displayed in a graphic column box.
D. SetLegendPixels ($ which_x, $ which_y, $ which_type): sets the coordinates of the points in the lower-left corner of the graph box. the last parameter will be available later.
E. SetLightGridColor ($ which_color): There are two colors for deleting a cut line. this function sets one of them.
F. SetLineWidth ($ which_lt): specifies the width of the line used in the chart, which also affects the width of the line.
G. SetLineStyles ($ which_sls): set the line type, which can be solid or dotted.
H. SetPlotBgColor ($ which_color): set the color of the region set using the SetPlotAreaPixels () function.
I. SetTextColor ($ which_color): sets the text color. the default value is black.
J. SetTickColor ($ which_color): set the color of the engraved line on the axis.
K. SetTitleColor ($ which_color): Set the title color.
View instances
The code for generating the above image is as follows:
# PHPlot Demo
#2008-01-09 ljb
# For more information see http://sourceforge.net/projects/phplot/
# Load the PHPlot class library:
Require_once 'phplot. php ';
# Define the data array: Label, the 3 data sets.
# Year, Features, Bugs, Happy Users:
$ Data = array (
Array ('20140901', 60, 35, 20 ),
Array ('20140901', 65, 30, 30 ),
Array ('20140901', 70, 25, 40 ),
Array ('20140901', 72, 20, 60 ),
Array ('20140901', 75, 15, 70 ),
Array ('20140901', 77, 10, 80 ),
Array ('20140901', 80, 5, 90 ),
);
# Create a PHPlot object which will make a 600x400 pixel image:
$ P = new PHPlot (600,400 );
# Use TrueType fonts:
$ P-> SetDefaultTTFont ('./arial. ttf ');
# Set the main plot title:
$ P-> SetTitle ('phplot Customer Satisfaction (estimated )');
# Select the data array representation and store the data:
$ P-> SetDataType ('text-data ');
$ P-> SetDataValues ($ data );
# Select the plot type-bar chart:
$ P-> SetPlotType ('bars ');
# Define the data range. PHPlot can do this automatically, but not as well.
$ P-> SetPlotAreaWorld (0, 0, 7,100 );
# Select an overall image background color and another color under the plot:
$ P-> SetBackgroundColor ('# ffffcc ');
$ P-> SetDrawPlotAreaBackground (True );
$ P-> SetPlotBgColor ('# ffff ');
# Draw lines on all 4 sides of the plot:
$ P-> SetPlotBorderType ('full ');
# Set a 3 line legend, and position it in the upper left corner:
$ P-> SetLegend (array ('features ', 'buckets', 'Happy users '));
$ P-> SetLegendWorld (0.1, 95 );
# Turn data labels on, and all ticks and tick labels off:
$ P-> SetXDataLabelPos ('plotlow ');
$ P-> SetXTickPos ('none ');
$ P-> SetXTickLabelPos ('none ');
$ P-> SetYTickPos ('none ');
$ P-> SetYTickLabelPos ('none ');
# Generate and output the graph now:
$ P-> DrawGraph ();
How are you doing .. Favorite friends can go to http://phplot.sourceforge.net/official station download
I personally use phplot, which is an automatic generation class written using php image functions. first, I declare that I only know about it. in the original...