Changeset 202637
- Timestamp:
- 02/06/2010 04:50:55 PM (16 years ago)
- Location:
- easy-chart-builder/trunk
- Files:
-
- 3 edited
-
easy-chart-builder.php (modified) (8 diffs)
-
js/easy-chart-builder.js (modified) (14 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-chart-builder/trunk/easy-chart-builder.php
r195604 r202637 2 2 /* 3 3 Plugin Name: Easy Chart Builder 4 Version: 0. 6.14 Version: 0.7 5 5 Plugin URI: http://www.dyerware.com/main/easy-chart-builder 6 6 Description: Creates a chart directly in your post or page via shortcut. Manages sizing of chart to support wptouch and other mobile themes. … … 33 33 { 34 34 $jsDir = get_option('siteurl') . '/wp-content/plugins/easy-chart-builder/js/'; 35 wp_register_script('wpEasyCharts', "{$jsDir}easy-chart-builder.js", false, '0. 8');35 wp_register_script('wpEasyCharts', "{$jsDir}easy-chart-builder.js", false, '0.9'); 36 36 } 37 37 … … 43 43 44 44 } 45 45 46 46 public function output_scripts () 47 47 { 48 49 wp_enqueue_script('wpEasyCharts'); 50 48 wp_enqueue_script('wpEasyCharts'); 51 49 } 52 50 … … 90 88 'height' => '200', 91 89 'title' => '', 90 'minaxis' => '', 92 91 'groupnames' => 'Group 1,Group 2,Group 3', 93 'groupcolors' => '0070C0,FFFF00,FF0000,00CC00,A3A3A3,007070,00FFFF,CC7000 ',92 'groupcolors' => '0070C0,FFFF00,FF0000,00CC00,A3A3A3,007070,00FFFF,CC7000,00CC70,CC0070,7000CC,A370CC', 94 93 'valuenames' => 'test1,test2,test3,test4,test5', 95 94 'group1values' => '0,0,0', … … 101 100 'group7values' => '0,0,0', 102 101 'group8values' => '0,0,0', 102 'group9values' => '0,0,0', 103 'group10values' => '0,0,0', 104 'group11values' => '0,0,0', 105 'group12values' => '0,0,0', 103 106 'imagealtattr' => 'dyerware', 104 107 'imagetitleattr' => '', … … 125 128 126 129 $this->chartNum++; 127 $chartDiv = 'easyChartDiv' . $this->chartNum; 130 131 $randomatic = mt_rand(0,0x7fff); 132 $randomatic = $randomatic << 16; 133 global $post; 134 if ($post) 135 { 136 $randomatic = $randomatic | 0x8000; 137 } 138 139 $r = $randomatic | $this->chartNum; 140 $chartDiv = 'easyChartDiv' . base_convert($r, 10, 16); 141 142 143 //$chartDiv = 'easyChartDiv' . $this->chartNum; 128 144 $chartImg = $chartDiv . '_img'; 129 145 $tableDiv = $chartDiv . '_data'; … … 162 178 //<![CDATA[ 163 179 wpEasyChart.wpNewChart({$chartDiv}, {$json}); 164 function wpEasyChartToggle(id) {165 var e = document.getElementById(id);166 if(e.style.display == 'block')167 e.style.display = 'none';168 else169 e.style.display = 'block';170 }171 180 //]]> 172 181 </script> 173 182 ecbCode; 174 183 } 184 185 186 // This is for support in widgets 187 public function do_shortcode($content) { 188 global $shortcode_tags; 189 190 if (empty($shortcode_tags) || !is_array($shortcode_tags)) 191 return $content; 192 $pattern = '(.?)\[(easychart)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)'; 193 return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content); 194 } 175 195 } 176 196 … … 184 204 add_action('wp_head', array($wpEasyCharts, 'addCSS')); 185 205 add_action('wp_print_scripts', array($wpEasyCharts, 'output_scripts')); 206 186 207 add_shortcode('easychart',array($wpEasyCharts, 'process_shortcode')); 208 add_filter('widget_text', array($wpEasyCharts, 'do_shortcode')); 187 209 ?> -
easy-chart-builder/trunk/js/easy-chart-builder.js
r195604 r202637 1 1 /** 2 2 * Handle: easyChartBuilder 3 * Version: 0. 83 * Version: 0.9 4 4 * Enqueue: true 5 5 * … … 20 20 { 21 21 } 22 23 function wpEasyChartToggle(id) { 24 var e = document.getElementById(id); 25 if(e.style.display == 'block') 26 e.style.display = 'none'; 27 else 28 e.style.display = 'block'; 29 } 22 30 23 31 easyChartBuilder.prototype.pieChart = function(chartId, chartImg, chartWidth, chartHeight, chartHandle) … … 63 71 64 72 65 var maxMin = this.normalizeValues(chartValues );73 var maxMin = this.normalizeValues(chartValues, false, chartHandle); 66 74 var chartValuesString = this.encodeValues(chartValues, ""); 67 75 var chartColor = chartHandle["chartcolor"]; … … 117 125 } 118 126 119 var maxMin = this.normalizeValues(chartValues); 127 var maxMin = this.normalizeValues(chartValues, true, chartHandle); 128 var minAxis = chartHandle["minaxis"]; 129 if (minAxis == "") 130 { 131 if (maxMin[1] < 0) 132 {minAxis = maxMin[1];} 133 else {minAxis = "0";} 134 } 120 135 121 136 tempString = chartHandle["watermark"]; … … 132 147 "&chdl=" + chartGroupNames + "&chdlp=b" + 133 148 "&chco=" + chartColors + "&chd=e:" + chartValuesString + 134 "&chxt=y,x&chxr=0, 0," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep;149 "&chxt=y,x&chxr=0," + minAxis + "," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep; 135 150 136 151 chartImg.src = url_src; … … 159 174 groupName = "group" + (i+1) + "values"; 160 175 tempString = chartHandle[groupName]; 161 162 176 chartValues[i] = this.extractValues(tempString, ",", 0); 163 177 } … … 178 192 } 179 193 180 var maxMin = this.normalizeValues(chartValues); 194 var maxMin = this.normalizeValues(chartValues, true, chartHandle); 195 var minAxis = chartHandle["minaxis"]; 196 if (minAxis == "") 197 { 198 if (maxMin[1] < 0) 199 {minAxis = maxMin[1];} 200 else {minAxis = "0";} 201 } 202 181 203 tempString = chartHandle["watermark"]; 182 204 var wmColor = chartHandle["watermarkcolor"]; … … 192 214 "&chdl=" + chartGroupNames + "&chdlp=b" + 193 215 "&chco=" + chartColors + "&chd=e:" + chartValuesString + 194 "&chxt=x,y&chxr=0, 0," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep;216 "&chxt=x,y&chxr=0," + minAxis + "," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep; 195 217 196 218 chartImg.src = url_src; … … 238 260 239 261 // max,min,ratio 240 var maxMin = this.normalizeValues(chartValues );262 var maxMin = this.normalizeValues(chartValues, true, chartHandle); 241 263 tempString = chartHandle["watermark"]; 242 264 var wmColor = chartHandle["watermarkcolor"]; … … 246 268 var chartColor = chartHandle["chartcolor"]; 247 269 var chartFadeColor = chartHandle["chartfadecolor"]; 270 271 var minAxis = chartHandle["minaxis"]; 272 if (minAxis == "") 273 { 274 if (maxMin[1] < 0) 275 {minAxis = maxMin[1];} 276 else {minAxis = "0";} 277 } 248 278 249 279 var url_src ="http://chart.apis.google.com/chart?cht=lc&chs=" + chartWidth + "x" + chartHeight + … … 253 283 "&chdl=" + chartGroupNames + "&chdlp=b" + 254 284 "&chco=" + chartColors + "&chd=e:" + chartValuesString + 255 "&chxt=y,x&chxr=0, 0," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep;285 "&chxt=y,x&chxr=0," + minAxis + "," + maxMin[0] + "&chxl=1:" + chartValueNames + wmPrep; 256 286 257 287 chartImg.src = url_src; … … 396 426 }; 397 427 398 easyChartBuilder.prototype.normalizeValues = function(valueGrid )428 easyChartBuilder.prototype.normalizeValues = function(valueGrid, hasAxis, chartHandle) 399 429 { 400 430 var len = valueGrid.length; 401 431 var maxMin = new Array(); 402 432 var t, v, ratio; 433 var minAxis = chartHandle["minaxis"]; 403 434 404 435 maxMin[0] = valueGrid[0][0]; 405 436 maxMin[1] = maxMin[0]; 406 437 maxMin[2] = 0; 407 438 scaleMax = 0; 439 440 408 441 for (t = 0; t < len; t++) 409 442 { … … 415 448 } 416 449 417 ratio = 4095 / maxMin[0]; 450 scaleMax = maxMin[0]; 451 452 if (hasAxis == true && minAxis != "") 453 { 454 var lowValue = parseInt(minAxis); 455 456 for (t = 0; t < len; t++) 457 { 458 for (v = 0; v < valueGrid[t].length; v++) 459 { 460 if (valueGrid[t][v] < lowValue) 461 {valueGrid[t][v] = 0;} 462 else {valueGrid[t][v] -= lowValue;} 463 } 464 } 465 466 scaleMax -= lowValue; 467 } 468 469 ratio = 4095 / scaleMax; 418 470 maxMin[2] = ratio; 419 471 … … 423 475 {valueGrid[t][v] = parseFloat(valueGrid[t][v] * ratio);} //was parseInt 424 476 } 425 477 426 478 return maxMin; 427 479 }; -
easy-chart-builder/trunk/readme.txt
r195614 r202637 3 3 Contributors: dyerware 4 4 Donate link: http://www.dyerware.com/main/products/easy-chart-builder/easy-chart-builder-plugin-for-wordpress.html 5 Tags: chart,graph,charts,graphs, review,rating,comparison,mobile,shortcode,dyerware5 Tags: chart,graph,charts,graphs,line,review,rating,comparison,mobile,shortcode,dyerware 6 6 Requires at least: 2.8 7 7 Tested up to: 2.9.1 8 Stable tag: 0. 6.18 Stable tag: 0.7 9 9 10 10 This plugin allows you to easily create charts within your blog by use of shortcodes. … … 15 15 This plugin allows you to easily insert charts into your blog, making use shortcodes. While multipurpose, the chart system is intended to make it easy for posting detailed review measurements of some sort, such as video card comparisons. You specify the names of the devices being measured, the tests performed, and each device's measurements for said test. 16 16 17 Graphs scale to meet the size of the end-user client display, and support mobile displays such as those rendered by the wptouch plugin.17 The shortcode is supported on posts, pages, and in widgets. 18 18 19 Charts supported are horizontal bar, vertical bar, and pie. More can be added if desired. 19 Graphs scale to meet the size of the end-user client display, and support mobile displays such as those rendered by the wptouch plugin. 20 21 Charts supported are horizontal bar, vertical bar, line graph, and pie. More can be added if desired. 20 22 21 23 PHP5 Required. … … 64 66 == Upgrade Notice == 65 67 68 = 0.7 = 69 Shortcode can now be used in widgets. New optional parameter, "minaxis". Now supports graphing up to 12 groups (formerly 8). 70 66 71 = 0.6.1 = 67 72 Watermark glitch introduced in 0.6 … … 75 80 76 81 == Changelog == 82 83 = 0.7 = 84 * The shortcode can now be used in widgets, for example on the sidebar. 85 * New minaxis optional parameter can be used to set to the minimum axis value you wish the plot 86 to start at. This clips away uninteresting areas of a graph. 87 * Upped number of groups from 8 to 12. 77 88 78 89 = 0.6.1 =
Note: See TracChangeset
for help on using the changeset viewer.