Code: Select all
(function(H) {
H.wrap(H.seriesTypes.pie.prototype, 'animate', function(proceed, init) {
var series = this,
points = series.points,
startAngleRad = series.startAngleRad;
if (!init) {
points.forEach(function(point) {
var graphic = point.graphic,
args = point.shapeArgs;
if (graphic) {
// start values
graphic.attr({
// animate from inner radius (#779)
r: args.r || (series.center[3] / 2),
start: startAngleRad,
end: startAngleRad
});
// animate
graphic.animate({
r: args.r,
start: args.start,
end: args.end
}, series.options.animation);
}
});
// delete this function to allow it only once
series.animate = null;
}
})
})(Highcharts)
Code: Select all
class PieChart extends React.Component {
render() {
const val = {
option: {
chart: [{
type: 'pie',
}],
series: [{
data: [5, 3, 7]
}],
},
};
return (
<Chart {...val} />
)
}
}
Code: Select all
var Highcharts = require("highcharts");
rafalS wrote: ↑Tue Mar 05, 2019 4:07 pm Something like this?
https://jsfiddle.net/BlackLabel/me32cf1u
The idea is to wrap the animate method:Best regards!Code: Select all
(function(H) { H.wrap(H.seriesTypes.pie.prototype, 'animate', function(proceed, init) { var series = this, points = series.points, startAngleRad = series.startAngleRad; if (!init) { points.forEach(function(point) { var graphic = point.graphic, args = point.shapeArgs; if (graphic) { // start values graphic.attr({ // animate from inner radius (#779) r: args.r || (series.center[3] / 2), start: startAngleRad, end: startAngleRad }); // animate graphic.animate({ r: args.r, start: args.start, end: args.end }, series.options.animation); } }); // delete this function to allow it only once series.animate = null; } }) })(Highcharts)
Code: Select all
setInterval()
dawid.d wrote: ↑Mon Mar 27, 2023 2:57 pm Hi pouyababaie,
Welcome to our forum and thanks for contacting us with your question!
The animate method takes a callback as the third argument, which is called after the animation is finished. You can loop this animation like this, see the demo below.
API: https://api.highcharts.com/class-refere ... nt#animate
Demo: https://jsfiddle.net/BlackLabel/3c7b41su/
I hope you will find it useful
Best regards!