source: node_modules/recharts/es6/state/selectors/dataSelectors.js@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.8 KB
Line 
1import { createSelector } from 'reselect';
2/**
3 * This selector always returns the data with the indexes set by a Brush.
4 * Trouble is, that might or might not be what you want.
5 *
6 * In charts with Brush, you will sometimes want to select the full range of data, and sometimes the one decided by the Brush
7 * - even if the Brush is active, the panorama inside the Brush should show the full range of data.
8 *
9 * So instead of this selector, consider using either selectChartDataAndAlwaysIgnoreIndexes or selectChartDataWithIndexesIfNotInPanorama
10 *
11 * @param state RechartsRootState
12 * @returns data defined on the chart root element, such as BarChart or ScatterChart
13 */
14export var selectChartDataWithIndexes = state => state.chartData;
15
16/**
17 * This selector will always return the full range of data, ignoring the indexes set by a Brush.
18 * Useful for when you want to render the full range of data, even if a Brush is active.
19 * For example: in the Brush panorama, in Legend, in Tooltip.
20 */
21export var selectChartDataAndAlwaysIgnoreIndexes = createSelector([selectChartDataWithIndexes], dataState => {
22 var dataEndIndex = dataState.chartData != null ? dataState.chartData.length - 1 : 0;
23 return {
24 chartData: dataState.chartData,
25 computedData: dataState.computedData,
26 dataEndIndex,
27 dataStartIndex: 0
28 };
29});
30export var selectChartDataWithIndexesIfNotInPanoramaPosition4 = (state, _unused1, _unused2, isPanorama) => {
31 if (isPanorama) {
32 return selectChartDataAndAlwaysIgnoreIndexes(state);
33 }
34 return selectChartDataWithIndexes(state);
35};
36export var selectChartDataWithIndexesIfNotInPanoramaPosition3 = (state, _unused1, isPanorama) => {
37 if (isPanorama) {
38 return selectChartDataAndAlwaysIgnoreIndexes(state);
39 }
40 return selectChartDataWithIndexes(state);
41};
Note: See TracBrowser for help on using the repository browser.