source: node_modules/recharts/lib/state/selectors/polarScaleSelectors.js

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

Added visualizations

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[a762898]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.selectPolarGraphicalItemAxisTicks = exports.selectPolarCategoricalDomain = exports.selectPolarAxisTicks = exports.selectPolarAxisScale = exports.selectPolarAxis = exports.selectPolarAngleAxisTicks = void 0;
7var _reselect = require("reselect");
8var _axisSelectors = require("./axisSelectors");
9var _polarAxisSelectors = require("./polarAxisSelectors");
10var _chartLayoutContext = require("../../context/chartLayoutContext");
11var _polarSelectors = require("./polarSelectors");
12var _pickAxisType = require("./pickAxisType");
13var selectPolarAxis = (state, axisType, axisId) => {
14 switch (axisType) {
15 case 'angleAxis':
16 {
17 return (0, _polarAxisSelectors.selectAngleAxis)(state, axisId);
18 }
19 case 'radiusAxis':
20 {
21 return (0, _polarAxisSelectors.selectRadiusAxis)(state, axisId);
22 }
23 default:
24 {
25 throw new Error("Unexpected axis type: ".concat(axisType));
26 }
27 }
28};
29exports.selectPolarAxis = selectPolarAxis;
30var selectPolarAxisRangeWithReversed = (state, axisType, axisId) => {
31 switch (axisType) {
32 case 'angleAxis':
33 {
34 return (0, _polarAxisSelectors.selectAngleAxisRangeWithReversed)(state, axisId);
35 }
36 case 'radiusAxis':
37 {
38 return (0, _polarAxisSelectors.selectRadiusAxisRangeWithReversed)(state, axisId);
39 }
40 default:
41 {
42 throw new Error("Unexpected axis type: ".concat(axisType));
43 }
44 }
45};
46var selectPolarAxisScale = exports.selectPolarAxisScale = (0, _reselect.createSelector)([selectPolarAxis, _axisSelectors.selectRealScaleType, _polarSelectors.selectPolarAxisCheckedDomain, selectPolarAxisRangeWithReversed], _axisSelectors.combineScaleFunction);
47var selectPolarCategoricalDomain = exports.selectPolarCategoricalDomain = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, _polarSelectors.selectPolarAppliedValues, _axisSelectors.selectRenderableAxisSettings, _pickAxisType.pickAxisType], _axisSelectors.combineCategoricalDomain);
48var selectPolarAxisTicks = exports.selectPolarAxisTicks = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectPolarAxis, _axisSelectors.selectRealScaleType, selectPolarAxisScale, _polarSelectors.selectPolarNiceTicks, selectPolarAxisRangeWithReversed, _axisSelectors.selectDuplicateDomain, selectPolarCategoricalDomain, _pickAxisType.pickAxisType], _axisSelectors.combineAxisTicks);
49var selectPolarAngleAxisTicks = exports.selectPolarAngleAxisTicks = (0, _reselect.createSelector)([selectPolarAxisTicks], ticks => {
50 /*
51 * Angle axis is circular; so here we need to look for ticks that overlap (i.e., 0 and 360 degrees)
52 * and remove the duplicate tick to avoid rendering issues.
53 */
54 if (!ticks) {
55 return undefined;
56 }
57 var uniqueTicksMap = new Map();
58 ticks.forEach(tick => {
59 var normalizedCoordinate = (tick.coordinate + 360) % 360;
60 if (!uniqueTicksMap.has(normalizedCoordinate)) {
61 uniqueTicksMap.set(normalizedCoordinate, tick);
62 }
63 });
64 return Array.from(uniqueTicksMap.values());
65});
66var selectPolarGraphicalItemAxisTicks = exports.selectPolarGraphicalItemAxisTicks = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectPolarAxis, selectPolarAxisScale, selectPolarAxisRangeWithReversed, _axisSelectors.selectDuplicateDomain, selectPolarCategoricalDomain, _pickAxisType.pickAxisType], _axisSelectors.combineGraphicalItemTicks);
Note: See TracBrowser for help on using the repository browser.