| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.selectChartDataWithIndexesIfNotInPanoramaPosition4 = exports.selectChartDataWithIndexesIfNotInPanoramaPosition3 = exports.selectChartDataWithIndexes = exports.selectChartDataAndAlwaysIgnoreIndexes = void 0;
|
|---|
| 7 | var _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 | */
|
|---|
| 20 | var 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 | */
|
|---|
| 27 | exports.selectChartDataWithIndexes = selectChartDataWithIndexes;
|
|---|
| 28 | var 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 | });
|
|---|
| 37 | var selectChartDataWithIndexesIfNotInPanoramaPosition4 = (state, _unused1, _unused2, isPanorama) => {
|
|---|
| 38 | if (isPanorama) {
|
|---|
| 39 | return selectChartDataAndAlwaysIgnoreIndexes(state);
|
|---|
| 40 | }
|
|---|
| 41 | return selectChartDataWithIndexes(state);
|
|---|
| 42 | };
|
|---|
| 43 | exports.selectChartDataWithIndexesIfNotInPanoramaPosition4 = selectChartDataWithIndexesIfNotInPanoramaPosition4;
|
|---|
| 44 | var selectChartDataWithIndexesIfNotInPanoramaPosition3 = (state, _unused1, isPanorama) => {
|
|---|
| 45 | if (isPanorama) {
|
|---|
| 46 | return selectChartDataAndAlwaysIgnoreIndexes(state);
|
|---|
| 47 | }
|
|---|
| 48 | return selectChartDataWithIndexes(state);
|
|---|
| 49 | };
|
|---|
| 50 | exports.selectChartDataWithIndexesIfNotInPanoramaPosition3 = selectChartDataWithIndexesIfNotInPanoramaPosition3; |
|---|