| [a762898] | 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.selectPolarGraphicalItemAxisTicks = exports.selectPolarCategoricalDomain = exports.selectPolarAxisTicks = exports.selectPolarAxisScale = exports.selectPolarAxis = exports.selectPolarAngleAxisTicks = void 0;
|
|---|
| 7 | var _reselect = require("reselect");
|
|---|
| 8 | var _axisSelectors = require("./axisSelectors");
|
|---|
| 9 | var _polarAxisSelectors = require("./polarAxisSelectors");
|
|---|
| 10 | var _chartLayoutContext = require("../../context/chartLayoutContext");
|
|---|
| 11 | var _polarSelectors = require("./polarSelectors");
|
|---|
| 12 | var _pickAxisType = require("./pickAxisType");
|
|---|
| 13 | var 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 | };
|
|---|
| 29 | exports.selectPolarAxis = selectPolarAxis;
|
|---|
| 30 | var 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 | };
|
|---|
| 46 | var selectPolarAxisScale = exports.selectPolarAxisScale = (0, _reselect.createSelector)([selectPolarAxis, _axisSelectors.selectRealScaleType, _polarSelectors.selectPolarAxisCheckedDomain, selectPolarAxisRangeWithReversed], _axisSelectors.combineScaleFunction);
|
|---|
| 47 | var selectPolarCategoricalDomain = exports.selectPolarCategoricalDomain = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, _polarSelectors.selectPolarAppliedValues, _axisSelectors.selectRenderableAxisSettings, _pickAxisType.pickAxisType], _axisSelectors.combineCategoricalDomain);
|
|---|
| 48 | var selectPolarAxisTicks = exports.selectPolarAxisTicks = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectPolarAxis, _axisSelectors.selectRealScaleType, selectPolarAxisScale, _polarSelectors.selectPolarNiceTicks, selectPolarAxisRangeWithReversed, _axisSelectors.selectDuplicateDomain, selectPolarCategoricalDomain, _pickAxisType.pickAxisType], _axisSelectors.combineAxisTicks);
|
|---|
| 49 | var 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 | });
|
|---|
| 66 | var selectPolarGraphicalItemAxisTicks = exports.selectPolarGraphicalItemAxisTicks = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectPolarAxis, selectPolarAxisScale, selectPolarAxisRangeWithReversed, _axisSelectors.selectDuplicateDomain, selectPolarCategoricalDomain, _pickAxisType.pickAxisType], _axisSelectors.combineGraphicalItemTicks); |
|---|