charts icon indicating copy to clipboard operation
charts copied to clipboard

Add a slot for custom object on 'DataSeries' class in Vaadin Charts 2.

Open vaadin-bot opened this issue 9 years ago • 1 comments

Originally by basil.bourque


It would be nice if the Vaadin Charts 2 class 'DataSeries' had an extra slot for application-specific data.

I need to use this as an identifier to see which DataSeries is which in a Chart. I am writing generic code to help update many charts with many DataSeries lines with many sources of data. So I need to match each source of data to its relevant DataSeries.

Currently the only thing close to this is the get/setName method on DataSeries. But that value is used for the titling in the Legend. So that name value may be localized, or may change over time depending on specifications. So this is not reliable as an identifier to in my programming code.

All Vaadin components (subclasses of AbstractComponent offer the setData method where we app developers can place any object we want. DataSeries should have the same kind of slot to hold any subclass of Object.

No good workarounds. One option is for me to create a subclass of DataSeries to add an 'Object' member var. That option means having to cast down to the subclass repeatedly. Another option is creating an external data structure like a Map to track which DataSeries instance is which. But what a bulky overhead to add, making it more complicated to add and drop various charts and DataSeries instances.


Imported from https://dev.vaadin.com/ issue #16278

vaadin-bot avatar Jan 18 '15 19:01 vaadin-bot

Originally by basil.bourque


'DataSeriesItem' Has Such A Data-Slot

I noticed that the DataSeriesItem class offers a pair of getId & setId methods. That pair of methods seems to offer the same kind of slot for application specific data that I am requesting for the DataSeries class.

vaadin-bot avatar Jan 19 '15 23:01 vaadin-bot