Guian
Guian

Reputation: 4689

Highchart - set a line style ( width, color...) on selection

using Highchart I'd like to select series by clicking on it and change its width on selection ( so we can see it is selected)

the thing is, the selection seems to work (it toggles the selected value displayed in console) but I can't figure out how I can set a lineWidth from the click event :

the example is working to select series :

line: {
    events: {
        click: function(event) {

            this.select();
                        console.log( this.name+", selected : "+ this.selected);
            return false;
        }
    }
}

I can also show / hide series, but how can I change the lineWidth ? I managed to display the tooltip only for selected series, but I need those series to be more visible than the others.

I've tried to add a select state on the series as it works on markers but it doesn't seem to work for lines :

                series: {
                    states: {
                            select: {

                                lineWidth: 10
                            }
                    },
                             ...
                }

Upvotes: 1

Views: 2334

Answers (1)

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

Use setState instead.

this.setState(this.state === 'select' ? '' : 'select');

Demo

Upvotes: 1

Related Questions