def toggleDataset(self, state, dataset=None):
        """
        Toggles the dataset based on the given action or dataset.
        
        :param      state | <bool>
                    dataset | <XChartDataset>
        """
        if dataset is None and self.sender():
            dataset = unwrapVariant(self.sender().data())
        
        dataset.setVisible(state)
        self._dataChanged = True
        self.recalculate()
Toggles the dataset based on the given action or dataset.
        
        :param      state | <bool>
                    dataset | <XChartDataset>