X-axis series.name chart diagrams

I am trying to show the name of each series on the x axis http://jsfiddle.net/Jr79Y/9/ enter image description here

series: [{
            name: 'Test',
            data: [20]
        }, {
            name: 'Test',
            data: [20]
        }, {
            name: 'Test',
            data: [40]
        }]

Does anyone know how to do this?

+4
source share
4 answers

This is a much simpler solution than everything I see for answers:

 xAxis: {
            categories:[]
        }

.

series: [{
            data: [{name:'Test 1',y:20,color:'red'},
                   {name:'Test 2',y:20,color:'blue'},
                   {name:'Test 3',y:40,color:'green'}]
        }]

Example:

Although, if you don’t have a really good reason for each bar to have a different color, it usually just adds an extra visual mess, and you better leave them in one color.

+4
source

Try the following:

xAxis: {
  categories: ['Test', 'Test', 'Test'],
  title: {
    text: null,
  }
},

And in the series:

series: [{
     name: 'Values',
     data: [20,20,40]
},]

Link .

Edition:

, . , :

series: [{
         name: 'Values',
         data: [20,0,0]
    },
{
         name: 'Values',
         data: [0,20,0]
    },
{
         name: 'Values',
         data: [0,0,40]
    },]
+1

http://jsfiddle.net/Jr79Y/35/

xAxis: {
            categories: ['Test1', 'Test2', 'Test3']
        }

For the series, this is pretty dirty, but it works:

series: [{
            name: 'Test1',
            data: [20, 0, 0]
        }, {
            name: 'Test2',
            data: [0, 20, 0]
        }, {
            name: 'Test3',
            data: [0, 0, 40]
        }
+1
source

check this

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        xAxis: {
            categories:['Test 1', 'Test 2', 'Test3']
        },
        plotOptions: {
            series: {
                dataLabels: {
                    enabled: true,
                }
                //colorByPoint: true
            },
             series: {
                colorByPoint: true
            }
        },
        legend: {
            layout: 'vertical',
            floating: true,
            backgroundColor: '#FFFFFF',
            align: 'right',
            verticalAlign: 'top',
            y: 60,
            x: -60
        },

        series: [{
            data: [40,20,20]
        }]
    });
});

http://jsfiddle.net/Jr79Y/36/

0
source

Source: https://habr.com/ru/post/1583747/


All Articles