@mui/x-charts
Version:
The community edition of MUI X Charts components.
31 lines (28 loc) • 2 kB
JavaScript
import { createSelectorMemoized, createSelector } from '@mui/x-internals/store';
import { applySeriesLayout, applySeriesProcessors } from "./processSeries.js";
import { selectorChartDrawingArea } from "../useChartDimensions/index.js";
import { selectorIsItemVisibleGetter } from "../../featurePlugins/useChartVisibilityManager/index.js";
export const selectorChartSeriesState = state => state.series;
export const selectorChartDefaultizedSeries = createSelector(selectorChartSeriesState, seriesState => seriesState.defaultizedSeries);
export const selectorChartSeriesConfig = createSelector(selectorChartSeriesState, seriesState => seriesState.seriesConfig);
/**
* Get the dataset from the series state.
* @returns {DatasetType | undefined} The dataset.
*/
export const selectorChartDataset = createSelector(selectorChartSeriesState, seriesState => seriesState.dataset);
/**
* Get the processed series after applying series processors.
* This selector computes the processed series on-demand from the defaultized series.
* @returns {ProcessedSeries} The processed series.
*/
export const selectorChartSeriesProcessed = createSelectorMemoized(selectorChartDefaultizedSeries, selectorChartSeriesConfig, selectorChartDataset, selectorIsItemVisibleGetter, function selectorChartSeriesProcessed(defaultizedSeries, seriesConfig, dataset, isItemVisible) {
return applySeriesProcessors(defaultizedSeries, seriesConfig, dataset, identifier => isItemVisible(seriesConfig, identifier));
});
/**
* Get the processed series after applying series processors.
* This selector computes the processed series on-demand from the defaultized series.
* @returns {ProcessedSeries} The processed series.
*/
export const selectorChartSeriesLayout = createSelectorMemoized(selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartDrawingArea, function selectorChartSeriesLayout(processedSeries, seriesConfig, drawingArea) {
return applySeriesLayout(processedSeries, seriesConfig, drawingArea);
});