Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate entire highchart object on server side
    primarykey
    data
    text
    <p>I'm following this <a href="http://www.highcharts.com/docs/working-with-data/preprocessing-data-from-a-file-csv-xml-json#3" rel="nofollow">example</a> to load a highchart using data from the server (I'm using a file here for testing purposes). I'd like to be able not only to load the data from the server but the entire instead. As I understand, <a href="http://jsfiddle.net/highcharts/kh5jY/" rel="nofollow">this</a> simple chart example shows that the entire chart is a json object, so I thought If I create the json code exactly like this and load it into an object and then pass it to the chart it would work. In an attempt to do that, I came up with the following code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.highcharts.com/highcharts.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $.getJSON('data.json', function(data) { var chart = new Highcharts.Chart(data); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container" style="width:100%; height:100%;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And this is my data.json file:</p> <pre><code>{ chart: { type: 'bar', renderTo: 'container' }, title: { text: 'Fruit Consumption' }, xAxis: { categories: ['Apples', 'Bananas', 'Oranges'] }, yAxis: { title: { text: 'Fruit eaten' } }, series: [ { name: 'Jane', data: [1, 0, 4] }, { name: 'John', data: [5, 7, 3] } ], } </code></pre> <p>I'm not getting any errors however the chart does not load. I appreciate any help.</p>
    singulars
    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.
    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