4 error_reporting(E_ALL);
7 // Check if we are processing the form
8 if (! array_key_exists('submit', $_POST)) {
9 echo "<p>This file is intended to be called from format_chart.php, the example-o-matic.".
10 "Please <a href=\"format_chart.php\">click here</a> to try it.</p>";
15 extract ($_GET, EXTR_OVERWRITE);
16 extract ($_POST, EXTR_OVERWRITE);
21 // data-data as a function
22 if ($which_data_type == 'function') {
27 for ($i=0; $i<$maxi; $i++) {
30 $data[$i] = array("", $x, $a*sin($x),$a*cos($x),$a*cos($x+1));
32 $which_data_type = "data-data";
34 // data-data-error as a random function
35 else if ($which_data_type == 'randfunction') {
36 srand ((double) microtime() * 1000000);
38 $label[0] = "October"; $label[5] = "Day 5"; $label[10] = "Day 10";
39 $label[15] = "Day 15"; $label[20] = "Day 20"; $label[25] = "Day 25";
41 for ($i = 0; $i <= 30; $i++) {
45 $data[] = @ array($label[$i],$i+1,$a,$b,$c);
47 $which_data_type = 'data-data-error';
49 // MBD, this is for data_sample3.php, $num_data_rows is set there
50 else if ($which_data_type == 'data-data-error') {
51 for ($i = 0; $i < $num_data_rows; $i++) {
52 eval ("\$data[\$i] = \$data_row$i; ");
55 foreach($data_row0 as $key=>$val) {
56 $data[$key] = array($data_row0[$key],$data_row1[$key],$data_row2[$key],$data_row3[$key],$data_row4[$key]);
61 ////////////////////////////////////////////////
64 include("../phplot.php");
65 $graph = new PHPlot($xsize_in, $ysize_in);
66 $graph->SetDataType($which_data_type); // Must be first thing
68 $graph->SetDataValues($data);
70 //Optional Settings (Don't need them)
72 // $graph->SetTitle("This is a\n\rmultiple line title\n\rspanning three lines.");
73 $graph->SetTitle($title);
74 $graph->SetXTitle($xlbl, $which_xtitle_pos);
75 $graph->SetYTitle($ylbl, $which_ytitle_pos);
76 $graph->SetLegend(array("A","Bee","Cee","Dee"));
78 $graph->SetFileFormat($which_fileformat);
79 $graph->SetPlotType($which_plot_type);
81 $graph->SetUseTTF($which_use_ttf);
83 $graph->SetYTickIncrement($which_yti);
84 $graph->SetXTickIncrement($which_xti);
85 $graph->SetXTickLength($which_xtl);
86 $graph->SetYTickLength($which_ytl);
87 $graph->SetXTickCrossing($which_xtc);
88 $graph->SetYTickCrossing($which_ytc);
89 $graph->SetXTickPos($which_xtick_pos);
90 $graph->SetYTickPos($which_ytick_pos);
93 $graph->SetShading($which_shading);
94 $graph->SetLineWidth($which_line_width);
95 $graph->SetErrorBarLineWidth($which_errorbar_line_width);
97 $graph->SetDrawDashedGrid($which_dashed_grid);
98 switch($which_draw_grid) {
100 $graph->SetDrawXGrid(TRUE);
101 $graph->SetDrawYGrid(FALSE);
104 $graph->SetDrawXGrid(FALSE);
105 $graph->SetDrawYGrid(TRUE);
108 $graph->SetDrawXGrid(TRUE);
109 $graph->SetDrawYGrid(TRUE);
112 $graph->SetDrawXGrid(FALSE);
113 $graph->SetDrawYGrid(FALSE);
116 $graph->SetXTickLabelPos($which_xtick_label_pos);
117 $graph->SetYTickLabelPos($which_ytick_label_pos);
118 $graph->SetXDataLabelPos($which_xdata_label_pos);
119 $graph->SetYDataLabelPos($which_ydata_label_pos);
121 // Please remember that angles other than 90 are taken as 0 when working fith fixed fonts.
122 $graph->SetXLabelAngle($which_xlabel_angle);
123 $graph->SetYLabelAngle($which_ylabel_angle);
125 //$graph->SetLineStyles(array("dashed","dashed","solid","solid"));
126 $graph->SetPointShape($which_point);
127 $graph->SetPointSize($which_point_size);
128 $graph->SetDrawBrokenLines($which_broken);
130 // Some forms in format_chart.php don't set this variable, suppress errors.
131 @ $graph->SetErrorBarShape($which_error_type);
133 $graph->SetXAxisPosition($which_xap);
134 $graph->SetYAxisPosition($which_yap);
135 $graph->SetPlotBorderType($which_btype);
138 if ($which_data_type = "text-data") {
139 $graph->SetPlotAreaWorld(0,$miny_in,count($data),$maxy_in);
146 $graph->SetPlotAreaWorld(0,100,5.5,1000);
147 $graph->SetPlotAreaWorld(0,-10,6,35);
148 $graph->SetPlotAreaPixels(150,50,600,400);
150 $graph->SetDataColors(
151 array("blue","green","yellow","red"), //Data Colors
152 array("black") //Border Colors
155 $graph->SetPlotBgColor(array(222,222,222));
156 $graph->SetBackgroundColor(array(200,222,222)); //can use rgb values or "name" values
157 $graph->SetTextColor("black");
158 $graph->SetGridColor("black");
159 $graph->SetLightGridColor(array(175,175,175));
160 $graph->SetTickColor("black");
161 $graph->SetTitleColor(array(0,0,0)); // Can be array or name
164 // $graph->SetPrintImage(false);
166 // xdebug_dump_function_profile(XDEBUG_PROFILER_FS_SUM);