source: node_modules/recharts/lib/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: 2.4 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.selectChartDataWithIndexesIfNotInPanoramaPosition4 = exports.selectChartDataWithIndexesIfNotInPanoramaPosition3 = exports.selectChartDataWithIndexes = exports.selectChartDataAndAlwaysIgnoreIndexes = void 0;
7var _reselect = require("reselect");
8/**
9 * This selector always returns the data with the indexes set by a Brush.
10 * Trouble is, that might or might not be what you want.
11 *
12 * In charts with Brush, you will sometimes want to select the full range of data, and sometimes the one decided by the Brush
13 * - even if the Brush is active, the panorama inside the Brush should show the full range of data.
14 *
15 * So instead of this selector, consider using either selectChartDataAndAlwaysIgnoreIndexes or selectChartDataWithIndexesIfNotInPanorama
16 *
17 * @param state RechartsRootState
18 * @returns data defined on the chart root element, such as BarChart or ScatterChart
19 */
20var selectChartDataWithIndexes = state => state.chartData;
21
22/**
23 * This selector will always return the full range of data, ignoring the indexes set by a Brush.
24 * Useful for when you want to render the full range of data, even if a Brush is active.
25 * For example: in the Brush panorama, in Legend, in Tooltip.
26 */
27exports.selectChartDataWithIndexes = selectChartDataWithIndexes;
28var selectChartDataAndAlwaysIgnoreIndexes = exports.selectChartDataAndAlwaysIgnoreIndexes = (0, _reselect.createSelector)([selectChartDataWithIndexes], dataState => {
29 var dataEndIndex = dataState.chartData != null ? dataState.chartData.length - 1 : 0;
30 return {
31 chartData: dataState.chartData,
32 computedData: dataState.computedData,
33 dataEndIndex,
34 dataStartIndex: 0
35 };
36});
37var selectChartDataWithIndexesIfNotInPanoramaPosition4 = (state, _unused1, _unused2, isPanorama) => {
38 if (isPanorama) {
39 return selectChartDataAndAlwaysIgnoreIndexes(state);
40 }
41 return selectChartDataWithIndexes(state);
42};
43exports.selectChartDataWithIndexesIfNotInPanoramaPosition4 = selectChartDataWithIndexesIfNotInPanoramaPosition4;
44var selectChartDataWithIndexesIfNotInPanoramaPosition3 = (state, _unused1, isPanorama) => {
45 if (isPanorama) {
46 return selectChartDataAndAlwaysIgnoreIndexes(state);
47 }
48 return selectChartDataWithIndexes(state);
49};
50exports.selectChartDataWithIndexesIfNotInPanoramaPosition3 = selectChartDataWithIndexesIfNotInPanoramaPosition3;
Note: See TracBrowser for help on using the repository browser.