Note that there are some explanatory texts on larger screens.

plurals
  1. POTo pass dynamic json array to Highcharts Pie Chart
    primarykey
    data
    text
    <p>I passed json encoded string(eg. $TEXT2 consisting ["chrome","15","firefox","20"]) from xcode to an array(eg. arr) in javascript.Now I want to pass this array containing json string dynamically to Highcharts Pie. The HTML code is</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=20, user-scalable=no;" /&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;title&gt;Pie chart&lt;/title&gt; &lt;!-- 1. Add these JavaScript inclusions in the head of your page --&gt; &lt;script type="text/javascript" src="jquery-1.6.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="highcharts.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.form.js"&gt;&lt;/script&gt; &lt;!-- 2. Add the JavaScript to initialize the chart on document ready --&gt; &lt;script type="text/javascript"&gt; var chart; var arr = $TEXT2; $(document).ready(function(){ chart = new Highcharts.Chart({ chart: { renderTo: 'container', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Interactive Pie' }, tooltip: { formatter: function() { return '&lt;b&gt;'+ this.point.name +'&lt;/b&gt;: '+ this.y +' %'; } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }, series: [{ type: 'pie', name: 'Browser share', data: [] }] }); }); &lt;/script&gt; &lt;body&gt; &lt;br&gt; &lt;!-- 3. Add the container --&gt; &lt;div id="container" style="width: 300px; height: 350px; margin: 0 auto"&gt;&lt;/div&gt; &lt;!-- 2. Add the JavaScript to initialize the chart on document ready --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I am trying to use getjson method although m unaware of its usage. Since i want to pass my array i.e arr to data[] in Highcharts,I am doing:</p> <pre><code>$.getJSON("arr", function(json) { chart.series = json; var chart = new Highcharts.Chart(chart); }); </code></pre> <p>Can anyone help me on dis. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload