Last modified: 2012-06-05 00:36:12 UTC
Hi, I had a use case where I needed point labels beside the bars. I made a small patch based on 1.5.2.1 release of SRF to get this done. - [ADD] a new parameter 'showpointlabels' of type boolean. - [ADD] file jqplot.pointLabels.js to repository Example: {{#ask: [[Category:Issue]] |?Subject |?Estimated Hours |mainlabel=- |format=jqplotbar |bardirection=horizontal |showpointlabels=true }} Here's the patch: *** SRF_jqPlotBar.php.orig Mon Jan 31 12:03:23 2011 --- SRF_jqPlotBar.php Mon Jan 31 12:04:23 2011 *************** *** 17,22 **** --- 17,23 ---- protected $m_barcolor = '#85802b' ; protected $m_bardirection = 'vertical'; protected $m_numbersaxislabel = ' '; + protected $m_showpointlabels = 'false'; static protected $m_barchartnum = 1; protected function readParameters( $params, $outputmode ) { *************** *** 46,51 **** --- 47,57 ---- if ( array_key_exists( 'numbersaxislabel', $this->m_params ) ) { $this->m_numbersaxislabel = $this->m_params['numbersaxislabel']; } + if ( array_key_exists( 'showpointlabels', $this->m_params ) ) { + if ( $this->m_params['showpointlabels'] == 'true' ) { + $this->m_showpointlabels['showpointlabels'] = $this->m_params['showpointlabels']; + } + } } public function getName() { *************** *** 76,81 **** --- 82,88 ---- 'jqplot.barRenderer.min.js', 'jqplot.canvasAxisTickRenderer.min.js', 'jqplot.canvasTextRenderer.min.js', + 'jqplot.pointLabels.js', ), 'styles' => array( ), *************** *** 125,130 **** --- 132,138 ---- $scripts[] = "$srfgScriptPath/jqPlot/jqplot.barRenderer.min.js"; $scripts[] = "$srfgScriptPath/jqPlot/jqplot.canvasAxisTickRenderer.min.js"; $scripts[] = "$srfgScriptPath/jqPlot/jqplot.canvasTextRenderer.min.js"; + $scripts[] = "$srfgScriptPath/jqPlot/jqplot.pointLabels.js"; foreach ( $scripts as $script ) { $wgOut->addScriptFile( $script ); *************** *** 248,254 **** barDirection: '{$this->m_bardirection}', barPadding: 6, barMargin: $barmargin ! } }], axes: { $labels_axis: { --- 256,262 ---- barDirection: '{$this->m_bardirection}', barPadding: 6, barMargin: $barmargin ! }, pointLabels:{show: '{$this->m_showpointlabels}'} }], axes: { $labels_axis: {
Parameter['pointlabels'] had been introduced in SRF 1.7/SRF 1.8 for both jqPlotBar/Pie and since its changes in SRF 1.8, this patch is obsolete.