generate new legend on dataset change

the chart's legend should be regenerated when the dataset changes (maybe as well when the options change, not sure)