Index: trunk/extensions/Plotters/PlottersClass.php |
— | — | @@ -90,9 +90,15 @@ |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
| 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 | + |
94 | 100 | // Run preprocessors |
95 | 101 | foreach ( $this->argumentArray["preprocessors"] as $preprocessor ) { |
96 | | - $output .= 'data = plotter_' . $preprocessor . '_process( data, '; |
| 102 | + $output .= 'data = plotter_' . $preprocessor . '_process( data, labels, '; |
97 | 103 | foreach ( $this->argumentArray["preprocessorarguments"] as $argument ) { |
98 | 104 | $output .= $argument . ', '; |
99 | 105 | } |
— | — | @@ -102,7 +108,7 @@ |
103 | 109 | } |
104 | 110 | |
105 | 111 | // Run script |
106 | | - $output .= 'plotter_' . $this->argumentArray["script"] . '_draw( data, '; |
| 112 | + $output .= 'plotter_' . $this->argumentArray["script"] . '_draw( data, labels, '; |
107 | 113 | foreach ( $this->argumentArray["scriptarguments"] as $argument ) { |
108 | 114 | $output .= "'" . $argument . "'" . ", "; |
109 | 115 | } |
Index: trunk/extensions/Plotters/README |
— | — | @@ -7,12 +7,12 @@ |
8 | 8 | function for each should be defined as follows: |
9 | 9 | |
10 | 10 | /* For preprocessing scripts */ |
11 | | -function plotter_<functionname>_process( $data, $arg1, $arg2, ... ) { |
| 11 | +function plotter_<functionname>_process( data, labels, arg1, arg2, ... ) { |
12 | 12 | ... |
13 | 13 | } |
14 | 14 | |
15 | 15 | /* For plotting scripts */ |
16 | | -function plotter_<functionname>_draw( $data, $arg1, $arg2, ... ) { |
| 16 | +function plotter_<functionname>_draw( data, labels, arg1, arg2, ... ) { |
17 | 17 | ... |
18 | 18 | } |
19 | 19 | |
— | — | @@ -21,8 +21,9 @@ |
22 | 22 | {{#plot: |
23 | 23 | |script=<functionname> |
24 | 24 | |scriptarguments=arg1,arg2,... |
| 25 | +|labels=label1,label2 |
25 | 26 | |data=1,2 |
26 | | -3,4}} |
| 27 | +2,4}} |
27 | 28 | |
28 | 29 | Currently, only PlotKit is supported; but other javascript plotting libraries |
29 | 30 | will be supported in the future. |