Index: trunk/extensions/SemanticResultFormats/jqPlot/SRF_jqPlotBar.php |
— | — | @@ -7,41 +7,29 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | class SRFjqPlotBar extends SMWResultPrinter { |
| 11 | + |
| 12 | + protected static $m_barchartnum = 1; |
| 13 | + |
11 | 14 | protected $m_width = '150'; |
12 | 15 | protected $m_height = '400'; |
13 | 16 | protected $m_charttitle = ' '; |
14 | 17 | protected $m_barcolor = '#85802b' ; |
15 | 18 | protected $m_bardirection = 'vertical'; |
16 | 19 | protected $m_numbersaxislabel = ' '; |
17 | | - static protected $m_barchartnum = 1; |
18 | 20 | |
19 | | - protected function readParameters( $params, $outputmode ) { |
20 | | - parent::readParameters( $params, $outputmode ); |
21 | | - if ( array_key_exists( 'width', $this->m_params ) ) { |
22 | | - $this->m_width = $this->m_params['width']; |
23 | | - } |
24 | | - if ( array_key_exists( 'height', $this->m_params ) ) { |
25 | | - $this->m_height = $this->m_params['height']; |
26 | | - } |
27 | | - if ( array_key_exists( 'charttitle', $this->m_params ) ) { |
28 | | - $this->m_charttitle = $this->m_params['charttitle']; |
29 | | - } |
30 | | - if ( array_key_exists( 'barcolor', $this->m_params ) ) { |
31 | | - $this->m_barcolor = $this->m_params['barcolor']; |
32 | | - } |
33 | | - if ( array_key_exists( 'bardirection', $this->m_params ) ) { |
34 | | - // keep it simple - only 'horizontal' makes sense as |
35 | | - // an alternate value |
36 | | - if ( $this->m_params['bardirection'] == 'horizontal' ) { |
37 | | - $this->m_bardirection = $this->m_params['bardirection']; |
38 | | - } |
39 | | - } |
40 | | - else{ |
41 | | - $this->m_bardirection = 'vertical'; |
42 | | - } |
43 | | - if ( array_key_exists( 'numbersaxislabel', $this->m_params ) ) { |
44 | | - $this->m_numbersaxislabel = $this->m_params['numbersaxislabel']; |
45 | | - } |
| 21 | + /** |
| 22 | + * (non-PHPdoc) |
| 23 | + * @see SMWResultPrinter::handleParameters() |
| 24 | + */ |
| 25 | + protected function handleParameters( array $params, $outputmode ) { |
| 26 | + parent::handleParameters( $params, $outputmode ); |
| 27 | + |
| 28 | + $this->m_width = $this->m_params['width']; |
| 29 | + $this->m_height = $this->m_params['height']; |
| 30 | + $this->m_charttitle = $this->m_params['charttitle']; |
| 31 | + $this->m_barcolor = $this->m_params['barcolor']; |
| 32 | + $this->m_bardirection = $this->m_params['bardirection']; |
| 33 | + $this->m_numbersaxislabel = $this->m_params['numbersaxislabel']; |
46 | 34 | } |
47 | 35 | |
48 | 36 | public function getName() { |
— | — | @@ -278,15 +266,28 @@ |
279 | 267 | } |
280 | 268 | |
281 | 269 | public function getParameters() { |
282 | | - return array( |
283 | | - array( 'name' => 'limit', 'type' => 'int', 'description' => wfMsg( 'smw_paramdesc_limit' ) ), |
284 | | - array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_chartheight' ) ), |
285 | | - array( 'name' => 'charttitle', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_charttitle' ) ), |
286 | | - array( 'name' => 'barcolor', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_barcolor' ) ), |
287 | | - array( 'name' => 'bardirection', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_bardirection' ),'values' => array('horizontal', 'vertical')), |
288 | | - array( 'name' => 'numbersaxislabel', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_barnumbersaxislabel' ) ), |
289 | | - array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_chartwidth' ) ), |
290 | | - ); |
| 270 | + $params = parent::getParameters(); |
| 271 | + |
| 272 | + $params['height'] = new Parameter( 'height', Parameter::TYPE_INTEGER, 400 ); |
| 273 | + $params['height']->setMessage( 'srf_paramdesc_chartheight' ); |
| 274 | + |
| 275 | + $params['width'] = new Parameter( 'height', Parameter::TYPE_INTEGER, 150 ); |
| 276 | + $params['width']->setMessage( 'srf_paramdesc_chartwidth' ); |
| 277 | + |
| 278 | + $params['charttitle'] = new Parameter( 'charttitle', Parameter::TYPE_STRING, ' ' ); |
| 279 | + $params['charttitle']->setMessage( 'srf_paramdesc_charttitle' ); |
| 280 | + |
| 281 | + $params['barcolor'] = new Parameter( 'barcolor', Parameter::TYPE_STRING, '#85802b' ); |
| 282 | + $params['barcolor']->setMessage( 'srf_paramdesc_barcolor' ); |
| 283 | + |
| 284 | + $params['bardirection'] = new Parameter( 'bardirection', Parameter::TYPE_STRING, 'vertical' ); |
| 285 | + $params['bardirection']->setMessage( 'srf_paramdesc_bardirection' ); |
| 286 | + $params['bardirection']->addCriteria( new CriterionInArray( 'horizontal', 'vertical' ) ); |
| 287 | + |
| 288 | + $params['numbersaxislabel'] = new Parameter( 'numbersaxislabel', Parameter::TYPE_STRING, ' ' ); |
| 289 | + $params['numbersaxislabel']->setMessage( 'srf_paramdesc_barnumbersaxislabel' ); |
| 290 | + |
| 291 | + return $params; |
291 | 292 | } |
292 | 293 | |
293 | 294 | } |