UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

38 lines (37 loc) 974 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; const getColor = (series, xAxis, yAxis) => { const yColorScale = yAxis?.colorScale; const xColorScale = xAxis?.colorScale; if (yColorScale) { return dataIndex => { if (dataIndex === undefined) { return series.color; } const value = series.data[dataIndex]; const color = value === null ? series.color : yColorScale(value); if (color === null) { return series.color; } return color; }; } if (xColorScale) { return dataIndex => { if (dataIndex === undefined) { return series.color; } const value = xAxis.data?.[dataIndex]; const color = value === null ? series.color : xColorScale(value); if (color === null) { return series.color; } return color; }; } return () => series.color; }; var _default = exports.default = getColor;