Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

354
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda