| [a762898] | 1 | var _excluded = ["layout"];
|
|---|
| 2 | function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|---|
| 3 | function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|---|
| 4 | function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|---|
| 5 | import { forwardRef } from 'react';
|
|---|
| 6 | import * as React from 'react';
|
|---|
| 7 | import { RechartsStoreProvider } from '../state/RechartsStoreProvider';
|
|---|
| 8 | import { ChartDataContextProvider } from '../context/chartDataContext';
|
|---|
| 9 | import { ReportMainChartProps } from '../state/ReportMainChartProps';
|
|---|
| 10 | import { ReportChartProps } from '../state/ReportChartProps';
|
|---|
| 11 | import { ReportPolarOptions } from '../state/ReportPolarOptions';
|
|---|
| 12 | import { CategoricalChart } from './CategoricalChart';
|
|---|
| 13 | import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|---|
| 14 | var defaultMargin = {
|
|---|
| 15 | top: 5,
|
|---|
| 16 | right: 5,
|
|---|
| 17 | bottom: 5,
|
|---|
| 18 | left: 5
|
|---|
| 19 | };
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * These default props are the same for all PolarChart components.
|
|---|
| 23 | */
|
|---|
| 24 | export var defaultPolarChartProps = {
|
|---|
| 25 | accessibilityLayer: true,
|
|---|
| 26 | stackOffset: 'none',
|
|---|
| 27 | barCategoryGap: '10%',
|
|---|
| 28 | barGap: 4,
|
|---|
| 29 | margin: defaultMargin,
|
|---|
| 30 | reverseStackOrder: false,
|
|---|
| 31 | syncMethod: 'index',
|
|---|
| 32 | layout: 'radial',
|
|---|
| 33 | responsive: false,
|
|---|
| 34 | cx: '50%',
|
|---|
| 35 | cy: '50%',
|
|---|
| 36 | innerRadius: 0,
|
|---|
| 37 | outerRadius: '80%'
|
|---|
| 38 | };
|
|---|
| 39 |
|
|---|
| 40 | /**
|
|---|
| 41 | * These props are required for the PolarChart to function correctly.
|
|---|
| 42 | * Users usually would not need to specify these explicitly,
|
|---|
| 43 | * because the convenience components like PieChart, RadarChart, etc.
|
|---|
| 44 | * will provide these defaults.
|
|---|
| 45 | * We can't have the defaults in this file because each of those convenience components
|
|---|
| 46 | * have their own opinions about what they should be.
|
|---|
| 47 | */
|
|---|
| 48 |
|
|---|
| 49 | /**
|
|---|
| 50 | * These are one-time, immutable options that decide the chart's behavior.
|
|---|
| 51 | * Users who wish to call CartesianChart may decide to pass these options explicitly,
|
|---|
| 52 | * but usually we would expect that they use one of the convenience components like PieChart, RadarChart, etc.
|
|---|
| 53 | */
|
|---|
| 54 |
|
|---|
| 55 | export var PolarChart = /*#__PURE__*/forwardRef(function PolarChart(props, ref) {
|
|---|
| 56 | var _polarChartProps$id;
|
|---|
| 57 | var polarChartProps = resolveDefaultProps(props.categoricalChartProps, defaultPolarChartProps);
|
|---|
| 58 | var {
|
|---|
| 59 | layout
|
|---|
| 60 | } = polarChartProps,
|
|---|
| 61 | otherCategoricalProps = _objectWithoutProperties(polarChartProps, _excluded);
|
|---|
| 62 | var {
|
|---|
| 63 | chartName,
|
|---|
| 64 | defaultTooltipEventType,
|
|---|
| 65 | validateTooltipEventTypes,
|
|---|
| 66 | tooltipPayloadSearcher
|
|---|
| 67 | } = props;
|
|---|
| 68 | var options = {
|
|---|
| 69 | chartName,
|
|---|
| 70 | defaultTooltipEventType,
|
|---|
| 71 | validateTooltipEventTypes,
|
|---|
| 72 | tooltipPayloadSearcher,
|
|---|
| 73 | eventEmitter: undefined
|
|---|
| 74 | };
|
|---|
| 75 | return /*#__PURE__*/React.createElement(RechartsStoreProvider, {
|
|---|
| 76 | preloadedState: {
|
|---|
| 77 | options
|
|---|
| 78 | },
|
|---|
| 79 | reduxStoreName: (_polarChartProps$id = polarChartProps.id) !== null && _polarChartProps$id !== void 0 ? _polarChartProps$id : chartName
|
|---|
| 80 | }, /*#__PURE__*/React.createElement(ChartDataContextProvider, {
|
|---|
| 81 | chartData: polarChartProps.data
|
|---|
| 82 | }), /*#__PURE__*/React.createElement(ReportMainChartProps, {
|
|---|
| 83 | layout: layout,
|
|---|
| 84 | margin: polarChartProps.margin
|
|---|
| 85 | }), /*#__PURE__*/React.createElement(ReportChartProps, {
|
|---|
| 86 | baseValue: undefined,
|
|---|
| 87 | accessibilityLayer: polarChartProps.accessibilityLayer,
|
|---|
| 88 | barCategoryGap: polarChartProps.barCategoryGap,
|
|---|
| 89 | maxBarSize: polarChartProps.maxBarSize,
|
|---|
| 90 | stackOffset: polarChartProps.stackOffset,
|
|---|
| 91 | barGap: polarChartProps.barGap,
|
|---|
| 92 | barSize: polarChartProps.barSize,
|
|---|
| 93 | syncId: polarChartProps.syncId,
|
|---|
| 94 | syncMethod: polarChartProps.syncMethod,
|
|---|
| 95 | className: polarChartProps.className,
|
|---|
| 96 | reverseStackOrder: polarChartProps.reverseStackOrder
|
|---|
| 97 | }), /*#__PURE__*/React.createElement(ReportPolarOptions, {
|
|---|
| 98 | cx: polarChartProps.cx,
|
|---|
| 99 | cy: polarChartProps.cy,
|
|---|
| 100 | startAngle: polarChartProps.startAngle,
|
|---|
| 101 | endAngle: polarChartProps.endAngle,
|
|---|
| 102 | innerRadius: polarChartProps.innerRadius,
|
|---|
| 103 | outerRadius: polarChartProps.outerRadius
|
|---|
| 104 | }), /*#__PURE__*/React.createElement(CategoricalChart, _extends({}, otherCategoricalProps, {
|
|---|
| 105 | ref: ref
|
|---|
| 106 | })));
|
|---|
| 107 | }); |
|---|