I'm trying to create a radial gauge using kendo react ui. Range colour should have a linear gradient like a rainbow. But as far as I find it allows only colours for different ranges. Is there any workaround for it? My code is:
import * as React from "react";
import * as ReactDOM from "react-dom";
import "./style.css";
import { RadialGauge } from "@progress/kendo-react-gauges";
const Progress = () => {
const radialOptions = {
rangeSize: 60,
startAngle: 0,
endAngle: 180,
pointer: [
{
value: 10,
color: "blue",
cap: {
size: 0.19,
},
length: 1,
},
],
};
const { rangeSize, startAngle, endAngle } = radialOptions;
return (
<div>
<RadialGauge
pointer={{
value: 60,
color: "#0058e9",
cap: {
size: 0.2,
},
length: 1.5,
}}
transitions={true}
scale={{
rangeSize,
startAngle,
endAngle,
ranges: [
{
from: 0,
to: 100,
color: "red",
},
],
}}
/>
</div>
);
};
export default Progress;
Documentation for the range colors: https://docs.telerik.com/kendo-ui/knowledge-base/gauge-radial-style-color-range
I tried manipulate the css for the svg file to apply the gradient.
You can create an invisible SVG element on your page which defines the linear gradients and names them. Then in the gauge, you can set the range colors to those gradients using url(#gradientname).
E.g.
then initialize the ranges:
DEMO
However, the gradient just goes from left to right, it does not follow the arc. For that you might have to look at something like this: https://github.com/cereallarceny/gradient-path