0
votes

I'm using highcharts to display stackbars graph. I'd the y axis label to appear on top of the y axis, that's why I'm setting its offset to -10. however, when the graph's title is not displayed I cannot see the axis label.

Here's an example with graph title and axis title

Here's an example without graph title and from some reason axis title disappears

Here's how I set my yAxis label:

 yAxis: {
        lineWidth: 2,
        tickWidth: 1,
        title: {
            align: 'high',
            offset: 0,
            text: 'Rainfall (mm)',
            rotation: 0,
            y: -20
        }
    },
1
Rainfall text display in jsdiddleZubair sadiq
you are right, updated question.vondip
yaxis label disappear because you set y=-10 it so above the screen set y=0 label will display on top "margin of title text 0 without title so -10 value set out of screen"Zubair sadiq
but notice that when you show the title it does appear.vondip
because of title marginZubair sadiq

1 Answers

2
votes

updated Link

$(function () {
$('#container').highcharts({

    chart: {
        type: 'column',
        margin: [70, 0]
    },
    title: {
        text: ''
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    yAxis: {
        lineWidth: 1,
        tickWidth: 1,
        title: {
            align: 'high',
            offset: 0,
            text: 'Rainfall (mm)',
            rotation: 0,
            y: -10
        }
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]

});
});

margin: [70, 0]