vccs 0.1.0 → 0.2.0
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/dist/cartesian/funnel/Funnel.d.ts +2 -0
- package/dist/cartesian/funnel/index.d.ts +2 -0
- package/dist/cartesian/funnel/type.d.ts +74 -5
- package/dist/cartesian/index.d.ts +1 -0
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/es/animation/Animate.mjs +48 -22
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
- package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
- package/dist/es/cartesian/area/Area.mjs +42 -31
- package/dist/es/cartesian/area/ClipRect.mjs +79 -58
- package/dist/es/cartesian/area/RenderArea.mjs +142 -108
- package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
- package/dist/es/cartesian/area/type.mjs +11 -11
- package/dist/es/cartesian/area/utils.mjs +69 -49
- package/dist/es/cartesian/axis/XAxis.mjs +87 -73
- package/dist/es/cartesian/axis/YAxis.mjs +67 -56
- package/dist/es/cartesian/bar/Bar.mjs +93 -71
- package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
- package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
- package/dist/es/cartesian/bar/type.mjs +9 -9
- package/dist/es/cartesian/bar/utils.mjs +97 -70
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
- package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
- package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
- package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
- package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
- package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
- package/dist/es/cartesian/funnel/type.mjs +80 -0
- package/dist/es/cartesian/funnel/utils.mjs +102 -0
- package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
- package/dist/es/cartesian/line/Line.mjs +41 -37
- package/dist/es/cartesian/line/StaticLine.mjs +191 -122
- package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
- package/dist/es/cartesian/line/type.mjs +11 -11
- package/dist/es/cartesian/line/utils.mjs +27 -26
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +86 -69
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -77
- package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
- package/dist/es/cartesian/useNeedsClip.mjs +18 -9
- package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
- package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
- package/dist/es/chart/AreaChart.mjs +5 -5
- package/dist/es/chart/BarChart.mjs +5 -5
- package/dist/es/chart/ComposedChart.mjs +5 -5
- package/dist/es/chart/FunnelChart.mjs +11 -0
- package/dist/es/chart/LegendPortalContext.mjs +3 -3
- package/dist/es/chart/LineChart.mjs +5 -5
- package/dist/es/chart/PieChart.mjs +5 -5
- package/dist/es/chart/RadarChart.mjs +5 -5
- package/dist/es/chart/RadialBarChart.mjs +5 -5
- package/dist/es/chart/RechartsWrapper.mjs +111 -88
- package/dist/es/chart/ScatterChart.mjs +5 -5
- package/dist/es/chart/Surface.mjs +3 -3
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
- package/dist/es/chart/TooltipPortalContext.mjs +3 -3
- package/dist/es/chart/const.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +97 -88
- package/dist/es/chart/provideClipPathId.mjs +12 -7
- package/dist/es/components/Cell.mjs +16 -4
- package/dist/es/components/Text.mjs +3 -3
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
- package/dist/es/components/Tooltip.mjs +274 -199
- package/dist/es/components/label/Label.mjs +30 -26
- package/dist/es/components/label/LabelList.mjs +45 -39
- package/dist/es/components/label/types.mjs +8 -5
- package/dist/es/components/label/utils.mjs +194 -162
- package/dist/es/components/legend/Legend.mjs +82 -71
- package/dist/es/components/legend/LegendSymbol.mjs +40 -38
- package/dist/es/components/legend/hooks/useLegend.mjs +66 -46
- package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
- package/dist/es/components/legend/type.mjs +2 -2
- package/dist/es/components/legend/utils.mjs +19 -11
- package/dist/es/components/utils.mjs +35 -22
- package/dist/es/container/ClipPath.mjs +14 -14
- package/dist/es/container/Layer.mjs +9 -7
- package/dist/es/container/ResponsiveContainer.mjs +3 -3
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
- package/dist/es/container/Surface.mjs +23 -19
- package/dist/es/container/useSizeContext.mjs +3 -3
- package/dist/es/context/ChartDataContextProvider.mjs +19 -13
- package/dist/es/context/PanoramaContextProvider.mjs +15 -10
- package/dist/es/context/accessibilityContext.mjs +3 -3
- package/dist/es/context/cartesianLabelListContext.mjs +3 -3
- package/dist/es/context/chartLayoutContext.mjs +33 -30
- package/dist/es/context/cursorLayerContext.mjs +3 -3
- package/dist/es/context/graphicalLayerContext.mjs +3 -3
- package/dist/es/context/labelLayerContext.mjs +3 -3
- package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
- package/dist/es/context/useTooltipAxis.mjs +14 -12
- package/dist/es/events/useChartSynchronisation.mjs +91 -66
- package/dist/es/hooks/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
- package/dist/es/index.mjs +46 -42
- package/dist/es/polar/pie/Pie.mjs +131 -115
- package/dist/es/polar/pie/type.mjs +6 -6
- package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
- package/dist/es/polar/radar/PolarGrid.mjs +72 -59
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
- package/dist/es/polar/radar/Radar.mjs +181 -145
- package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
- package/dist/es/polar/radial-bar/type.mjs +9 -9
- package/dist/es/shape/Cross.mjs +11 -10
- package/dist/es/shape/Curve.mjs +69 -43
- package/dist/es/shape/Dot.mjs +12 -11
- package/dist/es/shape/Rectangle.mjs +41 -26
- package/dist/es/shape/Sector.mjs +103 -75
- package/dist/es/shape/Symbols.mjs +45 -34
- package/dist/es/shape/Trapezoid.mjs +52 -0
- package/dist/es/state/ReportChartProps.mjs +21 -20
- package/dist/es/state/ReportMainChartProps.mjs +26 -21
- package/dist/es/state/ReportPolarOptions.mjs +23 -22
- package/dist/es/state/SetGraphicalItem.mjs +42 -27
- package/dist/es/state/SetLegendPayload.mjs +17 -13
- package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
- package/dist/es/state/brushSlice.mjs +12 -8
- package/dist/es/state/cartesianAxisSlice.mjs +23 -17
- package/dist/es/state/chartDataSlice.mjs +18 -13
- package/dist/es/state/externalEventsMiddleware.mjs +25 -15
- package/dist/es/state/graphicalItemsSlice.mjs +29 -25
- package/dist/es/state/hooks.mjs +4 -3
- package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
- package/dist/es/state/layoutSlice.mjs +18 -12
- package/dist/es/state/legendSlice.mjs +19 -14
- package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
- package/dist/es/state/optionsSlice.mjs +14 -11
- package/dist/es/state/polarAxisSlice.mjs +15 -13
- package/dist/es/state/polarOptionsSlice.mjs +8 -6
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
- package/dist/es/state/referenceElementsSlice.mjs +21 -19
- package/dist/es/state/rootPropsSlice.mjs +20 -9
- package/dist/es/state/selectors/areaSelectors.mjs +65 -55
- package/dist/es/state/selectors/axisSelectors.mjs +755 -569
- package/dist/es/state/selectors/barSelectors.mjs +225 -162
- package/dist/es/state/selectors/brushSelectors.mjs +15 -14
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
- package/dist/es/state/selectors/common.mjs +2 -2
- package/dist/es/state/selectors/containerSelectors.mjs +5 -2
- package/dist/es/state/selectors/dataSelectors.mjs +28 -9
- package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
- package/dist/es/state/selectors/legendSelectors.mjs +7 -6
- package/dist/es/state/selectors/lineSelectors.mjs +54 -47
- package/dist/es/state/selectors/pickAxisId.mjs +2 -2
- package/dist/es/state/selectors/pickAxisType.mjs +2 -2
- package/dist/es/state/selectors/pieSelectors.mjs +116 -81
- package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
- package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
- package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
- package/dist/es/state/selectors/polarSelectors.mjs +79 -62
- package/dist/es/state/selectors/radarSelectors.mjs +111 -91
- package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
- package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
- package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
- package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
- package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
- package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
- package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
- package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
- package/dist/es/state/selectors/selectors.mjs +94 -75
- package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
- package/dist/es/state/selectors/touchSelectors.mjs +17 -14
- package/dist/es/state/store.mjs +46 -46
- package/dist/es/state/tooltipSlice.mjs +64 -37
- package/dist/es/state/touchEventsMiddleware.mjs +35 -29
- package/dist/es/state/utils/useReportScale.mjs +16 -13
- package/dist/es/synchronisation/syncSelectors.mjs +3 -3
- package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
- package/dist/es/types/event.mjs +164 -2
- package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
- package/dist/es/utils/VueUtils.mjs +35 -14
- package/dist/es/utils/attrs.mjs +43 -26
- package/dist/es/utils/cartesian.mjs +47 -15
- package/dist/es/utils/chart.mjs +298 -197
- package/dist/es/utils/const.mjs +30 -2
- package/dist/es/utils/createContext.mjs +28 -9
- package/dist/es/utils/data-utils.mjs +9 -8
- package/dist/es/utils/data.mjs +35 -21
- package/dist/es/utils/events.mjs +5 -3
- package/dist/es/utils/getLinearRegression.mjs +28 -11
- package/dist/es/utils/grid.mjs +20 -5
- package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
- package/dist/es/utils/legend.mjs +13 -12
- package/dist/es/utils/log.mjs +10 -7
- package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
- package/dist/es/utils/polar.mjs +37 -30
- package/dist/es/utils/props.mjs +16 -10
- package/dist/es/utils/resolveDefaultProps.mjs +23 -4
- package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
- package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
- package/dist/es/utils/scale/utils/utils.mjs +43 -24
- package/dist/es/utils/style.mjs +24 -13
- package/dist/es/utils/tick.mjs +34 -23
- package/dist/es/utils/tooltip/translate.mjs +63 -49
- package/dist/es/utils/validate.mjs +40 -29
- package/dist/hooks/useIsAnimating.d.ts +14 -0
- package/dist/shape/Trapezoid.d.ts +31 -0
- package/dist/shape/index.d.ts +1 -0
- package/dist/state/graphicalItemsSlice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,176 +1,197 @@
|
|
|
1
|
-
import { interpolate
|
|
2
|
-
import { mouseLeaveItem
|
|
3
|
-
import { useAppDispatch
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { interpolate } from "../../utils/data-utils.mjs";
|
|
2
|
+
import { mouseLeaveItem, setActiveMouseOverItemIndex } from "../../state/tooltipSlice.mjs";
|
|
3
|
+
import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
|
|
4
|
+
import { useIsAnimating } from "../../hooks/useIsAnimating.mjs";
|
|
5
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
6
|
+
import { provideCartesianLabelListData } from "../../context/cartesianLabelListContext.mjs";
|
|
7
|
+
import { LabelList } from "../../components/label/LabelList.mjs";
|
|
8
|
+
import { Animate } from "../../animation/Animate.mjs";
|
|
9
|
+
import { SetPolarGraphicalItem } from "../../state/SetGraphicalItem.mjs";
|
|
10
|
+
import { SetLegendPayload } from "../../state/SetLegendPayload.mjs";
|
|
11
|
+
import { SetTooltipEntrySettings } from "../../state/SetTooltipEntrySettings.mjs";
|
|
12
|
+
import { Sector } from "../../shape/Sector.mjs";
|
|
13
|
+
import { selectRadialBarLegendPayload, selectRadialBarSectors } from "../../state/selectors/radialBarSelectors.mjs";
|
|
14
|
+
import { RadialBarVueProps } from "./type.mjs";
|
|
15
|
+
import { Fragment, computed, createVNode, defineComponent, mergeProps } from "vue";
|
|
15
16
|
//#region src/polar/radial-bar/RadialBar.tsx
|
|
16
|
-
function
|
|
17
|
-
return
|
|
17
|
+
function getLegendItemColor(stroke, fill) {
|
|
18
|
+
return fill;
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
+
var RadialBar = /* @__PURE__ */ defineComponent({
|
|
20
21
|
name: "RadialBar",
|
|
21
|
-
props:
|
|
22
|
-
inheritAttrs:
|
|
23
|
-
setup(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
props: RadialBarVueProps,
|
|
23
|
+
inheritAttrs: false,
|
|
24
|
+
setup(props, { slots }) {
|
|
25
|
+
const dispatch = useAppDispatch();
|
|
26
|
+
const radialBarSettings = computed(() => ({
|
|
27
|
+
dataKey: props.dataKey,
|
|
28
|
+
minPointSize: props.minPointSize,
|
|
29
|
+
stackId: props.stackId,
|
|
30
|
+
maxBarSize: props.maxBarSize,
|
|
31
|
+
barSize: props.barSize
|
|
30
32
|
}));
|
|
31
|
-
|
|
33
|
+
SetPolarGraphicalItem(computed(() => ({
|
|
32
34
|
type: "radialBar",
|
|
33
35
|
data: void 0,
|
|
34
|
-
dataKey:
|
|
35
|
-
hide:
|
|
36
|
-
angleAxisId:
|
|
37
|
-
radiusAxisId:
|
|
38
|
-
barSize:
|
|
39
|
-
stackId:
|
|
40
|
-
minPointSize:
|
|
41
|
-
maxBarSize:
|
|
36
|
+
dataKey: props.dataKey,
|
|
37
|
+
hide: props.hide,
|
|
38
|
+
angleAxisId: props.angleAxisId,
|
|
39
|
+
radiusAxisId: props.radiusAxisId,
|
|
40
|
+
barSize: props.barSize,
|
|
41
|
+
stackId: props.stackId,
|
|
42
|
+
minPointSize: props.minPointSize,
|
|
43
|
+
maxBarSize: props.maxBarSize
|
|
42
44
|
})));
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
fn: (
|
|
48
|
-
args:
|
|
45
|
+
const legendPayload = useAppSelector((state) => selectRadialBarLegendPayload(state, props.legendType));
|
|
46
|
+
SetLegendPayload(computed(() => legendPayload.value ?? []));
|
|
47
|
+
const sectors = useAppSelector((state) => selectRadialBarSectors(state, props.radiusAxisId, props.angleAxisId, radialBarSettings.value));
|
|
48
|
+
SetTooltipEntrySettings({
|
|
49
|
+
fn: (v) => v,
|
|
50
|
+
args: computed(() => ({
|
|
49
51
|
dataDefinedOnItem: void 0,
|
|
50
52
|
positions: void 0,
|
|
51
53
|
settings: {
|
|
52
|
-
dataKey:
|
|
54
|
+
dataKey: props.dataKey,
|
|
53
55
|
nameKey: void 0,
|
|
54
|
-
name:
|
|
55
|
-
hide:
|
|
56
|
-
type:
|
|
57
|
-
color:
|
|
58
|
-
fill:
|
|
59
|
-
stroke:
|
|
56
|
+
name: props.name ?? String(props.dataKey ?? ""),
|
|
57
|
+
hide: props.hide,
|
|
58
|
+
type: props.tooltipType,
|
|
59
|
+
color: getLegendItemColor(props.stroke, props.fill),
|
|
60
|
+
fill: props.fill,
|
|
61
|
+
stroke: props.stroke,
|
|
60
62
|
unit: ""
|
|
61
63
|
}
|
|
62
64
|
}))
|
|
63
65
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
if (!
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
value:
|
|
72
|
-
payload:
|
|
66
|
+
const isAnimating = useIsAnimating(() => props.isAnimationActive);
|
|
67
|
+
provideCartesianLabelListData(computed(() => {
|
|
68
|
+
if (props.isAnimationActive && isAnimating.value) return void 0;
|
|
69
|
+
const data = sectors.value;
|
|
70
|
+
if (!data) return void 0;
|
|
71
|
+
const defaultFill = props.fill;
|
|
72
|
+
return data.map((sector) => ({
|
|
73
|
+
value: sector.value ?? "",
|
|
74
|
+
payload: sector.payload,
|
|
73
75
|
parentViewBox: void 0,
|
|
74
|
-
fill:
|
|
75
|
-
cx:
|
|
76
|
-
cy:
|
|
77
|
-
innerRadius:
|
|
78
|
-
outerRadius:
|
|
79
|
-
startAngle:
|
|
80
|
-
endAngle:
|
|
81
|
-
clockWise:
|
|
76
|
+
fill: sector.fill ?? defaultFill,
|
|
77
|
+
cx: sector.cx,
|
|
78
|
+
cy: sector.cy,
|
|
79
|
+
innerRadius: sector.innerRadius,
|
|
80
|
+
outerRadius: sector.outerRadius,
|
|
81
|
+
startAngle: sector.startAngle,
|
|
82
|
+
endAngle: sector.endAngle,
|
|
83
|
+
clockWise: false
|
|
82
84
|
}));
|
|
83
85
|
}));
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
let prevSectors = null;
|
|
87
|
+
let animationId = 0;
|
|
88
|
+
let lastSectors;
|
|
89
|
+
const renderSectors = (sectorData) => {
|
|
90
|
+
const defaultFill = props.fill;
|
|
91
|
+
const defaultStroke = props.stroke;
|
|
92
|
+
const showBackground = !!props.background;
|
|
93
|
+
const backgroundProps = typeof props.background === "object" ? props.background : {};
|
|
94
|
+
return createVNode(Layer, { "class": "v-charts-radial-bar" }, { default: () => [showBackground && sectorData.map((sector, i) => {
|
|
95
|
+
if (!sector.background) return null;
|
|
96
|
+
const bg = sector.background;
|
|
97
|
+
return createVNode(Sector, mergeProps({
|
|
98
|
+
"key": `bg-${i}`,
|
|
99
|
+
"cx": bg.cx,
|
|
100
|
+
"cy": bg.cy,
|
|
101
|
+
"innerRadius": bg.innerRadius,
|
|
102
|
+
"outerRadius": bg.outerRadius,
|
|
103
|
+
"startAngle": bg.startAngle,
|
|
104
|
+
"endAngle": bg.endAngle,
|
|
105
|
+
"cornerRadius": props.cornerRadius,
|
|
106
|
+
"forceCornerRadius": props.forceCornerRadius,
|
|
107
|
+
"cornerIsExternal": props.cornerIsExternal,
|
|
108
|
+
"fill": "#eee",
|
|
101
109
|
"fill-opacity": .5
|
|
102
|
-
},
|
|
103
|
-
}),
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
}, backgroundProps), null);
|
|
111
|
+
}), sectorData.map((sector, i) => {
|
|
112
|
+
if (sector.innerRadius == null || sector.outerRadius == null || sector.startAngle == null || sector.endAngle == null) return null;
|
|
113
|
+
const sectorFill = sector.fill ?? defaultFill;
|
|
114
|
+
const onMouseenter = () => {
|
|
115
|
+
dispatch(setActiveMouseOverItemIndex({
|
|
116
|
+
activeIndex: String(i),
|
|
117
|
+
activeDataKey: props.dataKey
|
|
109
118
|
}));
|
|
110
|
-
}, c = () => {
|
|
111
|
-
C(t());
|
|
112
119
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
const onMouseleave = () => {
|
|
121
|
+
dispatch(mouseLeaveItem());
|
|
122
|
+
};
|
|
123
|
+
return createVNode(Sector, {
|
|
124
|
+
"key": `sector-${i}`,
|
|
125
|
+
"cx": sector.cx,
|
|
126
|
+
"cy": sector.cy,
|
|
127
|
+
"innerRadius": sector.innerRadius,
|
|
128
|
+
"outerRadius": sector.outerRadius,
|
|
129
|
+
"startAngle": sector.startAngle,
|
|
130
|
+
"endAngle": sector.endAngle,
|
|
131
|
+
"cornerRadius": props.cornerRadius,
|
|
132
|
+
"forceCornerRadius": props.forceCornerRadius,
|
|
133
|
+
"cornerIsExternal": props.cornerIsExternal,
|
|
134
|
+
"fill": sectorFill,
|
|
135
|
+
"fill-opacity": props.fillOpacity,
|
|
136
|
+
"stroke": defaultStroke ?? sectorFill,
|
|
137
|
+
"stroke-width": props.strokeWidth,
|
|
138
|
+
"stroke-dasharray": props.strokeDasharray,
|
|
139
|
+
"onMouseenter": onMouseenter,
|
|
140
|
+
"onMouseleave": onMouseleave
|
|
131
141
|
}, null);
|
|
132
142
|
})] });
|
|
133
143
|
};
|
|
134
144
|
return () => {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
if (props.hide) return null;
|
|
146
|
+
const data = sectors.value;
|
|
147
|
+
if (data == null || data.length === 0) return null;
|
|
148
|
+
const sectorData = data;
|
|
149
|
+
const labelEl = !isAnimating.value && props.label ? createVNode(LabelList, typeof props.label === "object" ? props.label : {}, null) : null;
|
|
150
|
+
const slotChildren = !isAnimating.value ? slots.default?.() : null;
|
|
151
|
+
if (!props.isAnimationActive) {
|
|
152
|
+
prevSectors = sectorData;
|
|
153
|
+
return createVNode(Fragment, null, [
|
|
154
|
+
renderSectors(sectorData),
|
|
155
|
+
labelEl,
|
|
156
|
+
slotChildren
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
const prevSects = prevSectors;
|
|
160
|
+
if (data !== lastSectors) {
|
|
161
|
+
animationId++;
|
|
162
|
+
lastSectors = data;
|
|
163
|
+
}
|
|
164
|
+
return createVNode(Fragment, null, [
|
|
165
|
+
createVNode(Animate, {
|
|
166
|
+
"key": animationId,
|
|
167
|
+
"isActive": true,
|
|
168
|
+
"onAnimationStart": () => {
|
|
169
|
+
isAnimating.value = true;
|
|
151
170
|
},
|
|
152
|
-
onAnimationEnd: () => {
|
|
153
|
-
|
|
171
|
+
"onAnimationEnd": () => {
|
|
172
|
+
isAnimating.value = false;
|
|
154
173
|
}
|
|
155
174
|
}, { default: (t) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
...
|
|
164
|
-
|
|
175
|
+
const stepSectors = t === 1 ? sectorData : sectorData.map((sector, i) => {
|
|
176
|
+
const prev = prevSects && prevSects[i];
|
|
177
|
+
if (!prev) return {
|
|
178
|
+
...sector,
|
|
179
|
+
endAngle: interpolate(sector.startAngle ?? 0, sector.endAngle, t)
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
...sector,
|
|
183
|
+
startAngle: prev.startAngle != null && sector.startAngle != null ? interpolate(prev.startAngle, sector.startAngle, t) : sector.startAngle,
|
|
184
|
+
endAngle: interpolate(prev.endAngle ?? 0, sector.endAngle, t)
|
|
165
185
|
};
|
|
166
186
|
});
|
|
167
|
-
|
|
187
|
+
if (t > 0) prevSectors = stepSectors;
|
|
188
|
+
return renderSectors(stepSectors);
|
|
168
189
|
} }),
|
|
169
|
-
|
|
170
|
-
|
|
190
|
+
labelEl,
|
|
191
|
+
slotChildren
|
|
171
192
|
]);
|
|
172
193
|
};
|
|
173
194
|
}
|
|
174
195
|
});
|
|
175
196
|
//#endregion
|
|
176
|
-
export {
|
|
197
|
+
export { RadialBar };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//#region src/polar/radial-bar/type.ts
|
|
2
|
-
var
|
|
2
|
+
var RadialBarVueProps = {
|
|
3
3
|
dataKey: {
|
|
4
4
|
type: [
|
|
5
5
|
String,
|
|
6
6
|
Number,
|
|
7
7
|
Function
|
|
8
8
|
],
|
|
9
|
-
required:
|
|
9
|
+
required: true
|
|
10
10
|
},
|
|
11
11
|
name: {
|
|
12
12
|
type: String,
|
|
@@ -42,7 +42,7 @@ var e = {
|
|
|
42
42
|
},
|
|
43
43
|
hide: {
|
|
44
44
|
type: Boolean,
|
|
45
|
-
default:
|
|
45
|
+
default: false
|
|
46
46
|
},
|
|
47
47
|
legendType: {
|
|
48
48
|
type: String,
|
|
@@ -54,15 +54,15 @@ var e = {
|
|
|
54
54
|
},
|
|
55
55
|
background: {
|
|
56
56
|
type: [Boolean, Object],
|
|
57
|
-
default:
|
|
57
|
+
default: false
|
|
58
58
|
},
|
|
59
59
|
label: {
|
|
60
60
|
type: [Boolean, Object],
|
|
61
|
-
default:
|
|
61
|
+
default: false
|
|
62
62
|
},
|
|
63
63
|
isAnimationActive: {
|
|
64
64
|
type: Boolean,
|
|
65
|
-
default:
|
|
65
|
+
default: true
|
|
66
66
|
},
|
|
67
67
|
minPointSize: {
|
|
68
68
|
type: Number,
|
|
@@ -86,12 +86,12 @@ var e = {
|
|
|
86
86
|
},
|
|
87
87
|
forceCornerRadius: {
|
|
88
88
|
type: Boolean,
|
|
89
|
-
default:
|
|
89
|
+
default: false
|
|
90
90
|
},
|
|
91
91
|
cornerIsExternal: {
|
|
92
92
|
type: Boolean,
|
|
93
|
-
default:
|
|
93
|
+
default: false
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
//#endregion
|
|
97
|
-
export {
|
|
97
|
+
export { RadialBarVueProps };
|
package/dist/es/shape/Cross.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { isNumber
|
|
2
|
-
import { createVNode
|
|
1
|
+
import { isNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { createVNode, mergeProps } from "vue";
|
|
3
3
|
//#region src/shape/Cross.tsx
|
|
4
|
-
function
|
|
5
|
-
return `M${
|
|
4
|
+
function getCrossPath(x, y, width, height, top, left) {
|
|
5
|
+
return `M${x},${top}v${height}M${left},${y}h${width}`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
function Cross(props) {
|
|
8
|
+
const { x = 0, y = 0, top = 0, left = 0, width = 0, height = 0, ...rest } = props;
|
|
9
|
+
if (!isNumber(x) || !isNumber(y) || !isNumber(width) || !isNumber(height) || !isNumber(top) || !isNumber(left)) return null;
|
|
10
|
+
return createVNode("path", mergeProps(rest, {
|
|
11
|
+
"class": "v-charts-cross",
|
|
12
|
+
"d": getCrossPath(x, y, width, height, top, left)
|
|
12
13
|
}), null);
|
|
13
14
|
}
|
|
14
15
|
//#endregion
|
|
15
|
-
export {
|
|
16
|
+
export { Cross };
|
package/dist/es/shape/Curve.mjs
CHANGED
|
@@ -1,40 +1,61 @@
|
|
|
1
|
-
import { isNumber
|
|
2
|
-
import { computed
|
|
3
|
-
import { area
|
|
4
|
-
import { upperFirst
|
|
1
|
+
import { isNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { computed, createVNode, defineComponent, mergeProps } from "vue";
|
|
3
|
+
import { area, curveBasis, curveBasisClosed, curveBasisOpen, curveBumpX, curveBumpY, curveLinear, curveLinearClosed, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore, line } from "victory-vendor/d3-shape";
|
|
4
|
+
import { upperFirst } from "es-toolkit/compat";
|
|
5
5
|
//#region src/shape/Curve.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @fileOverview Curve
|
|
8
|
+
*/
|
|
9
|
+
var CURVE_FACTORIES = {
|
|
10
|
+
curveBasisClosed,
|
|
11
|
+
curveBasisOpen,
|
|
12
|
+
curveBasis,
|
|
13
|
+
curveBumpX,
|
|
14
|
+
curveBumpY,
|
|
15
|
+
curveLinearClosed,
|
|
16
|
+
curveLinear,
|
|
17
|
+
curveMonotoneX,
|
|
18
|
+
curveMonotoneY,
|
|
19
|
+
curveNatural,
|
|
20
|
+
curveStep,
|
|
21
|
+
curveStepAfter,
|
|
22
|
+
curveStepBefore
|
|
23
|
+
};
|
|
24
|
+
var defined = (p) => p.x === +p.x && p.y === +p.y;
|
|
25
|
+
var getX = (p) => p.x;
|
|
26
|
+
var getY = (p) => p.y;
|
|
27
|
+
function getCurveFactory(type, layout) {
|
|
28
|
+
if (typeof type === "function") return type;
|
|
29
|
+
const name = `curve${upperFirst(type)}`;
|
|
30
|
+
if ((name === "curveMonotone" || name === "curveBump") && layout) return CURVE_FACTORIES[`${name}${layout === "vertical" ? "Y" : "X"}`];
|
|
31
|
+
return CURVE_FACTORIES[name] || curveLinear;
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Calculate the path of curve. Returns null if points is an empty array.
|
|
35
|
+
* @return path or null
|
|
36
|
+
*/
|
|
37
|
+
function getPath({ type = "linear", points = [], baseLine, layout, connectNulls = false }) {
|
|
38
|
+
const curveFactory = getCurveFactory(type, layout);
|
|
39
|
+
const formatPoints = connectNulls ? points.filter((entry) => defined(entry)) : points;
|
|
40
|
+
let lineFunction;
|
|
41
|
+
if (Array.isArray(baseLine)) {
|
|
42
|
+
const formatBaseLine = connectNulls ? baseLine.filter((base) => defined(base)) : baseLine;
|
|
43
|
+
const areaPoints = formatPoints.map((entry, index) => ({
|
|
44
|
+
...entry,
|
|
45
|
+
base: formatBaseLine[index]
|
|
32
46
|
}));
|
|
33
|
-
|
|
47
|
+
if (layout === "vertical") lineFunction = area().y(getY).x1(getX).x0((d) => d.base.x);
|
|
48
|
+
else lineFunction = area().x(getX).y1(getY).y0((d) => d.base.y);
|
|
49
|
+
lineFunction.defined(defined).curve(curveFactory);
|
|
50
|
+
return lineFunction(areaPoints);
|
|
34
51
|
}
|
|
35
|
-
|
|
52
|
+
if (layout === "vertical" && isNumber(baseLine)) lineFunction = area().y(getY).x1(getX).x0(baseLine);
|
|
53
|
+
else if (isNumber(baseLine)) lineFunction = area().x(getX).y1(getY).y0(baseLine);
|
|
54
|
+
else lineFunction = line().x(getX).y(getY);
|
|
55
|
+
lineFunction.defined(defined).curve(curveFactory);
|
|
56
|
+
return lineFunction(formatPoints);
|
|
36
57
|
}
|
|
37
|
-
var
|
|
58
|
+
var CurveVueProps = {
|
|
38
59
|
type: { type: [String, Function] },
|
|
39
60
|
layout: { type: String },
|
|
40
61
|
baseLine: { type: [Number, Array] },
|
|
@@ -42,19 +63,24 @@ var D = {
|
|
|
42
63
|
connectNulls: { type: Boolean },
|
|
43
64
|
path: { type: String },
|
|
44
65
|
class: { type: [String, Array] }
|
|
45
|
-
}
|
|
66
|
+
};
|
|
67
|
+
var Curve = /* @__PURE__ */ defineComponent({
|
|
46
68
|
name: "Curve",
|
|
47
|
-
props:
|
|
48
|
-
inheritAttrs:
|
|
49
|
-
setup(
|
|
50
|
-
|
|
51
|
-
if (
|
|
69
|
+
props: CurveVueProps,
|
|
70
|
+
inheritAttrs: false,
|
|
71
|
+
setup(props, { attrs }) {
|
|
72
|
+
const realPath = computed(() => {
|
|
73
|
+
if ((!props.points || !props.points.length) && !props.path) return;
|
|
74
|
+
return props.points && props.points.length ? getPath(props) : props.path;
|
|
52
75
|
});
|
|
53
|
-
return () =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
return () => {
|
|
77
|
+
if (realPath.value === null && !props.path) return null;
|
|
78
|
+
return createVNode("path", mergeProps(attrs, {
|
|
79
|
+
"class": ["v-charts-curve", props.class],
|
|
80
|
+
"d": realPath.value
|
|
81
|
+
}), null);
|
|
82
|
+
};
|
|
57
83
|
}
|
|
58
84
|
});
|
|
59
85
|
//#endregion
|
|
60
|
-
export {
|
|
86
|
+
export { Curve, CurveVueProps, getPath };
|
package/dist/es/shape/Dot.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createVNode
|
|
2
|
-
var
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
|
+
var Dot = /* @__PURE__ */ defineComponent({
|
|
3
3
|
name: "Dot",
|
|
4
4
|
props: {
|
|
5
5
|
cx: { type: [Number, String] },
|
|
@@ -7,17 +7,18 @@ var n = /* @__PURE__ */ t({
|
|
|
7
7
|
r: { type: [Number, String] },
|
|
8
8
|
clipDot: { type: Boolean }
|
|
9
9
|
},
|
|
10
|
-
setup(
|
|
10
|
+
setup(props) {
|
|
11
11
|
return () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class: ["v-charts-dot",
|
|
15
|
-
cx:
|
|
16
|
-
cy:
|
|
17
|
-
r:
|
|
18
|
-
}, null)
|
|
12
|
+
const { cx, cy, r } = props;
|
|
13
|
+
if (cx === +cx && cy === +cy && r === +r) return createVNode("circle", {
|
|
14
|
+
"class": ["v-charts-dot", props.class],
|
|
15
|
+
"cx": cx,
|
|
16
|
+
"cy": cy,
|
|
17
|
+
"r": r
|
|
18
|
+
}, null);
|
|
19
|
+
return null;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
//#endregion
|
|
23
|
-
export {
|
|
24
|
+
export { Dot };
|