@mui/x-charts-pro 8.4.0 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.d.ts +13 -5
- package/BarChartPro/BarChartPro.js +19 -1
- package/CHANGELOG.md +215 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/ChartContainerPro/ChartProApi.d.ts +28 -0
- package/ChartContainerPro/ChartProApi.js +5 -0
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +11 -0
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +25 -315
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +22 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +283 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +138 -0
- package/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/ChartZoomSlider/internals/constants.js +11 -0
- package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/ChartZoomSlider/internals/zoom-utils.js +48 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +5 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +35 -7
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.d.ts +17 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +57 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.d.ts +17 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +57 -0
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/FunnelChart/FunnelChart.d.ts +2 -1
- package/FunnelChart/FunnelChart.js +2 -20
- package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/FunnelChart/FunnelChart.plugins.js +9 -0
- package/FunnelChart/FunnelPlot.js +10 -22
- package/FunnelChart/FunnelSection.d.ts +1 -1
- package/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/FunnelChart/FunnelSectionLabel.js +52 -0
- package/FunnelChart/curves/bump.d.ts +10 -4
- package/FunnelChart/curves/bump.js +73 -41
- package/FunnelChart/curves/curve.types.d.ts +6 -1
- package/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/FunnelChart/curves/linear.d.ts +9 -1
- package/FunnelChart/curves/linear.js +82 -5
- package/FunnelChart/funnel.types.d.ts +1 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/FunnelChart/funnelSectionClasses.js +17 -4
- package/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/FunnelChart/index.d.ts +3 -1
- package/FunnelChart/index.js +18 -2
- package/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/FunnelChart/useFunnelChartProps.js +3 -1
- package/Heatmap/Heatmap.d.ts +22 -4
- package/Heatmap/Heatmap.js +64 -22
- package/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/Heatmap/Heatmap.plugins.js +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/LineChartPro/LineChartPro.d.ts +13 -5
- package/LineChartPro/LineChartPro.js +19 -1
- package/PieChartPro/PieChartPro.d.ts +21 -0
- package/PieChartPro/PieChartPro.js +204 -0
- package/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/PieChartPro/PieChartPro.plugins.js +9 -0
- package/PieChartPro/index.d.ts +1 -0
- package/PieChartPro/index.js +16 -0
- package/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/RadarChartPro/RadarChartPro.js +202 -0
- package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/RadarChartPro/RadarChartPro.plugins.js +9 -0
- package/RadarChartPro/index.d.ts +1 -0
- package/RadarChartPro/index.js +16 -0
- package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/ScatterChartPro/ScatterChartPro.js +19 -1
- package/context/index.d.ts +1 -0
- package/context/index.js +16 -0
- package/context/useChartApiContext.d.ts +9 -0
- package/context/useChartApiContext.js +17 -0
- package/esm/BarChartPro/BarChartPro.d.ts +13 -5
- package/esm/BarChartPro/BarChartPro.js +19 -1
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/esm/ChartContainerPro/ChartProApi.d.ts +28 -0
- package/esm/ChartContainerPro/ChartProApi.js +1 -0
- package/esm/ChartContainerPro/index.d.ts +2 -1
- package/esm/ChartContainerPro/index.js +2 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +19 -306
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +22 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +275 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +130 -0
- package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/esm/ChartZoomSlider/internals/constants.js +5 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +5 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +36 -9
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInTrigger.d.ts +17 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +51 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.d.ts +17 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +51 -0
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/FunnelChart/FunnelChart.d.ts +2 -1
- package/esm/FunnelChart/FunnelChart.js +2 -20
- package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
- package/esm/FunnelChart/FunnelPlot.js +10 -22
- package/esm/FunnelChart/FunnelSection.d.ts +1 -1
- package/esm/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/esm/FunnelChart/FunnelSectionLabel.js +46 -0
- package/esm/FunnelChart/curves/bump.d.ts +10 -4
- package/esm/FunnelChart/curves/bump.js +73 -41
- package/esm/FunnelChart/curves/curve.types.d.ts +6 -1
- package/esm/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/esm/FunnelChart/curves/linear.d.ts +9 -1
- package/esm/FunnelChart/curves/linear.js +82 -5
- package/esm/FunnelChart/funnel.types.d.ts +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/esm/FunnelChart/funnelSectionClasses.js +15 -3
- package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/esm/FunnelChart/index.d.ts +3 -1
- package/esm/FunnelChart/index.js +3 -1
- package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/esm/FunnelChart/useFunnelChartProps.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +22 -4
- package/esm/Heatmap/Heatmap.js +64 -22
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/esm/Heatmap/Heatmap.plugins.js +2 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.d.ts +13 -5
- package/esm/LineChartPro/LineChartPro.js +19 -1
- package/esm/PieChartPro/PieChartPro.d.ts +21 -0
- package/esm/PieChartPro/PieChartPro.js +197 -0
- package/esm/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/esm/PieChartPro/PieChartPro.plugins.js +3 -0
- package/esm/PieChartPro/index.d.ts +1 -0
- package/esm/PieChartPro/index.js +1 -0
- package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/esm/RadarChartPro/RadarChartPro.js +195 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
- package/esm/RadarChartPro/index.d.ts +1 -0
- package/esm/RadarChartPro/index.js +1 -0
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +19 -1
- package/esm/context/index.d.ts +1 -0
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +9 -0
- package/esm/context/useChartApiContext.js +11 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +10 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/esm/models/index.d.ts +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +21 -10
- package/index.d.ts +3 -1
- package/index.js +23 -1
- package/internals/material/index.d.ts +1 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +10 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/models/index.d.ts +1 -1
- package/package.json +7 -7
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps } from '@mui/x-charts/internals';
|
|
3
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
interface ChartsToolbarZoomOutTriggerProps {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseButton']>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A button that zooms the chart out.
|
|
12
|
+
* It renders the `baseButton` slot.
|
|
13
|
+
*/
|
|
14
|
+
declare const ChartsToolbarZoomOutTrigger: React.ForwardRefExoticComponent<ChartsToolbarZoomOutTriggerProps & {
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export { ChartsToolbarZoomOutTrigger };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsToolbarZoomOutTrigger = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _internals = require("@mui/x-charts/internals");
|
|
15
|
+
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
16
|
+
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _excluded = ["render"];
|
|
19
|
+
/**
|
|
20
|
+
* A button that zooms the chart out.
|
|
21
|
+
* It renders the `baseButton` slot.
|
|
22
|
+
*/
|
|
23
|
+
const ChartsToolbarZoomOutTrigger = exports.ChartsToolbarZoomOutTrigger = /*#__PURE__*/React.forwardRef(function ChartsToolbarZoomOutTrigger(_ref, ref) {
|
|
24
|
+
let {
|
|
25
|
+
render
|
|
26
|
+
} = _ref,
|
|
27
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
28
|
+
const {
|
|
29
|
+
slots,
|
|
30
|
+
slotProps
|
|
31
|
+
} = (0, _internals.useChartsSlots)();
|
|
32
|
+
const {
|
|
33
|
+
instance,
|
|
34
|
+
store
|
|
35
|
+
} = (0, _internals.useChartContext)();
|
|
36
|
+
const disabled = (0, _internals.useSelector)(store, _useChartProZoom.selectorChartCanZoomOut);
|
|
37
|
+
const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseButton, render, (0, _extends2.default)({}, slotProps.baseButton, {
|
|
38
|
+
onClick: () => instance.zoomOut(),
|
|
39
|
+
disabled
|
|
40
|
+
}, other, {
|
|
41
|
+
ref
|
|
42
|
+
}));
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
44
|
+
children: element
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
if (process.env.NODE_ENV !== "production") ChartsToolbarZoomOutTrigger.displayName = "ChartsToolbarZoomOutTrigger";
|
|
48
|
+
process.env.NODE_ENV !== "production" ? ChartsToolbarZoomOutTrigger.propTypes = {
|
|
49
|
+
// ----------------------------- Warning --------------------------------
|
|
50
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
51
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
52
|
+
// ----------------------------------------------------------------------
|
|
53
|
+
/**
|
|
54
|
+
* A function to customize the rendering of the component.
|
|
55
|
+
*/
|
|
56
|
+
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func])
|
|
57
|
+
} : void 0;
|
|
@@ -13,4 +13,26 @@ Object.keys(_ChartsToolbarPro).forEach(function (key) {
|
|
|
13
13
|
return _ChartsToolbarPro[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _ChartsToolbarZoomInTrigger = require("./ChartsToolbarZoomInTrigger");
|
|
18
|
+
Object.keys(_ChartsToolbarZoomInTrigger).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _ChartsToolbarZoomInTrigger[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _ChartsToolbarZoomInTrigger[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _ChartsToolbarZoomOutTrigger = require("./ChartsToolbarZoomOutTrigger");
|
|
29
|
+
Object.keys(_ChartsToolbarZoomOutTrigger).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _ChartsToolbarZoomOutTrigger[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _ChartsToolbarZoomOutTrigger[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
16
38
|
});
|
|
@@ -7,7 +7,8 @@ import { FunnelSeriesType } from "./funnel.types.js";
|
|
|
7
7
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
8
|
import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
|
|
9
9
|
import { CategoryAxis } from "./categoryAxis.types.js";
|
|
10
|
-
|
|
10
|
+
import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
|
|
11
|
+
export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
|
|
11
12
|
/**
|
|
12
13
|
* The series to display in the funnel chart.
|
|
13
14
|
* An array of [[FunnelSeriesType]] objects.
|
|
@@ -67,8 +67,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
67
67
|
apiRef: _propTypes.default.shape({
|
|
68
68
|
current: _propTypes.default.shape({
|
|
69
69
|
exportAsImage: _propTypes.default.func.isRequired,
|
|
70
|
-
exportAsPrint: _propTypes.default.func.isRequired
|
|
71
|
-
setZoomData: _propTypes.default.func.isRequired
|
|
70
|
+
exportAsPrint: _propTypes.default.func.isRequired
|
|
72
71
|
})
|
|
73
72
|
}),
|
|
74
73
|
/**
|
|
@@ -207,15 +206,6 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
207
206
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
208
207
|
*/
|
|
209
208
|
id: _propTypes.default.string,
|
|
210
|
-
/**
|
|
211
|
-
* The list of zoom data related to each axis.
|
|
212
|
-
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
213
|
-
*/
|
|
214
|
-
initialZoom: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
215
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
216
|
-
end: _propTypes.default.number.isRequired,
|
|
217
|
-
start: _propTypes.default.number.isRequired
|
|
218
|
-
})),
|
|
219
209
|
/**
|
|
220
210
|
* If `true`, a loading overlay is displayed.
|
|
221
211
|
* @default false
|
|
@@ -282,13 +272,5 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
|
|
|
282
272
|
/**
|
|
283
273
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
284
274
|
*/
|
|
285
|
-
width: _propTypes.default.number
|
|
286
|
-
/**
|
|
287
|
-
* The list of zoom data related to each axis.
|
|
288
|
-
*/
|
|
289
|
-
zoomData: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
290
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
291
|
-
end: _propTypes.default.number.isRequired,
|
|
292
|
-
start: _propTypes.default.number.isRequired
|
|
293
|
-
}))
|
|
275
|
+
width: _propTypes.default.number
|
|
294
276
|
} : void 0;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartHighlightSignature, UseChartInteractionSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
|
+
export type FunnelChartPluginsSignatures = [UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProExportSignature];
|
|
4
|
+
export declare const FUNNEL_CHART_PLUGINS: ConvertSignaturesIntoPlugins<FunnelChartPluginsSignatures>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FUNNEL_CHART_PLUGINS = void 0;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
|
+
const FUNNEL_CHART_PLUGINS = exports.FUNNEL_CHART_PLUGINS = [_internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProExport.useChartProExport];
|
|
@@ -14,11 +14,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
14
14
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
15
15
|
var _internals = require("@mui/x-charts/internals");
|
|
16
16
|
var _hooks = require("@mui/x-charts/hooks");
|
|
17
|
-
var _styles = require("@mui/material/styles");
|
|
18
17
|
var _FunnelSection = require("./FunnelSection");
|
|
19
18
|
var _labelUtils = require("./labelUtils");
|
|
20
19
|
var _useFunnelSeries = require("../hooks/useFunnelSeries");
|
|
21
20
|
var _curves = require("./curves");
|
|
21
|
+
var _FunnelSectionLabel = require("./FunnelSectionLabel");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const _excluded = ["onItemClick", "gap"];
|
|
24
24
|
_internals.cartesianSeriesTypes.addType('funnel');
|
|
@@ -130,7 +130,6 @@ function FunnelPlot(props) {
|
|
|
130
130
|
gap
|
|
131
131
|
} = props,
|
|
132
132
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
133
|
-
const theme = (0, _styles.useTheme)();
|
|
134
133
|
const data = useAggregatedData(gap);
|
|
135
134
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
136
135
|
children: [data.map(({
|
|
@@ -156,29 +155,18 @@ function FunnelPlot(props) {
|
|
|
156
155
|
})
|
|
157
156
|
}))), data.map(({
|
|
158
157
|
id,
|
|
159
|
-
label
|
|
158
|
+
label,
|
|
159
|
+
seriesId,
|
|
160
|
+
dataIndex
|
|
160
161
|
}) => {
|
|
161
|
-
if (!label) {
|
|
162
|
+
if (!label || !label.value) {
|
|
162
163
|
return null;
|
|
163
164
|
}
|
|
164
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
stroke: "none",
|
|
170
|
-
pointerEvents: "none",
|
|
171
|
-
fontFamily: theme.typography.body2.fontFamily,
|
|
172
|
-
fontSize: theme.typography.body2.fontSize,
|
|
173
|
-
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
174
|
-
fontWeight: theme.typography.body2.fontWeight,
|
|
175
|
-
letterSpacing: theme.typography.body2.letterSpacing,
|
|
176
|
-
fontStretch: theme.typography.body2.fontStretch,
|
|
177
|
-
fontStyle: theme.typography.body2.fontStyle,
|
|
178
|
-
fontVariant: theme.typography.body2.fontVariant,
|
|
179
|
-
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
180
|
-
children: label.value
|
|
181
|
-
}, id);
|
|
165
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FunnelSectionLabel.FunnelSectionLabel, (0, _extends2.default)({
|
|
166
|
+
label: label,
|
|
167
|
+
dataIndex: dataIndex,
|
|
168
|
+
seriesId: seriesId
|
|
169
|
+
}, other), id);
|
|
182
170
|
})]
|
|
183
171
|
});
|
|
184
172
|
}
|
|
@@ -8,7 +8,7 @@ export interface FunnelSectionProps extends Omit<React.SVGProps<SVGPathElement>,
|
|
|
8
8
|
classes?: Partial<FunnelSectionClasses>;
|
|
9
9
|
variant?: 'filled' | 'outlined';
|
|
10
10
|
}
|
|
11
|
-
export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, React.SVGProps<SVGPathElement>, {}>;
|
|
11
|
+
export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.SVGProps<SVGPathElement>, {}>;
|
|
12
12
|
/**
|
|
13
13
|
* @ignore - internal component.
|
|
14
14
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { FunnelSectionClasses } from "./funnelSectionClasses.js";
|
|
4
|
+
export interface FunnelSectionLabelConfig {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
value: string | null;
|
|
8
|
+
textAnchor?: React.SVGProps<SVGTextElement>['textAnchor'];
|
|
9
|
+
dominantBaseline?: React.SVGProps<SVGTextElement>['dominantBaseline'];
|
|
10
|
+
}
|
|
11
|
+
export interface FunnelSectionLabelProps extends Omit<React.SVGProps<SVGTextElement>, 'ref' | 'id'> {
|
|
12
|
+
classes?: Partial<FunnelSectionClasses>;
|
|
13
|
+
label: FunnelSectionLabelConfig;
|
|
14
|
+
seriesId: SeriesId;
|
|
15
|
+
dataIndex: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @ignore - internal component.
|
|
19
|
+
*/
|
|
20
|
+
declare const FunnelSectionLabel: React.ForwardRefExoticComponent<FunnelSectionLabelProps & React.RefAttributes<{}>>;
|
|
21
|
+
export { FunnelSectionLabel };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.FunnelSectionLabel = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _internals = require("@mui/x-charts/internals");
|
|
15
|
+
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const _excluded = ["classes", "color", "onClick", "className", "label", "seriesId", "dataIndex"];
|
|
18
|
+
/**
|
|
19
|
+
* @ignore - internal component.
|
|
20
|
+
*/
|
|
21
|
+
const FunnelSectionLabel = exports.FunnelSectionLabel = (0, _internals.consumeSlots)('MuiFunnelSectionLabel', 'funnelSectionLabel', {
|
|
22
|
+
classesResolver: _funnelSectionClasses.useLabelUtilityClasses
|
|
23
|
+
}, /*#__PURE__*/React.forwardRef(function FunnelSectionLabel(props, ref) {
|
|
24
|
+
const {
|
|
25
|
+
classes,
|
|
26
|
+
label
|
|
27
|
+
} = props,
|
|
28
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
29
|
+
const theme = (0, _styles.useTheme)();
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("text", (0, _extends2.default)({
|
|
31
|
+
stroke: "none",
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
fontFamily: theme.typography.body2.fontFamily,
|
|
34
|
+
fontSize: theme.typography.body2.fontSize,
|
|
35
|
+
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
36
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
37
|
+
letterSpacing: theme.typography.body2.letterSpacing,
|
|
38
|
+
fontStretch: theme.typography.body2.fontStretch,
|
|
39
|
+
fontStyle: theme.typography.body2.fontStyle,
|
|
40
|
+
fontVariant: theme.typography.body2.fontVariant,
|
|
41
|
+
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
42
|
+
className: classes?.label,
|
|
43
|
+
x: label.x,
|
|
44
|
+
y: label.y,
|
|
45
|
+
textAnchor: label.textAnchor ?? 'middle',
|
|
46
|
+
dominantBaseline: label.dominantBaseline ?? 'central'
|
|
47
|
+
}, other, {
|
|
48
|
+
ref: ref,
|
|
49
|
+
children: label.value
|
|
50
|
+
}));
|
|
51
|
+
}));
|
|
52
|
+
if (process.env.NODE_ENV !== "production") FunnelSectionLabel.displayName = "FunnelSectionLabel";
|
|
@@ -10,18 +10,24 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class Bump implements CurveGenerator {
|
|
12
12
|
private context;
|
|
13
|
-
private x;
|
|
14
|
-
private y;
|
|
15
|
-
private currentPoint;
|
|
16
13
|
private isHorizontal;
|
|
17
14
|
private gap;
|
|
15
|
+
private min;
|
|
16
|
+
private max;
|
|
17
|
+
private points;
|
|
18
18
|
constructor(context: CanvasRenderingContext2D, {
|
|
19
19
|
isHorizontal,
|
|
20
|
-
gap
|
|
20
|
+
gap,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
isIncreasing
|
|
21
24
|
}: CurveOptions);
|
|
22
25
|
areaStart(): void;
|
|
23
26
|
areaEnd(): void;
|
|
24
27
|
lineStart(): void;
|
|
25
28
|
lineEnd(): void;
|
|
26
29
|
point(x: number, y: number): void;
|
|
30
|
+
private drawPath;
|
|
31
|
+
private drawHorizontalPath;
|
|
32
|
+
private drawVerticalPath;
|
|
27
33
|
}
|
|
@@ -17,65 +17,97 @@ exports.Bump = void 0;
|
|
|
17
17
|
class Bump {
|
|
18
18
|
constructor(context, {
|
|
19
19
|
isHorizontal,
|
|
20
|
-
gap
|
|
20
|
+
gap,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
isIncreasing
|
|
21
24
|
}) {
|
|
22
25
|
this.context = void 0;
|
|
23
|
-
this.x = NaN;
|
|
24
|
-
this.y = NaN;
|
|
25
|
-
this.currentPoint = 0;
|
|
26
26
|
this.isHorizontal = false;
|
|
27
27
|
this.gap = 0;
|
|
28
|
+
this.min = {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0
|
|
31
|
+
};
|
|
32
|
+
this.max = {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0
|
|
35
|
+
};
|
|
36
|
+
this.points = [];
|
|
28
37
|
this.context = context;
|
|
29
38
|
this.isHorizontal = isHorizontal ?? false;
|
|
30
39
|
this.gap = (gap ?? 0) / 2;
|
|
40
|
+
this.min = min ?? {
|
|
41
|
+
x: 0,
|
|
42
|
+
y: 0
|
|
43
|
+
};
|
|
44
|
+
this.max = max ?? {
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0
|
|
47
|
+
};
|
|
48
|
+
if (isIncreasing) {
|
|
49
|
+
const currentMin = this.min;
|
|
50
|
+
const currentMax = this.max;
|
|
51
|
+
this.min = currentMax;
|
|
52
|
+
this.max = currentMin;
|
|
53
|
+
}
|
|
31
54
|
}
|
|
32
55
|
areaStart() {}
|
|
33
56
|
areaEnd() {}
|
|
34
57
|
lineStart() {}
|
|
35
58
|
lineEnd() {}
|
|
36
59
|
point(x, y) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (this.
|
|
42
|
-
if (this.currentPoint === 0) {
|
|
43
|
-
this.context.moveTo(x + this.gap, y);
|
|
44
|
-
this.context.lineTo(x + this.gap, y);
|
|
45
|
-
} else if (this.currentPoint === 1) {
|
|
46
|
-
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x - this.gap, y);
|
|
47
|
-
} else if (this.currentPoint === 2) {
|
|
48
|
-
this.context.lineTo(x - this.gap, y);
|
|
49
|
-
} else {
|
|
50
|
-
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x + this.gap, y);
|
|
51
|
-
}
|
|
52
|
-
if (this.currentPoint === 3) {
|
|
53
|
-
this.context.closePath();
|
|
54
|
-
}
|
|
55
|
-
this.currentPoint += 1;
|
|
56
|
-
this.x = x;
|
|
57
|
-
this.y = y;
|
|
60
|
+
this.points.push({
|
|
61
|
+
x,
|
|
62
|
+
y
|
|
63
|
+
});
|
|
64
|
+
if (this.points.length < 4) {
|
|
58
65
|
return;
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.context.bezierCurveTo(this.x, (this.y + y) / 2, x, (this.y + y) / 2, x, y - this.gap);
|
|
68
|
-
} else if (this.currentPoint === 2) {
|
|
69
|
-
this.context.lineTo(x, y - this.gap);
|
|
68
|
+
// Draw the path using bezier curves
|
|
69
|
+
this.drawPath();
|
|
70
|
+
}
|
|
71
|
+
drawPath() {
|
|
72
|
+
if (this.isHorizontal) {
|
|
73
|
+
this.drawHorizontalPath();
|
|
70
74
|
} else {
|
|
71
|
-
this.
|
|
72
|
-
}
|
|
73
|
-
if (this.currentPoint === 3) {
|
|
74
|
-
this.context.closePath();
|
|
75
|
+
this.drawVerticalPath();
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
}
|
|
78
|
+
drawHorizontalPath() {
|
|
79
|
+
const [p0, p1, p2, p3] = this.points;
|
|
80
|
+
|
|
81
|
+
// 0 is the top-left corner
|
|
82
|
+
this.context.moveTo(p0.x + this.gap, p0.y);
|
|
83
|
+
this.context.lineTo(p0.x + this.gap, p0.y);
|
|
84
|
+
|
|
85
|
+
// Bezier curve to point 1
|
|
86
|
+
this.context.bezierCurveTo((p0.x + p1.x) / 2, p0.y, (p0.x + p1.x) / 2, p1.y, p1.x - this.gap, p1.y);
|
|
87
|
+
|
|
88
|
+
// Line to point 2
|
|
89
|
+
this.context.lineTo(p2.x - this.gap, p2.y);
|
|
90
|
+
|
|
91
|
+
// Bezier curve back to point 3
|
|
92
|
+
this.context.bezierCurveTo((p2.x + p3.x) / 2, p2.y, (p2.x + p3.x) / 2, p3.y, p3.x + this.gap, p3.y);
|
|
93
|
+
this.context.closePath();
|
|
94
|
+
}
|
|
95
|
+
drawVerticalPath() {
|
|
96
|
+
const [p0, p1, p2, p3] = this.points;
|
|
97
|
+
|
|
98
|
+
// 0 is the top-right corner
|
|
99
|
+
this.context.moveTo(p0.x, p0.y + this.gap);
|
|
100
|
+
this.context.lineTo(p0.x, p0.y + this.gap);
|
|
101
|
+
|
|
102
|
+
// Bezier curve to point 1
|
|
103
|
+
this.context.bezierCurveTo(p0.x, (p0.y + p1.y) / 2, p1.x, (p0.y + p1.y) / 2, p1.x, p1.y - this.gap);
|
|
104
|
+
|
|
105
|
+
// Line to point 2
|
|
106
|
+
this.context.lineTo(p2.x, p2.y - this.gap);
|
|
107
|
+
|
|
108
|
+
// Bezier curve back to point 3
|
|
109
|
+
this.context.bezierCurveTo(p2.x, (p2.y + p3.y) / 2, p3.x, (p2.y + p3.y) / 2, p3.x, p3.y + this.gap);
|
|
110
|
+
this.context.closePath();
|
|
79
111
|
}
|
|
80
112
|
}
|
|
81
113
|
exports.Bump = Bump;
|
|
@@ -34,8 +34,13 @@ export type CurveOptions = {
|
|
|
34
34
|
* The maximum point for all the segments.
|
|
35
35
|
*/
|
|
36
36
|
max?: Point;
|
|
37
|
+
/**
|
|
38
|
+
* The shape of the point of the funnel for the curves that support it.
|
|
39
|
+
*/
|
|
40
|
+
pointShape?: FunnelPointShape;
|
|
37
41
|
};
|
|
38
|
-
export type FunnelCurveType = 'linear' | 'step' | 'bump' | 'pyramid' | 'step-pyramid';
|
|
42
|
+
export type FunnelCurveType = 'linear' | 'linear-sharp' | 'step' | 'bump' | 'pyramid' | 'step-pyramid';
|
|
43
|
+
export type FunnelPointShape = 'square' | 'sharp';
|
|
39
44
|
export type Point = {
|
|
40
45
|
x: number;
|
|
41
46
|
y: number;
|
|
@@ -25,6 +25,9 @@ const curveConstructor = curve => {
|
|
|
25
25
|
return _linear.Linear;
|
|
26
26
|
};
|
|
27
27
|
const getFunnelCurve = (curve, options) => {
|
|
28
|
+
if (curve === 'linear-sharp') {
|
|
29
|
+
options.pointShape = 'sharp';
|
|
30
|
+
}
|
|
28
31
|
return context => new (curveConstructor(curve))(context, options);
|
|
29
32
|
};
|
|
30
33
|
exports.getFunnelCurve = getFunnelCurve;
|
|
@@ -13,15 +13,23 @@ export declare class Linear implements CurveGenerator {
|
|
|
13
13
|
private position;
|
|
14
14
|
private sections;
|
|
15
15
|
private isHorizontal;
|
|
16
|
+
private isIncreasing;
|
|
16
17
|
private gap;
|
|
17
18
|
private borderRadius;
|
|
19
|
+
private min;
|
|
20
|
+
private max;
|
|
18
21
|
private points;
|
|
22
|
+
private pointShape;
|
|
19
23
|
constructor(context: CanvasRenderingContext2D, {
|
|
20
24
|
isHorizontal,
|
|
21
25
|
gap,
|
|
22
26
|
position,
|
|
23
27
|
sections,
|
|
24
|
-
borderRadius
|
|
28
|
+
borderRadius,
|
|
29
|
+
min,
|
|
30
|
+
max,
|
|
31
|
+
isIncreasing,
|
|
32
|
+
pointShape
|
|
25
33
|
}: CurveOptions);
|
|
26
34
|
areaStart(): void;
|
|
27
35
|
areaEnd(): void;
|
|
@@ -22,21 +22,51 @@ class Linear {
|
|
|
22
22
|
gap,
|
|
23
23
|
position,
|
|
24
24
|
sections,
|
|
25
|
-
borderRadius
|
|
25
|
+
borderRadius,
|
|
26
|
+
min,
|
|
27
|
+
max,
|
|
28
|
+
isIncreasing,
|
|
29
|
+
pointShape
|
|
26
30
|
}) {
|
|
27
31
|
this.context = void 0;
|
|
28
32
|
this.position = 0;
|
|
29
33
|
this.sections = 0;
|
|
30
34
|
this.isHorizontal = false;
|
|
35
|
+
this.isIncreasing = false;
|
|
31
36
|
this.gap = 0;
|
|
32
37
|
this.borderRadius = 0;
|
|
38
|
+
this.min = {
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
};
|
|
42
|
+
this.max = {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
};
|
|
33
46
|
this.points = [];
|
|
47
|
+
this.pointShape = 'square';
|
|
34
48
|
this.context = context;
|
|
35
49
|
this.isHorizontal = isHorizontal ?? false;
|
|
36
50
|
this.gap = (gap ?? 0) / 2;
|
|
37
51
|
this.position = position ?? 0;
|
|
38
52
|
this.sections = sections ?? 1;
|
|
39
53
|
this.borderRadius = borderRadius ?? 0;
|
|
54
|
+
this.isIncreasing = isIncreasing ?? false;
|
|
55
|
+
this.min = min ?? {
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
};
|
|
59
|
+
this.max = max ?? {
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 0
|
|
62
|
+
};
|
|
63
|
+
this.pointShape = pointShape ?? 'square';
|
|
64
|
+
if (isIncreasing) {
|
|
65
|
+
const currentMin = this.min;
|
|
66
|
+
const currentMax = this.max;
|
|
67
|
+
this.min = currentMax;
|
|
68
|
+
this.max = currentMin;
|
|
69
|
+
}
|
|
40
70
|
}
|
|
41
71
|
areaStart() {}
|
|
42
72
|
areaEnd() {}
|
|
@@ -46,11 +76,34 @@ class Linear {
|
|
|
46
76
|
if (this.gap > 0) {
|
|
47
77
|
return this.borderRadius;
|
|
48
78
|
}
|
|
49
|
-
if (this.
|
|
50
|
-
|
|
79
|
+
if (this.isIncreasing) {
|
|
80
|
+
// Is largest section
|
|
81
|
+
if (this.position === this.sections - 1) {
|
|
82
|
+
return [this.borderRadius, this.borderRadius];
|
|
83
|
+
}
|
|
84
|
+
// Is smallest section and shaped like a triangle
|
|
85
|
+
if (this.position === 0 && this.pointShape === 'sharp') {
|
|
86
|
+
return [0, 0, this.borderRadius];
|
|
87
|
+
}
|
|
88
|
+
// Is smallest section
|
|
89
|
+
if (this.position === 0) {
|
|
90
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
91
|
+
}
|
|
51
92
|
}
|
|
52
|
-
if (this.
|
|
53
|
-
|
|
93
|
+
if (!this.isIncreasing) {
|
|
94
|
+
// Is largest section
|
|
95
|
+
if (this.position === 0) {
|
|
96
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
97
|
+
}
|
|
98
|
+
// Is smallest section and shaped like a triangle
|
|
99
|
+
if (this.position === this.sections - 1 && this.pointShape === 'sharp') {
|
|
100
|
+
return [this.borderRadius];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Is smallest section
|
|
104
|
+
if (this.position === this.sections - 1) {
|
|
105
|
+
return [this.borderRadius, this.borderRadius];
|
|
106
|
+
}
|
|
54
107
|
}
|
|
55
108
|
return 0;
|
|
56
109
|
}
|
|
@@ -82,6 +135,30 @@ class Linear {
|
|
|
82
135
|
y: yGap
|
|
83
136
|
};
|
|
84
137
|
});
|
|
138
|
+
if (this.pointShape === 'sharp') {
|
|
139
|
+
// In the last section, to form a triangle we need 3 points instead of 4
|
|
140
|
+
// Else the algorithm will break.
|
|
141
|
+
const isLastSection = this.position === this.sections - 1;
|
|
142
|
+
const isFirstSection = this.position === 0;
|
|
143
|
+
if (isFirstSection && this.isIncreasing) {
|
|
144
|
+
this.points = [this.isHorizontal ? {
|
|
145
|
+
x: this.max.x + this.gap,
|
|
146
|
+
y: (this.max.y + this.min.y) / 2
|
|
147
|
+
} : {
|
|
148
|
+
x: (this.max.x + this.min.x) / 2,
|
|
149
|
+
y: this.max.y + this.gap
|
|
150
|
+
}, this.points[1], this.points[2]];
|
|
151
|
+
}
|
|
152
|
+
if (isLastSection && !this.isIncreasing) {
|
|
153
|
+
this.points = [this.points[0], this.isHorizontal ? {
|
|
154
|
+
x: this.max.x - this.gap,
|
|
155
|
+
y: (this.max.y + this.min.y) / 2
|
|
156
|
+
} : {
|
|
157
|
+
x: (this.max.x + this.min.x) / 2,
|
|
158
|
+
y: this.max.y - this.gap
|
|
159
|
+
}, this.points[3]];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
85
162
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
86
163
|
}
|
|
87
164
|
}
|