Several points to optimize the interface:
- AddData* method changes lable automatically
This is problematic because the lable serves also as an identifier. By this implicit change the caller actually looses controll, because there is no feedback if the label was changed or not.
I think the label should be handled as a key in the map. So either if the same lable is used multiple times, one should overwrite (like update) or throw an excpetion because you are not allowed to overwrite an existing lable.
So I would propose the following:
void AddData[1D|2D]( ..., const std::string &label, ChartType chartType = ChartType::bar, bool allowUpdate = true);
If allowUpdate == true, the data will just overwrite existing lables (see UpdateLable). If it is false, it throws an exception if an existing label is reused.
- The documentation of AddData is not correct
- We should have a method to check if a lable is already used
bool HasExistingLabel (const std::string &label) const;