Abbas
Abbas

Reputation: 3274

Change color of selected point in HighCharts dynamically

I have a scatter chart in which I have some points plotted in different colors based on some condition. When I select a point, the color of that point changes to white by default. I need to retain the color of the selected point as the outer color and inner color could be anything, even white is ok.

I have tried this piece of code to start with,but it doesn't work, kindly help me out as I am not very familiar with highcharts. In this code I am trying to set the selected points line color to green.

plotOptions: {
                series: {
                    cropThreshold: maxCropThreshold,
                    allowPointSelect: true,
                    point: {
                        events: {
                            select: function (e) {
                                mychart.options.plotOptions.series.marker.states.select.lineColor="green";
                            },
                            unselect: function(){
                            }
                        }
                    },

Upvotes: 0

Views: 2227

Answers (1)

Abbas
Abbas

Reputation: 3274

Using the below code, i was able to get it work

point: {
                        events: {
                            select: function (e) {
                            //to update line color
                                       this.update({
                        marker: {
                            states: {
                                select:{
                                    lineWidth: 1.5,
                                    lineColor: this.color
                                }
                            }
                        }
                    }, true);
}

Upvotes: 2

Related Questions