Manu K Mohan
Manu K Mohan

Reputation: 833

Highcharts: Add plotlines to legend

I am trying to add plotline to legend. Here is my example http://jsfiddle.net/y6yvqtdv/

$('#container').highcharts({
    xAxis: {
        tickInterval: 24 * 3600 * 1000,
        // one day
        type: 'datetime'
    },
    yAxis: {
        plotLines: [{ // mark the weekend
            color: 'green',
            width: 3,
            value: 250,
            dashStyle: 'dash'
        }]
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4],
        pointStart: Date.UTC(2010, 0, 1),
        pointInterval: 24 * 3600 * 1000
    }]
});

How can I add green dashed line to the existing graphs legend?

Upvotes: 2

Views: 1568

Answers (1)

Ankur Bajaj
Ankur Bajaj

Reputation: 153

I had the same problem and Solved it by

1) Defining the min and max values for the x Axis 2) Plotting a new series with values less than min and greater than max 3) Give it a color and remove the labels

I tried changing your fiddle but was not able to demonstrate , but it has worked for me. Let me know if it worked for you or if you need more information

Upvotes: 0

Related Questions