score:5

Accepted answer

We've got this bubble chart very simple, what we want it's to show in the xaxis a custom string instead of the x value

$(function () {
var names = ["DAVE","JOHN"];
var projects = ["Project 1","Project 2"];
$('#container').highcharts({

    chart: {
        type: 'bubble',
        plotBorderWidth: 1,
        zoomType: 'xy'
    },

    title: {
        text: 'Highcharts for staff project time'
    },

    xAxis: {
        categories:['Project 1', 'Project 2', 'Project 3']
    },



    series: [{
        data: [
                   { x: 3.5, y: 4, z: 5, color: 'blue' },
                   {  x: 7, y: 7, z: 3, color: 'blue' },
                   {  x: 4, y: 8, z: 6, color: 'blue' }
                ],
    }]

   });
});

we want to show project 1, proyect 2.... instead of the corresponding x value. Maybe in the x axis like it shows there

 xAxis: {
        categories:['Project 1', 'Project 2', 'Project 3']
      },

or in the object for example

data: [
                   { name: Proyect 1, x: 3.5, y: 4, z: 5, color: 'blue' },
                   { name: Proyect 2, x: 7, y: 7, z: 3, color: 'blue' },
                   { name: Proyect 3, x: 4, y: 8, z: 6, color: 'blue' }
                ],

and then show in the x axis name instead the x value.

I get the answer from Highcharts helpdesk and I want to share it:

In first scenario, labels from categories are not printed, because categories are indexed from 0, so you have labels "until 2" index. But in data you refer to 3,5 / 4 / 7 index, so only numbers are printed. (Labels with these index don't exist in categories).

You can use solutions for that: - fix index in your data, like here: http://jsfiddle.net/ee5ffq9w/1/ - increase amount of categories - use points with category name: http://jsfiddle.net/ee5ffq9w/2/


Related Query

More Query from same tag