Index: trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GoogleBar.php |
— | — | @@ -28,6 +28,11 @@ |
29 | 29 | $this->isHTML = true; |
30 | 30 | |
31 | 31 | $t = ""; |
| 32 | + $n = ""; |
| 33 | + |
| 34 | + // if there is only one column in the results then stop right away |
| 35 | + if ($res->getColumnCount() == 1) return ""; |
| 36 | + |
32 | 37 | // print all result rows |
33 | 38 | $first = true; |
34 | 39 | $count = 0; // How many bars will they be? Needed to calculate the height of the image |
Index: trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GooglePie.php |
— | — | @@ -34,6 +34,11 @@ |
35 | 35 | $this->isHTML = true; |
36 | 36 | |
37 | 37 | $t = ""; |
| 38 | + $n = ""; |
| 39 | + |
| 40 | + // if there is only one column in the results then stop right away |
| 41 | + if ($res->getColumnCount() == 1) return ""; |
| 42 | + |
38 | 43 | // print all result rows |
39 | 44 | $first = true; |
40 | 45 | $max = 0; // the biggest value. needed for scaling |
Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php |
— | — | @@ -151,4 +151,16 @@ |
152 | 152 | } |
153 | 153 | return $result; |
154 | 154 | } |
| 155 | + |
| 156 | + function getParameters() { |
| 157 | + return array( |
| 158 | + array('name' => 'graphname', 'type' => 'string', 'description' => wfMsg('srf_paramdesc_graphname')), |
| 159 | + array('name' => 'graphsize', 'type' => 'int', 'description' => wfMsg('srf_paramdesc_graphsize')), |
| 160 | + array('name' => 'graphlegend', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlegend'), 'values'=>array('yes', 'no')), |
| 161 | + array('name' => 'graphlabel', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlabel'), 'values'=>array('yes', 'no')), |
| 162 | + array('name' => 'rankdir', 'type' => 'string', 'description' => wfMsg('srf_paramdesc_rankdir')), |
| 163 | + array('name' => 'graphlink', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlink'), 'values'=>array('yes', 'no')), |
| 164 | + array('name' => 'graphcolor', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphcolor'), 'values'=>array('yes', 'no')) |
| 165 | + ); |
| 166 | + } |
155 | 167 | } |
Index: trunk/extensions/SemanticResultFormats/TagCloud/SRF_TagCloud.php |
— | — | @@ -173,10 +173,12 @@ |
174 | 174 | foreach ( $tags as &$tag ) { |
175 | 175 | switch ( $this->sizeMode ) { |
176 | 176 | case 'linear': |
177 | | - $tag = $this->minTagSize + $maxSizeIncrease * ( $tag -$min ) / ( $max -$min ); |
| 177 | + $divisor = ($max == $min) ? 1 : $max - $min; |
| 178 | + $tag = $this->minTagSize + $maxSizeIncrease * ( $tag -$min ) / $divisor; |
178 | 179 | break; |
179 | 180 | case 'log' : default : |
180 | | - $tag = $this->minTagSize + $maxSizeIncrease * ( log( $tag ) -log( $min ) ) / ( log( $max ) -log( $min ) ); |
| 181 | + $divisor = ($max == $min) ? 1 : log( $max ) - log( $min ); |
| 182 | + $tag = $this->minTagSize + $maxSizeIncrease * ( log( $tag ) - log( $min ) ) / $divisor ; |
181 | 183 | break; |
182 | 184 | } |
183 | 185 | } |
Index: trunk/extensions/SemanticResultFormats/Ploticus/SRF_Ploticus.php |
— | — | @@ -14,11 +14,6 @@ |
15 | 15 | * |
16 | 16 | * @ingroup SMWQuery |
17 | 17 | */ |
18 | | - |
19 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
20 | | - die( 'Not an entry point.' ); |
21 | | -} |
22 | | - |
23 | 18 | class SRFPloticus extends SMWResultPrinter { |
24 | 19 | protected $m_ploticusparams = ''; |
25 | 20 | protected $m_imageformat = 'gif'; |
— | — | @@ -342,4 +337,27 @@ |
343 | 338 | |
344 | 339 | return ( $rtnstr ); |
345 | 340 | } |
| 341 | + |
| 342 | + function getParameters() { |
| 343 | + return array( |
| 344 | + array('name' => 'ploticusmode', 'type' => 'enumeration', 'values' => array('preftab', 'script')), |
| 345 | + array('name' => 'ploticusparams', 'type' => 'string'), |
| 346 | + array('name' => 'imageformat', 'type' => 'enumeration', 'values' => array('png', ' gif', 'jpeg', 'svg', 'svgz', 'swf', 'eps', 'ps', 'drawdump', 'drawdumpa'), 'defaultValue'=>'png'), |
| 347 | + array('name' => 'titletext', 'type' => 'string'), |
| 348 | + array('name' => 'showcsv', 'type' => 'boolean'), |
| 349 | + array('name' => 'ploticusmode', 'type' => 'string'), |
| 350 | + array('name' => 'debug', 'type' => 'boolean'), |
| 351 | + array('name' => 'liveupdating', 'type' => 'boolean'), |
| 352 | + array('name' => 'updatefrequency', 'type' => 'int'), |
| 353 | + array('name' => 'showtimestamp', 'type' => 'boolean'), |
| 354 | + array('name' => 'showimagelink', 'type' => 'boolean'), |
| 355 | + array('name' => 'showrefresh', 'type' => 'boolean'), |
| 356 | + array('name' => 'drawdumpoutput', 'type' => 'string'), |
| 357 | + array('name' => 'tblwidth', 'type' => 'int'), |
| 358 | + array('name' => 'tblheight', 'type' => 'int'), |
| 359 | + array('name' => 'width', 'type' => 'int'), |
| 360 | + array('name' => 'height', 'type' => 'int') |
| 361 | + ); |
| 362 | + } |
| 363 | + |
346 | 364 | } |
Index: trunk/extensions/SemanticResultFormats/SRF_Messages.php |
— | — | @@ -98,6 +98,15 @@ |
99 | 99 | 'srf_paramdesc_recordsep' => 'Separator between values of record properties', |
100 | 100 | 'srf_printername_hash' => 'Hash', |
101 | 101 | 'srf_paramdesc_hashname' => 'If given and the HashTables extension is available this will create an hash with the specified name', |
| 102 | + |
| 103 | + // format "graph" |
| 104 | + 'srf_paramdesc_graphname' => 'Title', |
| 105 | + 'srf_paramdesc_graphsize' => 'Graph size (in px)', |
| 106 | + 'srf_paramdesc_graphlegend' => 'Show graph legend or not', |
| 107 | + 'srf_paramdesc_graphlabel' => 'Graph label', |
| 108 | + 'srf_paramdesc_rankdir' => 'Rank dir', |
| 109 | + 'srf_paramdesc_graphlink' => 'Graph link', |
| 110 | + 'srf_paramdesc_graphcolor' => 'Graph color' |
102 | 111 | ); |
103 | 112 | |
104 | 113 | /** Message documentation (Message documentation) |