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