Added a graphing functionality with Open Flash Chart, and added ability to graph...
[openemr.git] / library / openflashchart / php-ofc-library / ofc_y_axis_base.php
blob8093a09e5f904d8192b38ba91d46dcae36553875
1 <?php
3 class y_axis_base
5 function y_axis_base(){}
7 /**
8 * @param $s as integer, thickness of the Y axis line
9 */
10 function set_stroke( $s )
12 $this->stroke = $s;
15 /**
16 * @param $val as integer. The length of the ticks in pixels
18 function set_tick_length( $val )
20 $tmp = 'tick-length';
21 $this->$tmp = $val;
24 function set_colours( $colour, $grid_colour )
26 $this->set_colour( $colour );
27 $this->set_grid_colour( $grid_colour );
30 function set_colour( $colour )
32 $this->colour = $colour;
35 function set_grid_colour( $colour )
37 $tmp = 'grid-colour';
38 $this->$tmp = $colour;
41 /**
42 * Set min and max values, also (optionally) set the steps value.
43 * You can reverse the chart by setting min larger than max, e.g. min = 10
44 * and max = 0.
46 * @param $min as integer
47 * @param $max as integer
48 * @param $steps as integer.
50 function set_range( $min, $max, $steps=1 )
52 $this->min = $min;
53 $this->max = $max;
54 $this->set_steps( $steps );
57 /**
58 * Sugar for set_range
60 function range( $min, $max, $steps=1 )
62 $this->set_range( $min, $max, $steps );
63 return $this;
66 /**
67 * @param $off as Boolean. If true the Y axis is nudged up half a step.
69 function set_offset( $off )
71 $this->offset = $off?1:0;
74 /**
75 * @param $y_axis_labels as an y_axis_labels object
76 * Use this to customize the labels (colour, font, etc...)
78 function set_labels( $y_axis_labels )
80 $this->labels = $y_axis_labels;
83 /**
84 * Pass in some text for each label. This can contain magic variables "#val#" which
85 * will get replaced with the value for that Y axis label. Useful for:
86 * - "£#val#"
87 * - "#val#%"
88 * - "#val# million"
90 * @param $text as string.
92 function set_label_text( $text )
94 $tmp = new y_axis_labels();
95 $tmp->set_text( $text );
96 $this->labels = $tmp;
99 /**
100 * @param $steps as integer.
102 * Only show every $steps label, e.g. every 10th
104 function set_steps( $steps )
106 $this->steps = $steps;
110 * Make the labels show vertical
112 function set_vertical()
114 $this->rotate = "vertical";