I've got something like this which works, but I want to use the result2 array for the first series.data rather than hardcoding. Using data: result2 or data: [result2] does not work. Is it not possible to assign with a variable in this kind of declaration?
var chart1;
$(document).ready(function() {
$.get('sales_data', function(result) {
var result2 = result.split(',');
chart1 = new Highcharts.Chart({
series: [{
type: 'column',
name: 'Units',
data: [1, 3, 4]
}, {
type: 'line',
name: '3 month avg',
data: [2, 3, 4]
}]
});
});
});
splitreturns an array, not an object, just FYI.data: result2. Have you tried it? If it's not working, check ifsales_datais returning the correct string.