Ray
Ray

Reputation: 2728

Highcharts Broken Line / Line Segment

Is there a way to have multiple line segments treated as 1 line? IE: I hover over one, both get highlighted, and toggling the visibility in the legend will hide both segments.

http://jsfiddle.net/rayholland/HSvBj/2/

series: [
    {
        type: 'line',
        data: [{x:0,y:0},{x:1,y:1}],
        events: {
            legendItemClick: function(event) {
                this.visible? 
                    this.chart.get('group1').hide():
                    this.chart.get('group1').show();
            }
        }
    },{
        type: 'line',
        data: [{x:3,y:1},{x:4,y:0}],
        showInLegend: false,
        id: 'group1'
    }
]

Upvotes: 2

Views: 1747

Answers (1)

Ray
Ray

Reputation: 2728

I think if I treat it as 1 line but then have a null value in the middle as a separator it will work. http://jsfiddle.net/rayholland/HSvBj/4/

data: [{x:0,y:0},{x:1,y:1},{x:null,y:null},{x:3,y:1},{x:4,y:0}]

Upvotes: 5

Related Questions