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,6 +1,9 @@
|
|
|
1
|
-
import { createVNode
|
|
1
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
2
|
//#region src/shape/Rectangle.tsx
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @fileOverview Rectangle
|
|
5
|
+
*/
|
|
6
|
+
var RectangleVueProps = {
|
|
4
7
|
className: {
|
|
5
8
|
type: String,
|
|
6
9
|
default: void 0
|
|
@@ -26,43 +29,55 @@ var r = {
|
|
|
26
29
|
default: void 0
|
|
27
30
|
}
|
|
28
31
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
function getRectanglePath(x, y, width, height, radius) {
|
|
33
|
+
const maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2);
|
|
34
|
+
const ySign = height >= 0 ? 1 : -1;
|
|
35
|
+
const xSign = width >= 0 ? 1 : -1;
|
|
36
|
+
const clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0;
|
|
37
|
+
if (maxRadius > 0 && Array.isArray(radius)) {
|
|
38
|
+
const newRadius = [
|
|
33
39
|
0,
|
|
34
40
|
0,
|
|
35
41
|
0,
|
|
36
42
|
0
|
|
37
43
|
];
|
|
38
|
-
for (let
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
for (let i = 0; i < 4; i++) {
|
|
45
|
+
const r = radius[i] ?? 0;
|
|
46
|
+
newRadius[i] = r > maxRadius ? maxRadius : r;
|
|
41
47
|
}
|
|
42
|
-
let
|
|
43
|
-
|
|
48
|
+
let path = `M${x},${y + ySign * newRadius[0]}`;
|
|
49
|
+
if (newRadius[0] > 0) path += `A ${newRadius[0]},${newRadius[0]},0,0,${clockWise},${x + xSign * newRadius[0]},${y}`;
|
|
50
|
+
path += `L ${x + width - xSign * newRadius[1]},${y}`;
|
|
51
|
+
if (newRadius[1] > 0) path += `A ${newRadius[1]},${newRadius[1]},0,0,${clockWise},${x + width},${y + ySign * newRadius[1]}`;
|
|
52
|
+
path += `L ${x + width},${y + height - ySign * newRadius[2]}`;
|
|
53
|
+
if (newRadius[2] > 0) path += `A ${newRadius[2]},${newRadius[2]},0,0,${clockWise},${x + width - xSign * newRadius[2]},${y + height}`;
|
|
54
|
+
path += `L ${x + xSign * newRadius[3]},${y + height}`;
|
|
55
|
+
if (newRadius[3] > 0) path += `A ${newRadius[3]},${newRadius[3]},0,0,${clockWise},${x},${y + height - ySign * newRadius[3]}`;
|
|
56
|
+
path += "Z";
|
|
57
|
+
return path;
|
|
44
58
|
}
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
return `M ${
|
|
59
|
+
if (maxRadius > 0 && typeof radius === "number" && radius > 0) {
|
|
60
|
+
const r = Math.min(maxRadius, radius);
|
|
61
|
+
return `M ${x},${y + ySign * r}A ${r},${r},0,0,${clockWise},${x + xSign * r},${y}L ${x + width - xSign * r},${y}A ${r},${r},0,0,${clockWise},${x + width},${y + ySign * r}L ${x + width},${y + height - ySign * r}A ${r},${r},0,0,${clockWise},${x + width - xSign * r},${y + height}L ${x + xSign * r},${y + height}A ${r},${r},0,0,${clockWise},${x},${y + height - ySign * r} Z`;
|
|
48
62
|
}
|
|
49
|
-
return `M ${
|
|
63
|
+
return `M ${x},${y} h ${width} v ${height} h ${-width} Z`;
|
|
50
64
|
}
|
|
51
|
-
var
|
|
65
|
+
var Rectangle = /* @__PURE__ */ defineComponent({
|
|
52
66
|
name: "Rectangle",
|
|
53
|
-
props:
|
|
54
|
-
setup(
|
|
67
|
+
props: RectangleVueProps,
|
|
68
|
+
setup(props, { attrs }) {
|
|
55
69
|
return () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
const { x, y, width, height, radius } = props;
|
|
71
|
+
if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) return null;
|
|
72
|
+
return createVNode("path", mergeProps(attrs, {
|
|
73
|
+
"x": x,
|
|
74
|
+
"y": y,
|
|
75
|
+
"width": width,
|
|
76
|
+
"height": height,
|
|
77
|
+
"d": getRectanglePath(x, y, width, height, radius)
|
|
63
78
|
}), null);
|
|
64
79
|
};
|
|
65
80
|
}
|
|
66
81
|
});
|
|
67
82
|
//#endregion
|
|
68
|
-
export {
|
|
83
|
+
export { Rectangle };
|
package/dist/es/shape/Sector.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { RADIAN
|
|
2
|
-
import { getPercentValue
|
|
3
|
-
import { createVNode
|
|
1
|
+
import { RADIAN, polarToCartesian } from "../utils/polar.mjs";
|
|
2
|
+
import { getPercentValue, mathSign } from "../utils/data.mjs";
|
|
3
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
4
4
|
//#region src/shape/Sector.tsx
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @fileOverview Sector - SVG arc path shape for pie/donut chart segments
|
|
7
|
+
*/
|
|
8
|
+
var SectorVueProps = {
|
|
6
9
|
cx: {
|
|
7
10
|
type: Number,
|
|
8
11
|
default: 0
|
|
@@ -33,96 +36,121 @@ var s = {
|
|
|
33
36
|
},
|
|
34
37
|
forceCornerRadius: {
|
|
35
38
|
type: Boolean,
|
|
36
|
-
default:
|
|
39
|
+
default: false
|
|
37
40
|
},
|
|
38
41
|
cornerIsExternal: {
|
|
39
42
|
type: Boolean,
|
|
40
|
-
default:
|
|
43
|
+
default: false
|
|
41
44
|
},
|
|
42
45
|
className: {
|
|
43
46
|
type: String,
|
|
44
47
|
default: void 0
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
|
-
function
|
|
48
|
-
return
|
|
50
|
+
function getDeltaAngle(startAngle, endAngle) {
|
|
51
|
+
return mathSign(endAngle - startAngle) * Math.min(Math.abs(endAngle - startAngle), 359.999);
|
|
49
52
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
53
|
+
function getTangentCircle({ cx, cy, radius, angle, sign, isExternal, cornerRadius, cornerIsExternal }) {
|
|
54
|
+
const centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;
|
|
55
|
+
const theta = Math.asin(cornerRadius / centerRadius) / RADIAN;
|
|
56
|
+
const centerAngle = cornerIsExternal ? angle : angle + sign * theta;
|
|
57
|
+
const center = polarToCartesian(cx, cy, centerRadius, centerAngle);
|
|
58
|
+
const circleTangency = polarToCartesian(cx, cy, radius, centerAngle);
|
|
59
|
+
const lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;
|
|
52
60
|
return {
|
|
53
|
-
center
|
|
54
|
-
circleTangency
|
|
55
|
-
lineTangency:
|
|
56
|
-
theta
|
|
61
|
+
center,
|
|
62
|
+
circleTangency,
|
|
63
|
+
lineTangency: polarToCartesian(cx, cy, centerRadius * Math.cos(theta * RADIAN), lineTangencyAngle),
|
|
64
|
+
theta
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
function getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle) {
|
|
68
|
+
const angle = getDeltaAngle(startAngle, endAngle);
|
|
69
|
+
const tempEndAngle = startAngle + angle;
|
|
70
|
+
const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle);
|
|
71
|
+
const outerEnd = polarToCartesian(cx, cy, outerRadius, tempEndAngle);
|
|
72
|
+
const largeArcFlag = +(Math.abs(angle) > 180);
|
|
73
|
+
const sweepOuter = +(startAngle > tempEndAngle);
|
|
74
|
+
let path = `M ${outerStart.x},${outerStart.y} A ${outerRadius},${outerRadius},0,${largeArcFlag},${sweepOuter},${outerEnd.x},${outerEnd.y}`;
|
|
75
|
+
if (innerRadius > 0) {
|
|
76
|
+
const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle);
|
|
77
|
+
const innerEnd = polarToCartesian(cx, cy, innerRadius, tempEndAngle);
|
|
78
|
+
const sweepInner = +(startAngle <= tempEndAngle);
|
|
79
|
+
path += ` L ${innerEnd.x},${innerEnd.y} A ${innerRadius},${innerRadius},0,${largeArcFlag},${sweepInner},${innerStart.x},${innerStart.y} Z`;
|
|
80
|
+
} else path += ` L ${cx},${cy} Z`;
|
|
81
|
+
return path;
|
|
66
82
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
83
|
+
function getSectorWithCorner(cx, cy, innerRadius, outerRadius, cornerRadius, forceCornerRadius, cornerIsExternal, startAngle, endAngle) {
|
|
84
|
+
const sign = mathSign(endAngle - startAngle);
|
|
85
|
+
const { circleTangency: soct, lineTangency: solt, theta: sot } = getTangentCircle({
|
|
86
|
+
cx,
|
|
87
|
+
cy,
|
|
88
|
+
radius: outerRadius,
|
|
89
|
+
angle: startAngle,
|
|
90
|
+
sign,
|
|
91
|
+
cornerRadius,
|
|
92
|
+
cornerIsExternal
|
|
93
|
+
});
|
|
94
|
+
const { circleTangency: eoct, lineTangency: eolt, theta: eot } = getTangentCircle({
|
|
95
|
+
cx,
|
|
96
|
+
cy,
|
|
97
|
+
radius: outerRadius,
|
|
98
|
+
angle: endAngle,
|
|
99
|
+
sign: -sign,
|
|
100
|
+
cornerRadius,
|
|
101
|
+
cornerIsExternal
|
|
102
|
+
});
|
|
103
|
+
const outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot;
|
|
104
|
+
if (outerArcAngle < 0) {
|
|
105
|
+
if (forceCornerRadius) return `M ${solt.x},${solt.y} a${cornerRadius},${cornerRadius},0,0,1,${cornerRadius * 2},0 a${cornerRadius},${cornerRadius},0,0,1,${-cornerRadius * 2},0`;
|
|
106
|
+
return getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle);
|
|
107
|
+
}
|
|
108
|
+
let path = `M ${solt.x},${solt.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${soct.x},${soct.y} A${outerRadius},${outerRadius},0,${+(outerArcAngle > 180)},${+(sign < 0)},${eoct.x},${eoct.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${eolt.x},${eolt.y}`;
|
|
109
|
+
if (innerRadius > 0) {
|
|
110
|
+
const { circleTangency: sict, lineTangency: silt, theta: sit } = getTangentCircle({
|
|
111
|
+
cx,
|
|
112
|
+
cy,
|
|
113
|
+
radius: innerRadius,
|
|
114
|
+
angle: startAngle,
|
|
115
|
+
sign,
|
|
116
|
+
isExternal: true,
|
|
117
|
+
cornerRadius,
|
|
118
|
+
cornerIsExternal
|
|
119
|
+
});
|
|
120
|
+
const { circleTangency: eict, lineTangency: eilt, theta: eit } = getTangentCircle({
|
|
121
|
+
cx,
|
|
122
|
+
cy,
|
|
123
|
+
radius: innerRadius,
|
|
124
|
+
angle: endAngle,
|
|
125
|
+
sign: -sign,
|
|
126
|
+
isExternal: true,
|
|
127
|
+
cornerRadius,
|
|
128
|
+
cornerIsExternal
|
|
129
|
+
});
|
|
130
|
+
const innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit;
|
|
131
|
+
if (innerArcAngle < 0 && cornerRadius === 0) return `${path}L${cx},${cy}Z`;
|
|
132
|
+
path += `L${eilt.x},${eilt.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${eict.x},${eict.y} A${innerRadius},${innerRadius},0,${+(innerArcAngle > 180)},${+(sign > 0)},${sict.x},${sict.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${silt.x},${silt.y}Z`;
|
|
133
|
+
} else path += `L${cx},${cy}Z`;
|
|
134
|
+
return path;
|
|
111
135
|
}
|
|
112
|
-
var
|
|
136
|
+
var Sector = /* @__PURE__ */ defineComponent({
|
|
113
137
|
name: "Sector",
|
|
114
|
-
props:
|
|
115
|
-
setup(
|
|
138
|
+
props: SectorVueProps,
|
|
139
|
+
setup(props, { attrs }) {
|
|
116
140
|
return () => {
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
141
|
+
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, cornerRadius, forceCornerRadius, cornerIsExternal, className } = props;
|
|
142
|
+
if (outerRadius <= 0 || outerRadius < innerRadius || startAngle === endAngle) return null;
|
|
143
|
+
const deltaRadius = outerRadius - innerRadius;
|
|
144
|
+
const cr = getPercentValue(cornerRadius, deltaRadius, 0, true);
|
|
145
|
+
let path;
|
|
146
|
+
if (cr > 0 && Math.abs(startAngle - endAngle) < 360) path = getSectorWithCorner(cx, cy, innerRadius, outerRadius, Math.min(cr, deltaRadius / 2), forceCornerRadius, cornerIsExternal, startAngle, endAngle);
|
|
147
|
+
else path = getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle);
|
|
148
|
+
return createVNode("path", mergeProps(attrs, {
|
|
149
|
+
"class": ["v-charts-sector", className],
|
|
150
|
+
"d": path
|
|
123
151
|
}), null);
|
|
124
152
|
};
|
|
125
153
|
}
|
|
126
154
|
});
|
|
127
155
|
//#endregion
|
|
128
|
-
export {
|
|
156
|
+
export { Sector };
|
|
@@ -1,41 +1,52 @@
|
|
|
1
|
-
import { isNumber
|
|
2
|
-
import { createVNode
|
|
3
|
-
import { symbol
|
|
4
|
-
import { upperFirst
|
|
1
|
+
import { isNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { createVNode, mergeProps } from "vue";
|
|
3
|
+
import { symbol, symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye } from "victory-vendor/d3-shape";
|
|
4
|
+
import { upperFirst } from "es-toolkit/compat";
|
|
5
5
|
//#region src/shape/Symbols.tsx
|
|
6
|
-
var
|
|
7
|
-
symbolCircle
|
|
8
|
-
symbolCross
|
|
9
|
-
symbolDiamond
|
|
10
|
-
symbolSquare
|
|
11
|
-
symbolStar
|
|
12
|
-
symbolTriangle
|
|
13
|
-
symbolWye
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
var symbolFactories = {
|
|
7
|
+
symbolCircle,
|
|
8
|
+
symbolCross,
|
|
9
|
+
symbolDiamond,
|
|
10
|
+
symbolSquare,
|
|
11
|
+
symbolStar,
|
|
12
|
+
symbolTriangle,
|
|
13
|
+
symbolWye
|
|
14
|
+
};
|
|
15
|
+
var RADIAN = Math.PI / 180;
|
|
16
|
+
var getSymbolFactory = (type) => {
|
|
17
|
+
return symbolFactories[`symbol${upperFirst(type)}`] || symbolCircle;
|
|
18
|
+
};
|
|
19
|
+
var calculateAreaSize = (size, sizeType, type) => {
|
|
20
|
+
if (sizeType === "area") return size;
|
|
21
|
+
switch (type) {
|
|
22
|
+
case "cross": return 5 * size * size / 9;
|
|
23
|
+
case "diamond": return .5 * size * size / Math.sqrt(3);
|
|
24
|
+
case "square": return size * size;
|
|
20
25
|
case "star": {
|
|
21
|
-
|
|
22
|
-
return 1.25 *
|
|
26
|
+
const angle = 18 * RADIAN;
|
|
27
|
+
return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.tan(angle) ** 2);
|
|
23
28
|
}
|
|
24
|
-
case "triangle": return Math.sqrt(3) *
|
|
25
|
-
case "wye": return (21 - 10 * Math.sqrt(3)) *
|
|
26
|
-
default: return Math.PI *
|
|
29
|
+
case "triangle": return Math.sqrt(3) * size * size / 4;
|
|
30
|
+
case "wye": return (21 - 10 * Math.sqrt(3)) * size * size / 8;
|
|
31
|
+
default: return Math.PI * size * size / 4;
|
|
27
32
|
}
|
|
28
33
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
34
|
+
function Symbols(props) {
|
|
35
|
+
const { type = "circle", size = 64, sizeType = "area", cx, cy, className, ...rest } = props;
|
|
36
|
+
let realType = "circle";
|
|
37
|
+
if (typeof type === "string") realType = type;
|
|
38
|
+
const getPath = () => {
|
|
39
|
+
const symbolFactory = getSymbolFactory(realType);
|
|
40
|
+
const s = symbol().type(symbolFactory).size(calculateAreaSize(size, sizeType, realType))();
|
|
41
|
+
if (s === null) return;
|
|
42
|
+
return s;
|
|
43
|
+
};
|
|
44
|
+
if (isNumber(cx) && isNumber(cy) && isNumber(size)) return createVNode("path", mergeProps(rest, {
|
|
45
|
+
"class": ["v-charts-symbols", className].filter(Boolean).join(" "),
|
|
46
|
+
"transform": `translate(${cx}, ${cy})`,
|
|
47
|
+
"d": getPath()
|
|
48
|
+
}), null);
|
|
49
|
+
return null;
|
|
39
50
|
}
|
|
40
51
|
//#endregion
|
|
41
|
-
export {
|
|
52
|
+
export { Symbols };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
//#region src/shape/Trapezoid.tsx
|
|
3
|
+
var TrapezoidVueProps = {
|
|
4
|
+
className: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: void 0
|
|
7
|
+
},
|
|
8
|
+
x: {
|
|
9
|
+
type: Number,
|
|
10
|
+
default: 0
|
|
11
|
+
},
|
|
12
|
+
y: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
upperWidth: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
lowerWidth: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0
|
|
23
|
+
},
|
|
24
|
+
height: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) {
|
|
30
|
+
const upperLeft = x;
|
|
31
|
+
const upperRight = x + upperWidth;
|
|
32
|
+
const lowerLeft = x + (upperWidth - lowerWidth) / 2;
|
|
33
|
+
const lowerRight = x + (upperWidth + lowerWidth) / 2;
|
|
34
|
+
const bottom = y + height;
|
|
35
|
+
return `M ${upperLeft},${y} L ${upperRight},${y} L ${lowerRight},${bottom} L ${lowerLeft},${bottom} Z`;
|
|
36
|
+
}
|
|
37
|
+
var Trapezoid = /* @__PURE__ */ defineComponent({
|
|
38
|
+
name: "Trapezoid",
|
|
39
|
+
props: TrapezoidVueProps,
|
|
40
|
+
setup(props, { attrs }) {
|
|
41
|
+
return () => {
|
|
42
|
+
const { x, y, upperWidth, lowerWidth, height, className } = props;
|
|
43
|
+
if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || height === 0) return null;
|
|
44
|
+
return createVNode("path", mergeProps(attrs, {
|
|
45
|
+
"class": ["v-charts-trapezoid", className],
|
|
46
|
+
"d": getTrapezoidPath(x, y, upperWidth, lowerWidth, height)
|
|
47
|
+
}), null);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Trapezoid };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useAppDispatch
|
|
2
|
-
import { updateOptions
|
|
3
|
-
import { defineComponent
|
|
1
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
2
|
+
import { updateOptions } from "./rootPropsSlice.mjs";
|
|
3
|
+
import { defineComponent, watchEffect } from "vue";
|
|
4
4
|
//#region src/state/ReportChartProps.tsx
|
|
5
|
-
var
|
|
5
|
+
var ReportChartProps_default = /* @__PURE__ */ defineComponent({
|
|
6
6
|
name: "ReportChartProps",
|
|
7
7
|
props: {
|
|
8
8
|
accessibilityLayer: {
|
|
9
9
|
type: Boolean,
|
|
10
|
-
default:
|
|
10
|
+
default: true
|
|
11
11
|
},
|
|
12
12
|
barCategoryGap: {
|
|
13
13
|
type: [Number, String],
|
|
@@ -42,22 +42,23 @@ var i = /* @__PURE__ */ n({
|
|
|
42
42
|
default: "index"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
setup(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
accessibilityLayer:
|
|
50
|
-
barCategoryGap:
|
|
51
|
-
barGap:
|
|
52
|
-
barSize:
|
|
53
|
-
class:
|
|
54
|
-
maxBarSize:
|
|
55
|
-
stackOffset:
|
|
56
|
-
syncId:
|
|
57
|
-
syncMethod:
|
|
45
|
+
setup(props) {
|
|
46
|
+
const dispatch = useAppDispatch();
|
|
47
|
+
watchEffect(() => {
|
|
48
|
+
dispatch(updateOptions({
|
|
49
|
+
accessibilityLayer: props.accessibilityLayer,
|
|
50
|
+
barCategoryGap: props.barCategoryGap,
|
|
51
|
+
barGap: props.barGap,
|
|
52
|
+
barSize: props.barSize,
|
|
53
|
+
class: props.class,
|
|
54
|
+
maxBarSize: props.maxBarSize,
|
|
55
|
+
stackOffset: props.stackOffset,
|
|
56
|
+
syncId: props.syncId,
|
|
57
|
+
syncMethod: props.syncMethod
|
|
58
58
|
}));
|
|
59
|
-
})
|
|
59
|
+
});
|
|
60
|
+
return () => null;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
//#endregion
|
|
63
|
-
export {
|
|
64
|
+
export { ReportChartProps_default as default };
|
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
import { useAppDispatch
|
|
2
|
-
import { setChartSize
|
|
3
|
-
import { defineComponent
|
|
1
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
2
|
+
import { setChartSize, setLayout, setMargin } from "./layoutSlice.mjs";
|
|
3
|
+
import { defineComponent, watch } from "vue";
|
|
4
4
|
//#region src/state/ReportMainChartProps.ts
|
|
5
|
-
var
|
|
5
|
+
var ReportMainChartProps = defineComponent({
|
|
6
6
|
name: "ReportMainChartProps",
|
|
7
7
|
props: {
|
|
8
8
|
width: {
|
|
9
9
|
type: Number,
|
|
10
|
-
required:
|
|
10
|
+
required: true
|
|
11
11
|
},
|
|
12
12
|
height: {
|
|
13
13
|
type: Number,
|
|
14
|
-
required:
|
|
14
|
+
required: true
|
|
15
15
|
},
|
|
16
16
|
layout: {
|
|
17
17
|
type: String,
|
|
18
|
-
required:
|
|
18
|
+
required: true
|
|
19
19
|
},
|
|
20
20
|
margin: {
|
|
21
21
|
type: Object,
|
|
22
|
-
required:
|
|
22
|
+
required: true
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
() =>
|
|
29
|
-
() =>
|
|
30
|
-
() =>
|
|
31
|
-
() =>
|
|
25
|
+
setup(props) {
|
|
26
|
+
const dispatch = useAppDispatch();
|
|
27
|
+
watch([
|
|
28
|
+
() => props.width,
|
|
29
|
+
() => props.height,
|
|
30
|
+
() => props.layout,
|
|
31
|
+
() => props.margin
|
|
32
32
|
], () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
dispatch(setLayout(props.layout));
|
|
34
|
+
dispatch(setChartSize({
|
|
35
|
+
width: props.width,
|
|
36
|
+
height: props.height
|
|
37
|
+
}));
|
|
38
|
+
dispatch(setMargin(props.margin));
|
|
39
|
+
}, { immediate: true });
|
|
40
|
+
return () => {
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
38
43
|
}
|
|
39
44
|
});
|
|
40
45
|
//#endregion
|
|
41
|
-
export {
|
|
46
|
+
export { ReportMainChartProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useAppDispatch
|
|
2
|
-
import { updatePolarOptions
|
|
3
|
-
import { defineComponent
|
|
1
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
2
|
+
import { updatePolarOptions } from "./polarOptionsSlice.mjs";
|
|
3
|
+
import { defineComponent, watch } from "vue";
|
|
4
4
|
//#region src/state/ReportPolarOptions.tsx
|
|
5
|
-
var
|
|
5
|
+
var ReportPolarOptions = /* @__PURE__ */ defineComponent({
|
|
6
6
|
name: "ReportPolarOptions",
|
|
7
7
|
props: {
|
|
8
8
|
cx: {
|
|
@@ -30,26 +30,27 @@ var i = /* @__PURE__ */ n({
|
|
|
30
30
|
default: "80%"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
setup(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
() =>
|
|
37
|
-
() =>
|
|
38
|
-
() =>
|
|
39
|
-
() =>
|
|
40
|
-
() =>
|
|
41
|
-
() =>
|
|
33
|
+
setup(props) {
|
|
34
|
+
const dispatch = useAppDispatch();
|
|
35
|
+
watch([
|
|
36
|
+
() => props.cx,
|
|
37
|
+
() => props.cy,
|
|
38
|
+
() => props.startAngle,
|
|
39
|
+
() => props.endAngle,
|
|
40
|
+
() => props.innerRadius,
|
|
41
|
+
() => props.outerRadius
|
|
42
42
|
], () => {
|
|
43
|
-
|
|
44
|
-
cx:
|
|
45
|
-
cy:
|
|
46
|
-
startAngle:
|
|
47
|
-
endAngle:
|
|
48
|
-
innerRadius:
|
|
49
|
-
outerRadius:
|
|
43
|
+
dispatch(updatePolarOptions({
|
|
44
|
+
cx: props.cx,
|
|
45
|
+
cy: props.cy,
|
|
46
|
+
startAngle: props.startAngle,
|
|
47
|
+
endAngle: props.endAngle,
|
|
48
|
+
innerRadius: props.innerRadius,
|
|
49
|
+
outerRadius: props.outerRadius
|
|
50
50
|
}));
|
|
51
|
-
}, { immediate:
|
|
51
|
+
}, { immediate: true });
|
|
52
|
+
return () => null;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
//#endregion
|
|
55
|
-
export {
|
|
56
|
+
export { ReportPolarOptions };
|