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