Is anyone else having issues with horrible performance when rendering multiple charts at the same time? I have a list of 14 charts with 5 rings and it's loading like the GIF shows?
Doesn't seem right? I'm also using it inside a React app. See code.
// @flow
import React from 'react';
import RadialProgressChart from 'radial-progress-chart';
type Series = {
labelStart: string,
value: number
};
const keyAreaShortCuts: [string, string, string, string, string] = [
'D',
'M',
'C',
'Ti',
'Ta'
];
const initialChartData: Array<Series> = keyAreaShortCuts.map(ka => ({
labelStart: ka,
value: Math.round(Math.random() * 60) + 20,
color: {
linearGradient: {
x1: '0%',
y1: '100%',
x2: '50%',
y2: '0%',
spreadMethod: 'pad'
},
stops: [
{
offset: '0%',
'stop-color': '#fe08b5',
'stop-opacity': 1
},
{
offset: '100%',
'stop-color': '#ff1410',
'stop-opacity': 1
}
]
}
}));
type Props = {
teamId: number
};
function RingChart(props: Props): React$Node {
const chartRef = React.useRef(null);
const chartClass: string = `activityChart-${props.teamId}`;
React.useLayoutEffect(() => {
chartRef.current = new RadialProgressChart(`.${chartClass}`, {
series: initialChartData
});
}, [chartClass]);
return <div className={chartClass} />;
}
RingChart.defaultProps = {
teamId: 0
};
export default React.memo(RingChart);