Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

352
Views
Highcharts - Always keep hover state on single slice

This may be challenging. So my goal is to have the first largest slice always in a hover state if other slices aren't hovered. Hovered meaning other slices faded and halo on the hovered. I have added code that adds the tooltip in the middle of the doughnut chart and to shows the first slices tooltip on mouse out and load. I keep the tooltip there by using the tooltip delay trick. I am almost finished but can't figure out how to keep the halo on the slice and the other slices faded. This may have sounded confusing but hopefully these images of what I want can help.

one speed bump is that the environment that I'm putting this in wont allow me to use css or functions outside of the main highcharts function. That's why all the functions are inside.

https://jsfiddle.net/sabdorhx/1/

    events: {
  load: function() {
    var chart = this,
      legend = chart.legend,
      point = chart.series.chart;

    // starte with first slice hovered
    chart.series[0].points[0].onMouseOver();

    // Legend hover show tooltip
    for (var i = 0, len = legend.allItems.length; i < len; i++) {
      (function(i) {

        var item = legend.allItems[i].legendItem;
        item.on('mouseover', function(e) {
          //show custom tooltip here
          chart.tooltip.refresh(chart.series[0].points[i]);

        }).on('mouseout', function(e) {
          //show first slice tooltip on mouse out
          chart.tooltip.refresh(chart.series[0].points[0]);
        });
      })(i);
    }
  },
}

_

series: {
  events: {
    mouseOut: function() {
    //mouse out of slice and show first slice
      this.points[0].onMouseOver();
    },
  },

enter image description here enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The set hover state is overwritten in setState series method which is called later. In your case the function is redundant, so you can overwrite it:

Highcharts.Series.prototype.setState = function(){};

Live demo: https://jsfiddle.net/BlackLabel/z2fqre5d/

API Reference: https://api.highcharts.com/class-reference/Highcharts.Point#onMouseOver

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!