score:2

Accepted answer

Running your JSFiddle and changing to "Option B" and back to "Option A" does nothing simply because there is no change to the data. Both options (in the case of "Option C" and "Option E") set the data to the exact same values as the values that are present when the chart is created.

If you instead run the JSFiddle, set "Option D" and "Option F" before you start switching between "Option A" and "Option B" you will see that the code is clearly working as intended.

This can be confirmed by changing any one number in this if-branch:

if (selVal == "a" && selValB == "a" && selValBB == "a") { ...

And/or this else if-branch:

else if (selVal == "b" && selValB == "a" && selValBB == "a") { ...

As shown in this JSFiddle example, which has only changed two numbers in the described cases.

That being said, this clearly illustrates that this code needs to be tidied up.


Related Query

More Query from same tag