Created
December 30, 2013 03:32
-
-
Save tajmorton/8177481 to your computer and use it in GitHub Desktop.
Adds support for vAxis, hAxis, and legend options to php-report.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/headers/ChartHeader.php b/classes/headers/ChartHeader.php | |
index cdbe6f2..c1ab410 100644 | |
--- a/classes/headers/ChartHeader.php | |
+++ b/classes/headers/ChartHeader.php | |
@@ -80,7 +80,19 @@ class ChartHeader extends HeaderBase { | |
'options'=>array( | |
'type'=>'object', | |
'default'=>array() | |
- ) | |
+ ), | |
+ 'vAxis'=>array( | |
+ 'type'=>'array', | |
+ 'default'=>array() | |
+ ), | |
+ 'hAxis'=>array( | |
+ 'type'=>'array', | |
+ 'default'=>array() | |
+ ), | |
+ 'legend'=>array( | |
+ 'type'=>'array', | |
+ 'default'=>array() | |
+ ) | |
); | |
public static function init($params, &$report) { | |
diff --git a/templates/default/html/chart_report.twig b/templates/default/html/chart_report.twig | |
index d856762..d604b8b 100644 | |
--- a/templates/default/html/chart_report.twig | |
+++ b/templates/default/html/chart_report.twig | |
@@ -58,7 +58,21 @@ | |
displayAnnotations: true, | |
series: series_{{chart.num}}, | |
colors: [], | |
- wmode: 'transparent' | |
+ wmode: 'transparent', | |
+ | |
+ {% autoescape false %} | |
+ {% if chart.vAxis is not empty %} | |
+ vAxis: {{ chart.vAxis|json_encode() }}, | |
+ {% endif %} | |
+ | |
+ {% if chart.hAxis is not empty %} | |
+ hAxis: {{ chart.hAxis|json_encode() }}, | |
+ {% endif %} | |
+ | |
+ {% if chart.legend is not empty %} | |
+ legend: {{ chart.legend|json_encode() }}, | |
+ {% endif %} | |
+ {% endautoescape %} | |
}; | |
{% if chart.options %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment