Accepted answer

i think you are trying to do something what you already have done.

you want to get display three series from your json, for respective categories, then let's to that:

your code:

var categories = testdia['chartcategories'];
var series = testdia['chartseries'];

great! now use that variables:

newchart = new highcharts.chart({
    chart : {
        renderto : portletcontainer,
        type: 'column'
    xaxis: {
        categories: categories,
        labels: {
            rotation: -45,
            align: 'right',
    series: [{
        name: 'positive',
        data: series.positive // testdia.chartseries.positive is the same
    }, {
        name: 'neutral',
        data: series.neutral
    }, {
        name: 'negative',
        data: series.negative

and working demo:


here's how you should do it.

var allpositivedata = []; // you want an array, so start off with an array.

for(var i=0; i < categories.length; i++) {
    var diapositive = series['positive'][i]['y'];
    urlpositive = series['positive'][i]['url'];
    allpositivedata.push({'y':diapositive, 'url':urlpositive}); // add the element to the array.

that's all there is to it. your highcharts-setup piece of code can remain the same.

to make the sample a little shorter, i only edited the code for the positive data, the rest is the same, just a different name.

Related Query

More Query from same tag