Anirudh Reddy
Anirudh Reddy

Reputation: 11

Move series on the forefront in highchart (z-index)

I have 2 series on my graph:

My problem is that some values of my line series are hidden by the column series (the histogram cuts off line graph whenever there is a merge of the two graphs).

How could I be sure line graph is on the forefront?

Upvotes: 0

Views: 141

Answers (1)

IsraGab
IsraGab

Reputation: 5185

Use the z-index attribute:

example:

$(function () {
    $('#container').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },

        plotOptions: {
            series: {
                lineWidth: 5
            }
        },

        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],
            type: 'column',
            color: 'blue',
            zIndex: 1
        }, {
            data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5],
            color: 'yellow',
            zIndex: 2
        }]
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<script src="http://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>

Upvotes: 1

Related Questions