javascript - Building different types of Highcharts Programmatically. -
what able render graphs dynamically giving defined set of parameters url. example http://example.html?team=team1%chartype=pie.
this code simple 'column' http://jsfiddle.net/4mbwg/ code simple 'pie' http://jsfiddle.net/yfdkt/
code block (so not letting me post without code)
programmatically need able accept 'type' parameter example (pie, chart, line) , able plot graph.
simply changing "type" not sufficient. looking @ 2 types of graphs assuming plotoptions needs build dynamically...what need accomplish this?
if html
try,
// http://stackoverflow.com/a/3855394/1817690 var qs = (function(a) { if (a == "") return {}; var b = {}; (var = 0; < a.length; ++i) { var p=a[i].split('='); if (p.length != 2) continue; b[p[0]] = decodeuricomponent(p[1].replace(/\+/g, " ")); } return b; })(window.location.search.substr(1).split('&')); if(qs['type']) && qs['type']=='pie') { pie chart js code goes here } else if(qs['type'] && qs['type']=='line') { line chart js code goes here }
if using php
can like,
<?php if(isset($_get['type']) && $_get['type']=='pie') { ?> pie chart js code goes here <?php } else if(isset($_get['type']) && $_get['type']=='line') { ?> line chart js code goes here <?php } ?>
Comments
Post a Comment