MCPcopy
hub / github.com/chartjs/Chart.js / updateElements

Method updateElements

src/controllers/controller.doughnut.js:253–291  ·  view source on GitHub ↗
(arcs, start, count, mode)

Source from the content-addressed store, hash-verified

251 }
252
253 updateElements(arcs, start, count, mode) {
254 const reset = mode === 'reset';
255 const chart = this.chart;
256 const chartArea = chart.chartArea;
257 const opts = chart.options;
258 const animationOpts = opts.animation;
259 const centerX = (chartArea.left + chartArea.right) / 2;
260 const centerY = (chartArea.top + chartArea.bottom) / 2;
261 const animateScale = reset && animationOpts.animateScale;
262 const innerRadius = animateScale ? 0 : this.innerRadius;
263 const outerRadius = animateScale ? 0 : this.outerRadius;
264 const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
265 let startAngle = this._getRotation();
266 let i;
267
268 for (i = 0; i < start; ++i) {
269 startAngle += this._circumference(i, reset);
270 }
271
272 for (i = start; i < start + count; ++i) {
273 const circumference = this._circumference(i, reset);
274 const arc = arcs[i];
275 const properties = {
276 x: centerX + this.offsetX,
277 y: centerY + this.offsetY,
278 startAngle,
279 endAngle: startAngle + circumference,
280 circumference,
281 outerRadius,
282 innerRadius
283 };
284 if (includeOptions) {
285 properties.options = sharedOptions || this.resolveDataElementOptions(i, arc.active ? 'active' : mode);
286 }
287 startAngle += circumference;
288
289 this.updateElement(arc, i, properties, mode);
290 }
291 }
292
293 calculateTotal() {
294 const meta = this._cachedMeta;

Callers 1

updateMethod · 0.95

Calls 5

_getRotationMethod · 0.95
_circumferenceMethod · 0.95
_getSharedOptionsMethod · 0.80
updateElementMethod · 0.80

Tested by

no test coverage detected