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

261
Vistas
Is it possible to make a multi-color highlight arc in Sigma.js?

I'm trying to implement my own hoverRenderer to make the highlight ring have multiple colors. So I took the drawHover in src/rendering/canvas/hover.ts line 58 and replaced

context.arc(data.x, data.y, data.size + PADDING, 0, Math.PI * 2);
context.closePath();
context.fill();

with

        const [fillStart, fillEnd, fillRadius] = [0, Math.PI * 2, data.size + PADDING];
        // compute segment arc radian
        const arcRadian = (fillEnd - fillStart) / data.highlightColor.length;

        // draw the highlight ring/arc in different colors specified in highlightColor
        for (let index = 0; index < data.highlightColor.length; index++) {
            context.arc(
                data.x,
                data.y,
                fillRadius + 5,
                fillStart,
                fillStart + arcRadian
            );
            context.fillStyle = data.highlightColor[index];
            context.fill();
            fillStart += arcRadian;
        }
        context.closePath();

Even though my data.highlightColor was set to ['#FF2301', '#D53032', '#2F4538'], the arc I got was still single colored. This post has a similar implementation and achieves the effect I want. Is there any restriction imposed by Sigma that prevents this?

enter image description here

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

0

It turns out beginPath is required in each drawing. The following should work

        for (let index = 0; index < data.highlightColor.length; index++) {
            context.beginPath();
            context.arc(
                data.x,
                data.y,
                fillRadius + 5,
                fillStart,
                fillStart + arcRadian
            );
            context.fillStyle = data.highlightColor[index];
            context.fill();
            fillStart += arcRadian;
        }
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