MDL-55031 core: Series color was not being exported
authorFrederic Massart <fred@moodle.com>
Mon, 27 Jun 2016 10:40:05 +0000 (18:40 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 25 Jul 2016 09:42:44 +0000 (10:42 +0100)
Part of MDL-54987 epic.

lib/classes/chart_series.php

index ccc383a..2c5a93f 100644 (file)
@@ -40,6 +40,7 @@ class chart_series implements JsonSerializable {
     const TYPE_DEFAULT = null;
     const TYPE_LINE = 'line';
 
+    protected $color;
     protected $label;
     protected $type = self::TYPE_DEFAULT;
     protected $values = [];
@@ -49,6 +50,10 @@ class chart_series implements JsonSerializable {
         $this->label = $label;
     }
 
+    public function get_color() {
+        return $this->color;
+    }
+
     public function get_count() {
         return count($this->values);
     }
@@ -69,7 +74,8 @@ class chart_series implements JsonSerializable {
         $data = [
             'label' => $this->label,
             'type' => $this->type,
-            'values' => $this->values
+            'values' => $this->values,
+            'color' => $this->color,
         ];
         return $data;
     }