Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 9e066b1

Browse files
committed
add comments
1 parent 5b5eb19 commit 9e066b1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/plugin/hierarchical.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ const HierarchicalPlugin = {
6666
return null;
6767
},
6868

69+
/**
70+
* checks whether the data has been changed by the user and all caches are invalid
71+
* @param {*} chart
72+
*/
6973
_check(chart) {
7074
if (chart.data.labels && chart.data._verify === generateCode(chart.data.labels)) {
7175
return;
@@ -91,6 +95,10 @@ const HierarchicalPlugin = {
9195
this._updateAttributes(chart);
9296
},
9397

98+
/**
99+
* a verify code is used to recognize when the user changes the data
100+
* @param {*} chart
101+
*/
94102
_updateVerifyCode(chart) {
95103
chart.data._verify = generateCode(chart.data.labels);
96104
},
@@ -356,6 +364,7 @@ const HierarchicalPlugin = {
356364
const flatLabels = chart.data.flatLabels;
357365
const data = chart.data.datasets;
358366

367+
// use splice since Chart.js is tracking the array using this method to have a proper animation
359368
const removed = labels.splice.apply(labels, [index, count].concat(toAdd));
360369
removed.forEach((d) => {
361370
d.hidden = true;

0 commit comments

Comments
 (0)