Esempio n. 1
0
 public static function create_area_graph($title)
 {
     self::init();
     $d = new solid_dot();
     $d->size(3)->halo_size(1)->colour('#3D5C56');
     $range_values = array();
     foreach (self::$data_set as $data) {
         if (!is_array($data['values'])) {
             continue;
         }
         $area = new area();
         // set the circle line width:
         $area->set_width(2);
         $area->set_default_dot_style($d);
         $area->set_colour($data['color']);
         $area->set_fill_colour($data['color']);
         $area->set_fill_alpha(0.3);
         $area->on_show(new line_on_show('pop-up', 2, 0.5));
         $area->set_key($data['line_title'], 10);
         $area->set_values($data['values']);
         # Since there should be an even number on the xaxis for all sets
         $x_axis_titles = $data['titles'];
         # Add our values into a big bucket so we can get the highest and lowest
         $range_values = array_merge($range_values, $data['values']);
         self::$chart->add_element($area);
     }
     $x_labels = new x_axis_labels();
     $x_labels->set_labels($x_axis_titles);
     $x_labels->set_vertical();
     self::$x_axis->set_labels($x_labels);
     $range = self::get_range($range_values);
     self::$y_axis->set_range($range['min'], $range['max']);
     self::show_chart($title);
 }