r50466 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50465‎ | r50466 | r50467 >
Date:01:34, 11 May 2009
Author:laner
Status:deferred
Tags:
Comment:
Added support for labels
Modified paths:
  • /trunk/extensions/Plotters/PlottersClass.php (modified) (history)
  • /trunk/extensions/Plotters/README (modified) (history)

Diff [purge]

Index: trunk/extensions/Plotters/PlottersClass.php
@@ -90,9 +90,15 @@
9191 }
9292 }
9393
 94+ // Prepare labels
 95+ $output .= "var labels = [];";
 96+ for ( $i = 0; $i < count( $this->argumentArray["labels"] ); $i++ ) {
 97+ $output .= "labels[$i] = '" . $this->argumentArray["labels"][$i] . "';";
 98+ }
 99+
94100 // Run preprocessors
95101 foreach ( $this->argumentArray["preprocessors"] as $preprocessor ) {
96 - $output .= 'data = plotter_' . $preprocessor . '_process( data, ';
 102+ $output .= 'data = plotter_' . $preprocessor . '_process( data, labels, ';
97103 foreach ( $this->argumentArray["preprocessorarguments"] as $argument ) {
98104 $output .= $argument . ', ';
99105 }
@@ -102,7 +108,7 @@
103109 }
104110
105111 // Run script
106 - $output .= 'plotter_' . $this->argumentArray["script"] . '_draw( data, ';
 112+ $output .= 'plotter_' . $this->argumentArray["script"] . '_draw( data, labels, ';
107113 foreach ( $this->argumentArray["scriptarguments"] as $argument ) {
108114 $output .= "'" . $argument . "'" . ", ";
109115 }
Index: trunk/extensions/Plotters/README
@@ -7,12 +7,12 @@
88 function for each should be defined as follows:
99
1010 /* For preprocessing scripts */
11 -function plotter_<functionname>_process( $data, $arg1, $arg2, ... ) {
 11+function plotter_<functionname>_process( data, labels, arg1, arg2, ... ) {
1212 ...
1313 }
1414
1515 /* For plotting scripts */
16 -function plotter_<functionname>_draw( $data, $arg1, $arg2, ... ) {
 16+function plotter_<functionname>_draw( data, labels, arg1, arg2, ... ) {
1717 ...
1818 }
1919
@@ -21,8 +21,9 @@
2222 {{#plot:
2323 |script=<functionname>
2424 |scriptarguments=arg1,arg2,...
 25+|labels=label1,label2
2526 |data=1,2
26 -3,4}}
 27+2,4}}
2728
2829 Currently, only PlotKit is supported; but other javascript plotting libraries
2930 will be supported in the future.

Status & tagging log