source: node_modules/recharts/lib/state/selectors/radarSelectors.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: 5.7 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.selectRadiusAxisForBandSize = exports.selectRadarPoints = exports.selectAngleAxisWithScaleAndViewport = exports.selectAngleAxisForBandSize = void 0;
7var _reselect = require("reselect");
8var _Radar = require("../../polar/Radar");
9var _polarScaleSelectors = require("./polarScaleSelectors");
10var _polarAxisSelectors = require("./polarAxisSelectors");
11var _dataSelectors = require("./dataSelectors");
12var _chartLayoutContext = require("../../context/chartLayoutContext");
13var _ChartUtils = require("../../util/ChartUtils");
14var _polarSelectors = require("./polarSelectors");
15function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20var selectRadiusAxisScale = (state, radiusAxisId) => (0, _polarScaleSelectors.selectPolarAxisScale)(state, 'radiusAxis', radiusAxisId);
21var selectRadiusAxisForRadar = (0, _reselect.createSelector)([selectRadiusAxisScale], scale => {
22 if (scale == null) {
23 return undefined;
24 }
25 return {
26 scale
27 };
28});
29var selectRadiusAxisForBandSize = exports.selectRadiusAxisForBandSize = (0, _reselect.createSelector)([_polarAxisSelectors.selectRadiusAxis, selectRadiusAxisScale], (axisSettings, scale) => {
30 if (axisSettings == null || scale == null) {
31 return undefined;
32 }
33 return _objectSpread(_objectSpread({}, axisSettings), {}, {
34 scale
35 });
36});
37var selectRadiusAxisTicks = (state, radiusAxisId, _angleAxisId, isPanorama) => {
38 return (0, _polarScaleSelectors.selectPolarAxisTicks)(state, 'radiusAxis', radiusAxisId, isPanorama);
39};
40var selectAngleAxisForRadar = (state, _radiusAxisId, angleAxisId) => (0, _polarAxisSelectors.selectAngleAxis)(state, angleAxisId);
41var selectPolarAxisScaleForRadar = (state, _radiusAxisId, angleAxisId) => (0, _polarScaleSelectors.selectPolarAxisScale)(state, 'angleAxis', angleAxisId);
42var selectAngleAxisForBandSize = exports.selectAngleAxisForBandSize = (0, _reselect.createSelector)([selectAngleAxisForRadar, selectPolarAxisScaleForRadar], (axisSettings, scale) => {
43 if (axisSettings == null || scale == null) {
44 return undefined;
45 }
46 return _objectSpread(_objectSpread({}, axisSettings), {}, {
47 scale
48 });
49});
50var selectAngleAxisTicks = (state, _radiusAxisId, angleAxisId, isPanorama) => {
51 return (0, _polarScaleSelectors.selectPolarAxisTicks)(state, 'angleAxis', angleAxisId, isPanorama);
52};
53var selectAngleAxisWithScaleAndViewport = exports.selectAngleAxisWithScaleAndViewport = (0, _reselect.createSelector)([selectAngleAxisForRadar, selectPolarAxisScaleForRadar, _polarAxisSelectors.selectPolarViewBox], (axisOptions, scale, polarViewBox) => {
54 if (polarViewBox == null || scale == null) {
55 return undefined;
56 }
57 return {
58 scale,
59 type: axisOptions.type,
60 dataKey: axisOptions.dataKey,
61 cx: polarViewBox.cx,
62 cy: polarViewBox.cy
63 };
64});
65var pickId = (_state, _radiusAxisId, _angleAxisId, _isPanorama, radarId) => radarId;
66var selectBandSizeOfAxis = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectRadiusAxisForBandSize, selectRadiusAxisTicks, selectAngleAxisForBandSize, selectAngleAxisTicks], (layout, radiusAxis, radiusAxisTicks, angleAxis, angleAxisTicks) => {
67 if ((0, _ChartUtils.isCategoricalAxis)(layout, 'radiusAxis')) {
68 return (0, _ChartUtils.getBandSizeOfAxis)(radiusAxis, radiusAxisTicks, false);
69 }
70 return (0, _ChartUtils.getBandSizeOfAxis)(angleAxis, angleAxisTicks, false);
71});
72var selectSynchronisedRadarDataKey = (0, _reselect.createSelector)([_polarSelectors.selectUnfilteredPolarItems, pickId], (graphicalItems, radarId) => {
73 if (graphicalItems == null) {
74 return undefined;
75 }
76 // Find the radar item with the given radarId
77 var pgis = graphicalItems.find(item => item.type === 'radar' && radarId === item.id);
78 // If found, return its dataKey
79 return pgis === null || pgis === void 0 ? void 0 : pgis.dataKey;
80});
81var selectRadarPoints = exports.selectRadarPoints = (0, _reselect.createSelector)([selectRadiusAxisForRadar, selectAngleAxisWithScaleAndViewport, _dataSelectors.selectChartDataAndAlwaysIgnoreIndexes, selectSynchronisedRadarDataKey, selectBandSizeOfAxis], (radiusAxis, angleAxis, _ref, dataKey, bandSize) => {
82 var {
83 chartData,
84 dataStartIndex,
85 dataEndIndex
86 } = _ref;
87 if (radiusAxis == null || angleAxis == null || chartData == null || bandSize == null || dataKey == null) {
88 return undefined;
89 }
90 var displayedData = chartData.slice(dataStartIndex, dataEndIndex + 1);
91 return (0, _Radar.computeRadarPoints)({
92 radiusAxis,
93 angleAxis,
94 displayedData,
95 dataKey,
96 bandSize
97 });
98});
Note: See TracBrowser for help on using the repository browser.