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