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

181
Vistas
How to limit only one active slice per pie chart on amCharts5?

I am trying to replicate the pie chart behaviour from this v4 tutorial on amCharts v5 with no luck:

https://www.amcharts.com/docs/v4/tutorials/one-pulled-slice-per-pie-chart/

The v4 code does not work on v5 (nor getting error). I have debugged it and it loops through the slices, but there is no more "isActive" property, and have not found any other similar property or method to get or set the slice state.

I have already searched in offical docs but found nothing. Seems v5 is lacking some v4 features... anyone accomplished to limit only 1 selected slice per chart?

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

From official amCharts tutorial "One pulled slice per pie series":

... so whenever a slice is pulled out, it becomes "active" (it's "active" setting is set to true). And vice versa, setting it to false will make the slice pop back into its place.

Also, when a slice (or any other object for that matter) is clicked/tapped, it generates a "click" event. If there's an event handler defined, it is executed.

Let's use these two bits of code to implement our task:

series.slices.template.events.on("click", function(ev) {
  series.slices.each(function(slice) {
    if (slice != ev.target && slice.get("active")) {
      slice.set("active", false);
    }
  })
});

CodePen example: https://codepen.io/team/amcharts/pen/dyZzQLJ

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