UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

14 lines (13 loc) 749 B
export const typeSerializer = type => `Type(${type})`; export const seriesIdSerializer = id => `Series(${id})`; export const dataIndexSerializer = dataIndex => dataIndex === undefined ? '' : `Index(${dataIndex})`; /** * Serializes an identifier using type, seriesId, and dataIndex properties. * * The generic constraint ensures this can only be used for series types whose * identifier actually includes `dataIndex`. Series types with different identifier * properties (like heatmap's xIndex/yIndex) must provide their own serializer. */ export const identifierSerializerSeriesIdDataIndex = identifier => { return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}${dataIndexSerializer(identifier.dataIndex)}`; };