0

enter image description here

Can someone explain to me how to properly pass an object as Series data into HighCharts?

I've created an object using the following:

var series2 = {
            id: 'series',
            name: 'JSON Data',
            data: []
        }

And then have a loop whereby I'm pushing data into the object like so:

series2.data.push([c, csv]);

And trying to set the series, within the HighCharts chart initialization as:

legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                floating: false,
                borderWidth: 1,
                backgroundColor: '#FFFFFF',
                shadow: true
            },
            series: series2

When rendered, my chart doesn't give any errors, but likewise it doesn't show any data!

If I change my HighCharts initialization line to read "series: series2.data" I DO get the correct number of series, but still no data.

Is there a correct way of doing this?

JasonMHirst
  • 576
  • 5
  • 12
  • 31
  • What do you see in the console? Can you give a [jsFiddle](http://jsfiddle.net/) repro? Can you share the `JSON.stringify(options)` for the options that you pass to the constructor. You may also want to follow http://stackoverflow.com/questions/12485560/highcharts-returning-error-14/12489695#12489695 and http://api.highcharts.com/highstock#series – Jugal Thakkar Oct 31 '12 at 05:15

1 Answers1

0

The series property expects and array. Change your code to:

...
series: [series2]
...
Greg Ross
  • 3,479
  • 2
  • 27
  • 26