[7849] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | class x_axis
|
---|
| 4 | {
|
---|
| 5 | function x_axis(){}
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * @param $stroke as integer, with of the line and ticks
|
---|
| 9 | */
|
---|
| 10 | function set_stroke( $stroke )
|
---|
| 11 | {
|
---|
| 12 | $this->stroke = $stroke;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | function stroke( $stroke )
|
---|
| 16 | {
|
---|
| 17 | $this->set_stroke( $stroke );
|
---|
| 18 | return $this;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | *@param $colour as string HEX colour
|
---|
| 23 | *@param $grid_colour as string HEX colour
|
---|
| 24 | */
|
---|
| 25 | function set_colours( $colour, $grid_colour )
|
---|
| 26 | {
|
---|
| 27 | $this->set_colour( $colour );
|
---|
| 28 | $this->set_grid_colour( $grid_colour );
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | *@param $colour as string HEX colour
|
---|
| 33 | */
|
---|
| 34 | function set_colour( $colour )
|
---|
| 35 | {
|
---|
| 36 | $this->colour = $colour;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | function colour( $colour )
|
---|
| 40 | {
|
---|
| 41 | $this->set_colour($colour);
|
---|
| 42 | return $this;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | function set_tick_height( $height )
|
---|
| 46 | {
|
---|
| 47 | $tmp = 'tick-height';
|
---|
| 48 | $this->$tmp = $height;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | function tick_height( $height )
|
---|
| 52 | {
|
---|
| 53 | $this->set_tick_height($height);
|
---|
| 54 | return $this;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | function set_grid_colour( $colour )
|
---|
| 58 | {
|
---|
| 59 | $tmp = 'grid-colour';
|
---|
| 60 | $this->$tmp = $colour;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | function grid_colour( $colour )
|
---|
| 64 | {
|
---|
| 65 | $this->set_grid_colour($colour);
|
---|
| 66 | return $this;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | /**
|
---|
| 70 | * @param $o is a boolean. If true, the X axis start half a step in
|
---|
| 71 | * This defaults to True
|
---|
| 72 | */
|
---|
| 73 | function set_offset( $o )
|
---|
| 74 | {
|
---|
| 75 | $this->offset = $o?true:false;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | function offset( $o )
|
---|
| 79 | {
|
---|
| 80 | $this->set_offset($o);
|
---|
| 81 | return $this;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
| 85 | * @param $steps as integer. Which grid lines and ticks are visible.
|
---|
| 86 | */
|
---|
| 87 | function set_steps( $steps )
|
---|
| 88 | {
|
---|
| 89 | $this->steps = $steps;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | function steps( $steps )
|
---|
| 93 | {
|
---|
| 94 | $this->set_steps($steps);
|
---|
| 95 | return $this;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * @param $val as an integer, the height in pixels of the 3D bar. Mostly
|
---|
| 100 | * used for the 3D bar chart.
|
---|
| 101 | */
|
---|
| 102 | function set_3d( $val )
|
---|
| 103 | {
|
---|
| 104 | $tmp = '3d';
|
---|
| 105 | $this->$tmp = $val;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | /**
|
---|
| 109 | * @param $x_axis_labels as an x_axis_labels object
|
---|
| 110 | * Use this to customize the labels (colour, font, etc...)
|
---|
| 111 | */
|
---|
| 112 | function set_labels( $x_axis_labels )
|
---|
| 113 | {
|
---|
| 114 | //$this->labels = $v;
|
---|
| 115 | $this->labels = $x_axis_labels;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | /**
|
---|
| 119 | * Sugar syntax: helper function to make the examples simpler.
|
---|
| 120 | * @param $a is an array of labels
|
---|
| 121 | */
|
---|
| 122 | function set_labels_from_array( $a )
|
---|
| 123 | {
|
---|
| 124 | $x_axis_labels = new x_axis_labels();
|
---|
| 125 | $x_axis_labels->set_labels( $a );
|
---|
| 126 | $this->labels = $x_axis_labels;
|
---|
| 127 |
|
---|
| 128 | if( isset( $this->steps ) )
|
---|
| 129 | $x_axis_labels->set_steps( $this->steps );
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | /**
|
---|
| 133 | * min and max.
|
---|
| 134 | */
|
---|
| 135 | function set_range( $min, $max )
|
---|
| 136 | {
|
---|
| 137 | $this->min = $min;
|
---|
| 138 | $this->max = $max;
|
---|
| 139 | }
|
---|
| 140 | }
|
---|