score:9

Accepted answer

so i found a solution.

after getting the data, i did

$.each(item, function (index, value) {
    objects.push([value.name, value.value]);
});

and then bound my series with

series: [{
     data: objects,
     name: 'value type description'
}]

so i have "value type description" in the legend, but when i hover over a specific point i have the name as the label, and valid data displaying in graph form.

i found at http://api.highcharts.com/highcharts#series that if you have an array of two dimensional arrays, you can just pass a string as the first parameter and it would parse it as the label for that point.

edit: example per request.

so you have two pieces to the series field, data and name. name does not apply to the data, that will be the name of the axis.

so data is an array of key/value pairs.

data: [ {[key1, value1]}, {[key2, value2]}, {[key3, value3]} ]

and name is what the "main" label will be - "my data stuff" for example.

then, when you load the chart, in the legend it should say "my data stuff", but when you hover over a specific point, say the first one, it will display the key1 value1 information.

score:7

        data: [{
            name: 'point 1',
            y: 1,
            test1:9,
            test2:'ddaf'
        }, {                         ------->      right
            name: 'point 2',
            y: 5,
            test1:12,
            test2:'ddddaf'
        }]

        data: [{
            my_name: 'point 1',
            y: 1,
            test1:9,
            test2:'ddaf'
        }, {                         -------> we change 'name' to 'my_name',
            my_name: 'point 2',               then the name you want to show become
            y: 5,                             'slice', instead of 'point 1','point 2'
            test1:12,
            test2:'ddddaf'
        }]

        data: [{
            my_name: 'point 1',
            my_y: 1,
            test1:9,
            test2:'ddaf'
        }, {                         ------->  now,we get nothing.
            my_name: 'point 2',
            my_y: 5,
            test1:12,
            test2:'ddddaf'
        }]

so,the 'name' and 'y' is the key.


Related Query

More Query from same tag