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

256
Views
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 answers
Answer question

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 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!