user1400915
user1400915

Reputation: 1943

Changing the styles of a label of plotLines in HighChart

In this example http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/xaxis/plotlines-label-align-right/

the label "Plot Line" is on the right side . My aim is to make it to the left and give some gap from the margin .

This is what I have tried .

yAxis: {
        plotLines: [{
            color: 'red',
            width: 2,
            value: 100,
            label: {
                text: 'Plot line',
                align: 'left',
                x: -10,
                style: {
                            color: "green",
                            marginLeft: 4,
                            fontSize: "8px"
                        }
            }
        }]
    }

Even though the label moves to left , the marginLeft or paddingLeft doesnt seem to work . How do I place the label 4px from left?

Upvotes: 0

Views: 308

Answers (1)

Chirag Ravindra
Chirag Ravindra

Reputation: 4830

You can do that by setting x to 4

yAxis: {
    plotLines: [{
        color: 'red',
        width: 2,
        value: 100,
        label: {
            text: 'Plot line',
            align: 'left',
            x: 4
        }
    }]
}

x appears to be the horizontal offset from the starting position as defined by align for the label

Upvotes: 2

Related Questions