I am trying to toggle data set visibility from outside of my chart. Using setDatasetVisibility to explicitly set viability works fine with two buttons, one to set it to true and the other to false.
While setDatasetVisibility will indeed hide and show the data set, getDatasetVisibility continues to return true regardless of the current visibility.
The toggleDatasetVisibility method doesn't hide anything, but it does change the state of getDatasetVisibility which now returns the correct value.
Why is it that in order to make this work I need to do something like this? I would expect toggleDataVisibility to be sufficient.
lineChart.toggleDataVisibility(1);
lineChart.setDatasetVisibility(1, lineChart.getDataVisibility(1));
lineChart.update();