code: def calculateDatasetItems(self, scene, datasets):
          
          dataitems = scene.datasetItems()
          olditems = set(dataitems.keys()).difference(datasets)
          newitems = set(datasets).difference(dataitems.keys())
          
          for dataset in olditems:
              scene.removeItem(dataitems[dataset])
          
          for dataset in newitems:
              dataitems[dataset] = scene.addDataset(dataset)
          
          return dataitems
docs: Syncs the scene together with the given datasets to make sure we
          have the proper number of items, by removing non-existant datasets
          and adding new ones.
          
          :param      scene    | <XChartScene>
                      datasets | <XChartDataset>
          
          :return     {<XChartDataset>: <XChartDatasetItem>, ..}