|
From: Ariel G. <ag...@us...> - 2001-12-01 00:52:13
|
Update of /cvsroot/vagrant/vagrant-2.5
In directory usw-pr-cvs1:/tmp/cvs-serv23652
Modified Files:
Graph.class ImagePrimitives.class VAGRANT.class test.php
Log Message:
Added scatter graphs
Index: Graph.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant-2.5/Graph.class,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Graph.class 2001/11/30 19:18:32 1.5
--- Graph.class 2001/12/01 00:52:09 1.6
***************
*** 324,328 ****
* @author Ariel Garza (ag...@va...)
* @param string $dataset_id The id of the dataset you are graphing
! * @param string $type The type of graph you are drawing
* @param string $color What color do you want to draw the graph
* @param array $options is an array containing graph options. Valid options are:
--- 324,328 ----
* @author Ariel Garza (ag...@va...)
* @param string $dataset_id The id of the dataset you are graphing
! * @param string $type The type of graph you are drawing (bar, filled, line, dashed, scatter)
* @param string $color What color do you want to draw the graph
* @param array $options is an array containing graph options. Valid options are:
***************
*** 373,379 ****
$this->GetImageLocation($coords['x'], min($coords['y'], $this->GetValue($max_axis)), $x_pos, $y_pos, $axis2);
$this->image_object->DrawGradientRectangle($x_pos - $this->GetValue('vert_bar_width') / 2, $y_pos, $this->GetValue('vert_bar_width'), $y_min_pos - $y_pos, $this->GetColor($color, $options['alpha']));
} // if we are drawing a bar graph
else if (!$last_point) {
- $this->GetImageLocation($coords['x'], $coords['y'], $last_x_pos, $last_y_pos, $axis2);
$last_point = $coords;
continue;
--- 373,388 ----
$this->GetImageLocation($coords['x'], min($coords['y'], $this->GetValue($max_axis)), $x_pos, $y_pos, $axis2);
$this->image_object->DrawGradientRectangle($x_pos - $this->GetValue('vert_bar_width') / 2, $y_pos, $this->GetValue('vert_bar_width'), $y_min_pos - $y_pos, $this->GetColor($color, $options['alpha']));
+
+ continue;
} // if we are drawing a bar graph
+ else if ($type == "scatter") {
+ if ($this->IsDrawable($coords, $axis2)) {
+ $this->GetImageLocation($coords['x'], $coords['y'], $x_pos, $y_pos, $axis2);
+ $this->image_object->DrawBrush($x_pos, $y_pos, $options['shape'], $this->GetColor($color, $options['alpha']));
+ } // if this is on the graph
+
+ continue;
+ } // else if this is a scatter point
else if (!$last_point) {
$last_point = $coords;
continue;
***************
*** 462,466 ****
} // if this is a filled graph
! if (($type != "bar") && ($type != "filled") && ($line_coords = $this->GetGraphicalCoords($last_point, $coords, $axis2))) {
$this->GetImageLocation($line_coords[0]['x'], $line_coords[0]['y'], $x_start_pos, $y_start_pos, $axis2);
$this->GetImageLocation($line_coords[1]['x'], $line_coords[1]['y'], $x_end_pos, $y_end_pos, $axis2);
--- 471,475 ----
} // if this is a filled graph
! if ($line_coords = $this->GetGraphicalCoords($last_point, $coords, $axis2)) {
$this->GetImageLocation($line_coords[0]['x'], $line_coords[0]['y'], $x_start_pos, $y_start_pos, $axis2);
$this->GetImageLocation($line_coords[1]['x'], $line_coords[1]['y'], $x_end_pos, $y_end_pos, $axis2);
Index: ImagePrimitives.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant-2.5/ImagePrimitives.class,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ImagePrimitives.class 2001/11/30 19:24:47 1.4
--- ImagePrimitives.class 2001/12/01 00:52:09 1.5
***************
*** 3,7 ****
/**
* Contains ImagePrimitives class.
! * @version $Id$
* @author Ariel Garza (ag...@va...)
*/
--- 3,7 ----
/**
* Contains ImagePrimitives class.
! * @version $Id$
* @author Ariel Garza (ag...@va...)
*/
***************
*** 1252,1255 ****
--- 1252,1259 ----
$this->GetValue('legend_sample_width'), $this->GetValue('legend_sample_height'),
$this->GetColor($this->GetValue('legend_border_color')));
+ break;
+
+ case("scatter"):
+ $this->image_object->DrawBrush($x_pos + $this->GetValue('legend_sample_width') / 2, $y_pos + $y_pad, $legend_map[$dataset_id]['options']['shape'], $legend_color);
break;
Index: VAGRANT.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant-2.5/VAGRANT.class,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** VAGRANT.class 2001/11/30 19:25:25 1.3
--- VAGRANT.class 2001/12/01 00:52:09 1.4
***************
*** 4,7 ****
--- 4,8 ----
* VAGRANT 2.5
*
+ * @version $Id$
* @author Ariel Garza (ag...@va...)
*/
***************
*** 356,359 ****
--- 357,361 ----
* legend_title (string) -> The title to be displayed in the legend
* legend_color (string) -> The color for the title to be displayed in the legend
+ * shape (string) -> If type is "scatter", this is the shape to use (circle, triangle, rect) default is rect
*/
function SetGraphType($graph_id, $dataset_id, $type, $color, $options = array()) {
Index: test.php
===================================================================
RCS file: /cvsroot/vagrant/vagrant-2.5/test.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test.php 2001/11/29 23:34:28 1.2
--- test.php 2001/12/01 00:52:09 1.3
***************
*** 53,56 ****
--- 53,57 ----
$vagrant->CreateColor('dark-blue',0,0,75,255);
+ $vagrant->CreateColor('dark-green',0,75,0,255);
$vagrant->SetValue($graph_id2, 'background_color', 'dark-blue');
$vagrant->SetValue($graph_id2, 'axis_color', 'white');
***************
*** 62,67 ****
$vagrant->SetValue($graph_id2, 'y_tick', .5);
! //$vagrant->SetValue($graph_id,'axis2_min', -20);
! //$vagrant->SetValue($graph_id,'axis2_max', 20);
//$vagrant->SetValue($graph_id,'x_min', 7);
--- 63,68 ----
$vagrant->SetValue($graph_id2, 'y_tick', .5);
! $vagrant->SetValue($graph_id,'axis2_min', -20);
! $vagrant->SetValue($graph_id,'axis2_max', 20);
//$vagrant->SetValue($graph_id,'x_min', 7);
***************
*** 71,75 ****
$vagrant->SetValue($graph_id, 'x_tick', 1);
! $vagrant->SetGraphType($graph_id, $data3, "filled", "green", array('alpha'=>140, 'legend_title' => 'Test Bar Graph Title'));
$vagrant->SetGraphType($graph_id, $data1, "line", "blue", array('alpha'=>140, 'legend_title' => 'Test Line Graph Title'));
$vagrant->SetGraphType($graph_id, $data2, "line", "red", array('alpha'=>140, 'legend_title' => 'Test Line Graph Title'));
--- 72,76 ----
$vagrant->SetValue($graph_id, 'x_tick', 1);
! $vagrant->SetGraphType($graph_id, $data3, "scatter", "dark-green", array('alpha'=>200, 'legend_title' => 'Test Bar Graph Title','shape'=>'circle'));
$vagrant->SetGraphType($graph_id, $data1, "line", "blue", array('alpha'=>140, 'legend_title' => 'Test Line Graph Title'));
$vagrant->SetGraphType($graph_id, $data2, "line", "red", array('alpha'=>140, 'legend_title' => 'Test Line Graph Title'));
***************
*** 82,86 ****
// Add a highlight to the right side axis by adding a true to after the options array
//
! $vagrant->AddHighlight($graph_id, 3, 40, 7, "", "yellow", array('alpha' => 75, 'legend_text' => "axis2 highlight", 'highlight_text' => "Highlight and legend text!" ), true);
// If you comment out display image and uncomment the infodump function
--- 83,87 ----
// Add a highlight to the right side axis by adding a true to after the options array
//
! $vagrant->AddHighlight($graph_id, 3, 15, 7, 40, "yellow", array('alpha' => 75, 'legend_text' => "axis2 highlight", 'highlight_text' => "Highlight and legend text!" ), true);
// If you comment out display image and uncomment the infodump function
|