greetclock / angular-gauge-chart

Angular Gauge Chart
https://recogizer.github.io/gauge-chart/examples/samples/
MIT License
61 stars 41 forks source link

arcColor #80

Open ShitalUnde opened 2 years ago

ShitalUnde commented 2 years ago

arcColors: ['linear-gradient(red,yellow,orange)'],

its not working

djungowski commented 2 years ago

That is because it's not a color per se and gradients in SVG work differently, see this Stackoverflow post for reference

The gauge-chart code itself does this:

    let innerArc = svg
      .append('path')
      .attr('d', gaugeArc)
      .attr('fill', color)
      .attr(
        'transform',
        'translate(' +
          (chartHeight + offset * 2) +
          ', ' +
          (chartHeight + offset) +
          ')',
      )

fill itself takes a <paint> type as param, see this MDN page for reference (also follow the link to the paint definition, there you'll see what you can actually pass to fill).

I do not have a solution right now, as I'm struggling with the exact same problem 😅