devextreme-reactive
devextreme-reactive copied to clipboard
getter function for Chart instead of only the field name
I'm using ...
- [ ] React Grid
- [x] React Chart
- [ ] React Scheduler
Description
At the moment, for the Chart, providing access to a value in the Chart can only be done by giving the property name like the following:
export const nameof = <T>(name: Extract<keyof T, string>): string => name;
<LineSeries
name="Military"
valueField={nameof<IMyRow>("military")}
argumentField={nameof<IMyRow>("year")}/>
It would be great if the following would be possible as well, like it is already possible in your grid component:
<LineSeries
name="Military"
valueField={(row: IMyRow)=>row.military}
argumentField={(row: IMyRow)=>row.year}/>
This would permit to benefit typescript type check at compile time out of the box, and not being compelled to run an expensive complete rebuild of the datasouce because some value is a bit less simple than a property value retrieval on the rows.
After quick investigation in your source code, one of the main changes to do are here:
https://github.com/DevExpress/devextreme-reactive/blob/ba6cf211272fb3c553e7bce1213d59802ea46121/packages/dx-chart-core/src/plugins/series/computeds.ts#L232-L233
and here:
https://github.com/DevExpress/devextreme-reactive/blob/ba6cf211272fb3c553e7bce1213d59802ea46121/packages/dx-chart-core/src/types/plugins.series.types.ts#L91-L94
Hi @paillave Thank you for your interest in our product. We will consider implementing this feature in the future.