r102882 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102881‎ | r102882 | r102883 >
Date:08:48, 13 November 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
patch by James Hong Kong
Modified paths:
  • /trunk/extensions/SemanticResultFormats/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticResultFormats/SRF_Messages.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/jqPlot/SRF_jqPlotPie.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/RELEASE-NOTES
@@ -6,10 +6,11 @@
77
88 * Compatibility with SMW 1.7 and later.
99 * Dropped support for MediaWiki 1.15.x and SMW < 1.7.
10 -* Added warning icon with tooltip to jqplotpie shown when there are no results instead of a non-working chart.
 10+* Added warning message to jqplotpie and jqplotbar shown when there are no results instead of a non-working chart.
1111 * Added value distribution support to jqplotpie and jqplotbar.
1212 * Added min parameter to jqplotbar to set the minimun value for the Y-axis.
13 -* Added pointlabel parameter to jqplotbar, based on a patch by James Hong Kong.
 13+* Added pointlabel parameter to jqplotbar and chartlegend, legendlocation,
 14+ datalabels and datalabeltype parameters to jqplotpie based on a patches by James Hong Kong.
1415
1516 New formats in this version are:
1617 * valuerank (written by DaSch)
Index: trunk/extensions/SemanticResultFormats/SRF_Messages.php
@@ -79,6 +79,10 @@
8080 'srf_paramdesc_barnumbersaxislabel' => 'The label for the numbers axis',
8181 'srf-paramdesc-minvalue' => 'The minimum value to show on the Y-axis',
8282 'srf-paramdesc-pointlabels' => 'Display of individual data points',
 83+ 'srf-paramdesc-chartlegend' => 'Display chart legend',
 84+ 'srf-paramdesc-legendlocation' => 'Set legend location',
 85+ 'srf-paramdesc-datalabels' => 'Display pie data labels',
 86+ 'srf-paramdesc-datalabeltype' => 'Set data label type',
8387
8488 // "gallery" format
8589 'srf_printername_gallery' => 'Gallery',
Index: trunk/extensions/SemanticResultFormats/jqPlot/SRF_jqPlotPie.php
@@ -123,6 +123,11 @@
124124
125125 self::$m_piechartnum++;
126126
 127+ $chartlegend = FormatJson::encode( $this->params['chartlegend'] );
 128+ $legendlocation = FormatJson::encode( $this->params['legendlocation'] );
 129+ $datalabels = FormatJson::encode( $this->params['datalabels'] );
 130+ $datalabeltype = FormatJson::encode( $this->params['datalabeltype'] );
 131+
127132 $js_pie =<<<END
128133 <script type="text/javascript">
129134 jQuery(document).ready(function(){
@@ -132,10 +137,12 @@
133138 seriesDefaults: {
134139 renderer: jQuery.jqplot.PieRenderer,
135140 rendererOptions: {
 141+ showDataLabels: $datalabels,
 142+ dataLabels: $datalabeltype,
136143 sliceMargin:2
137144 }
138145 },
139 - legend: { show:true }
 146+ legend: { show:$chartlegend, location: $legendlocation }
140147 });
141148 });
142149 </script>
@@ -171,7 +178,22 @@
172179 $params['charttitle']->setMessage( 'srf_paramdesc_charttitle' );
173180
174181 $params['distributionlimit']->setDefault( 13 );
 182+
 183+ $params['chartlegend'] = new Parameter( 'chartlegend', Parameter::TYPE_BOOLEAN, true );
 184+ $params['chartlegend']->setMessage( 'srf-paramdesc-chartlegend' );
 185+
 186+ $params['legendlocation'] = new Parameter( 'legendlocation', Parameter::TYPE_STRING, 'ne' );
 187+ $params['legendlocation']->setMessage( 'srf-paramdesc-legendlocation' );
 188+ $params['legendlocation']->addCriteria( new CriterionInArray( 'nw','n', 'ne', 'e', 'se', 's', 'sw', 'w' ) );
 189+
 190+ $params['datalabels'] = new Parameter( 'datalabels', Parameter::TYPE_BOOLEAN, false );
 191+ $params['datalabels']->setMessage( 'srf-paramdesc-datalabels' );
 192+
 193+ $params['datalabeltype'] = new Parameter( 'datalabeltype', Parameter::TYPE_STRING, ' ' );
 194+ $params['datalabeltype']->setMessage( 'srf-paramdesc-datalabeltype' );
 195+ $params['datalabeltype']->addCriteria( new CriterionInArray( 'percent','value', 'label' ) );
175196
 197+
176198 return $params;
177199 }
178200

Follow-up revisions

RevisionCommit summaryAuthorDate
r105083follow up to r102882 r102487 r103330jeroendedauw21:25, 3 December 2011

Comments

#Comment by Siebrand (talk | contribs)   16:53, 25 November 2011

Please add message documentation for the newly added messages. Thanks.

Status & tagging log