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,27 +1,29 @@
|
|
|
1
|
-
import { validateWidthHeight
|
|
2
|
-
import { provideClipPathId
|
|
3
|
-
import { createRechartsStore
|
|
4
|
-
import
|
|
5
|
-
import { ChartDataContextProvider
|
|
6
|
-
import
|
|
7
|
-
import { RechartsWrapper
|
|
8
|
-
import { FULL_WIDTH_AND_HEIGHT
|
|
9
|
-
import { ReportMainChartProps
|
|
10
|
-
import
|
|
11
|
-
import { applyDefaultProps
|
|
12
|
-
import { ReportPolarOptions
|
|
13
|
-
import { Fragment
|
|
14
|
-
import { provideStore
|
|
1
|
+
import { validateWidthHeight } from "../utils/validate.mjs";
|
|
2
|
+
import { provideClipPathId } from "./provideClipPathId.mjs";
|
|
3
|
+
import { createRechartsStore } from "../state/store.mjs";
|
|
4
|
+
import Surface_default from "./Surface.mjs";
|
|
5
|
+
import { ChartDataContextProvider } from "../context/ChartDataContextProvider.mjs";
|
|
6
|
+
import ClipPath_default from "../container/ClipPath.mjs";
|
|
7
|
+
import { RechartsWrapper } from "./RechartsWrapper.mjs";
|
|
8
|
+
import { FULL_WIDTH_AND_HEIGHT } from "./const.mjs";
|
|
9
|
+
import { ReportMainChartProps } from "../state/ReportMainChartProps.mjs";
|
|
10
|
+
import ReportChartProps_default from "../state/ReportChartProps.mjs";
|
|
11
|
+
import { applyDefaultProps } from "../utils/props.mjs";
|
|
12
|
+
import { ReportPolarOptions } from "../state/ReportPolarOptions.mjs";
|
|
13
|
+
import { Fragment, createVNode, defineComponent, mergeProps } from "vue";
|
|
14
|
+
import { provideStore } from "@reduxjs/vue-redux";
|
|
15
15
|
//#region src/chart/generateCategoricalChart.tsx
|
|
16
|
-
var
|
|
16
|
+
var defaultLayout = "horizontal";
|
|
17
|
+
var defaultMargin = {
|
|
17
18
|
top: 5,
|
|
18
19
|
right: 5,
|
|
19
20
|
bottom: 5,
|
|
20
21
|
left: 5
|
|
21
|
-
}
|
|
22
|
+
};
|
|
23
|
+
var CategoricalProps = {
|
|
22
24
|
accessibilityLayer: {
|
|
23
25
|
type: Boolean,
|
|
24
|
-
default:
|
|
26
|
+
default: true
|
|
25
27
|
},
|
|
26
28
|
barCategoryGap: {
|
|
27
29
|
type: [Number, String],
|
|
@@ -52,17 +54,17 @@ var _ = "horizontal", v = {
|
|
|
52
54
|
innerRadius: { type: [Number, String] },
|
|
53
55
|
layout: {
|
|
54
56
|
type: String,
|
|
55
|
-
default:
|
|
57
|
+
default: defaultLayout
|
|
56
58
|
},
|
|
57
59
|
margin: {
|
|
58
60
|
type: Object,
|
|
59
|
-
default: () =>
|
|
61
|
+
default: () => defaultMargin
|
|
60
62
|
},
|
|
61
63
|
maxBarSize: { type: Number },
|
|
62
64
|
outerRadius: { type: [Number, String] },
|
|
63
65
|
reverseStackOrder: {
|
|
64
66
|
type: Boolean,
|
|
65
|
-
default:
|
|
67
|
+
default: false
|
|
66
68
|
},
|
|
67
69
|
role: { type: String },
|
|
68
70
|
stackOffset: {
|
|
@@ -82,85 +84,92 @@ var _ = "horizontal", v = {
|
|
|
82
84
|
width: { type: Number },
|
|
83
85
|
to: { type: [String, Object] }
|
|
84
86
|
};
|
|
85
|
-
function
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
name:
|
|
88
|
-
props:
|
|
89
|
-
setup(
|
|
90
|
-
|
|
91
|
-
chartName
|
|
92
|
-
defaultTooltipEventType
|
|
93
|
-
validateTooltipEventTypes
|
|
94
|
-
tooltipPayloadSearcher
|
|
87
|
+
function generateCategoricalChart({ chartName, defaultProps = {}, defaultTooltipEventType = "axis", validateTooltipEventTypes = ["axis"], tooltipPayloadSearcher }) {
|
|
88
|
+
return /* @__PURE__ */ defineComponent({
|
|
89
|
+
name: chartName,
|
|
90
|
+
props: applyDefaultProps(CategoricalProps, defaultProps),
|
|
91
|
+
setup(props, { attrs, slots }) {
|
|
92
|
+
provideStore({ store: createRechartsStore({ options: {
|
|
93
|
+
chartName,
|
|
94
|
+
defaultTooltipEventType,
|
|
95
|
+
validateTooltipEventTypes,
|
|
96
|
+
tooltipPayloadSearcher,
|
|
95
97
|
eventEmitter: void 0
|
|
96
|
-
} },
|
|
97
|
-
|
|
98
|
+
} }, props.id ?? chartName) });
|
|
99
|
+
const clipPathId = provideClipPathId(props);
|
|
98
100
|
return () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const { compact, width, height, title, desc, ...rest } = props;
|
|
102
|
+
const attributes = { ...attrs };
|
|
103
|
+
if (!validateWidthHeight({
|
|
104
|
+
width,
|
|
105
|
+
height
|
|
103
106
|
})) return null;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
const layout = props.layout ?? defaultProps.layout ?? defaultLayout;
|
|
108
|
+
const isPolarChart = layout === "centric" || layout === "radial";
|
|
109
|
+
if (compact) return createVNode(Fragment, null, [
|
|
110
|
+
createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
|
|
111
|
+
createVNode(ReportMainChartProps, {
|
|
112
|
+
"width": width,
|
|
113
|
+
"height": height,
|
|
114
|
+
"layout": layout,
|
|
115
|
+
"margin": props.margin ?? defaultMargin
|
|
112
116
|
}, null),
|
|
113
|
-
|
|
114
|
-
cx:
|
|
115
|
-
cy:
|
|
116
|
-
startAngle:
|
|
117
|
-
endAngle:
|
|
118
|
-
innerRadius:
|
|
119
|
-
outerRadius:
|
|
117
|
+
isPolarChart && createVNode(ReportPolarOptions, {
|
|
118
|
+
"cx": props.cx ?? "50%",
|
|
119
|
+
"cy": props.cy ?? "50%",
|
|
120
|
+
"startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
|
|
121
|
+
"endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
|
|
122
|
+
"innerRadius": props.innerRadius ?? 0,
|
|
123
|
+
"outerRadius": props.outerRadius ?? "80%"
|
|
120
124
|
}, null),
|
|
121
|
-
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
124
|
-
title:
|
|
125
|
-
desc:
|
|
126
|
-
}), { default: () => [
|
|
125
|
+
createVNode(Surface_default, mergeProps(attrs, rest, {
|
|
126
|
+
"width": width,
|
|
127
|
+
"height": height,
|
|
128
|
+
"title": title,
|
|
129
|
+
"desc": desc
|
|
130
|
+
}), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] })
|
|
127
131
|
]);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
if (props.accessibilityLayer) {
|
|
133
|
+
attributes.tabIndex = props.tabIndex ?? 0;
|
|
134
|
+
attributes.role = props.role ?? "application";
|
|
135
|
+
}
|
|
136
|
+
const eventHandlerAttrs = {};
|
|
137
|
+
const svgAttributes = {};
|
|
138
|
+
for (const [key, value] of Object.entries(attributes)) if (key.startsWith("on") && typeof value === "function") eventHandlerAttrs[key] = value;
|
|
139
|
+
else svgAttributes[key] = value;
|
|
140
|
+
return createVNode(Fragment, null, [
|
|
141
|
+
createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
|
|
142
|
+
createVNode(ReportMainChartProps, {
|
|
143
|
+
"width": width,
|
|
144
|
+
"height": height,
|
|
145
|
+
"layout": layout,
|
|
146
|
+
"margin": props.margin ?? defaultMargin
|
|
138
147
|
}, null),
|
|
139
|
-
|
|
140
|
-
cx:
|
|
141
|
-
cy:
|
|
142
|
-
startAngle:
|
|
143
|
-
endAngle:
|
|
144
|
-
innerRadius:
|
|
145
|
-
outerRadius:
|
|
148
|
+
isPolarChart && createVNode(ReportPolarOptions, {
|
|
149
|
+
"cx": props.cx ?? "50%",
|
|
150
|
+
"cy": props.cy ?? "50%",
|
|
151
|
+
"startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
|
|
152
|
+
"endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
|
|
153
|
+
"innerRadius": props.innerRadius ?? 0,
|
|
154
|
+
"outerRadius": props.outerRadius ?? "80%"
|
|
146
155
|
}, null),
|
|
147
|
-
|
|
148
|
-
style:
|
|
149
|
-
class:
|
|
150
|
-
width:
|
|
151
|
-
height:
|
|
152
|
-
},
|
|
153
|
-
width:
|
|
154
|
-
height:
|
|
155
|
-
title:
|
|
156
|
-
desc:
|
|
157
|
-
style:
|
|
158
|
-
}), { default: () => [
|
|
159
|
-
|
|
156
|
+
createVNode(RechartsWrapper, mergeProps({
|
|
157
|
+
"style": props.style,
|
|
158
|
+
"class": props.class,
|
|
159
|
+
"width": width,
|
|
160
|
+
"height": height
|
|
161
|
+
}, eventHandlerAttrs), { default: () => [createVNode(Surface_default, mergeProps(svgAttributes, {
|
|
162
|
+
"width": width,
|
|
163
|
+
"height": height,
|
|
164
|
+
"title": title,
|
|
165
|
+
"desc": desc,
|
|
166
|
+
"style": FULL_WIDTH_AND_HEIGHT
|
|
167
|
+
}), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] }), slots.tooltip?.()] }),
|
|
168
|
+
createVNode(ReportChartProps_default, props, null)
|
|
160
169
|
]);
|
|
161
170
|
};
|
|
162
171
|
}
|
|
163
172
|
});
|
|
164
173
|
}
|
|
165
174
|
//#endregion
|
|
166
|
-
export {
|
|
175
|
+
export { generateCategoricalChart };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { uniqueId
|
|
2
|
-
import { createContext
|
|
1
|
+
import { uniqueId } from "../utils/data-utils.mjs";
|
|
2
|
+
import { createContext } from "../utils/createContext.mjs";
|
|
3
3
|
//#region src/chart/provideClipPathId.ts
|
|
4
|
-
var [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var [useClipPathId, provideClipPathIdRaw] = createContext("clipPathId");
|
|
5
|
+
/**
|
|
6
|
+
* Provide the clipPathId to child components.
|
|
7
|
+
* @param props - The props object from the chart component
|
|
8
|
+
*/
|
|
9
|
+
function provideClipPathId(props) {
|
|
10
|
+
const clipPathId = `${props.id ?? uniqueId("v-charts")}-clip`;
|
|
11
|
+
provideClipPathIdRaw(clipPathId);
|
|
12
|
+
return clipPathId;
|
|
8
13
|
}
|
|
9
14
|
//#endregion
|
|
10
|
-
export {
|
|
15
|
+
export { provideClipPathId, useClipPathId };
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
2
|
//#region src/components/Cell.tsx
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Cell is a marker component used to define per-item colors and styles.
|
|
5
|
+
* It renders nothing — parent components (Bar, Pie, etc.) read Cell
|
|
6
|
+
* children from the default slot and apply their props by index.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```vue
|
|
10
|
+
* <Bar data-key="value">
|
|
11
|
+
* <Cell v-for="(entry, index) in data" :key="index" :fill="COLORS[index]" />
|
|
12
|
+
* </Bar>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
var Cell = /* @__PURE__ */ defineComponent({
|
|
4
16
|
name: "Cell",
|
|
5
|
-
inheritAttrs:
|
|
17
|
+
inheritAttrs: false,
|
|
6
18
|
setup() {
|
|
7
19
|
return () => null;
|
|
8
20
|
}
|
|
9
21
|
});
|
|
10
22
|
//#endregion
|
|
11
|
-
export {
|
|
23
|
+
export { Cell };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Text_vue_vue_type_script_setup_true_lang_default from "./Text.vue_vue_type_script_setup_true_lang.mjs";
|
|
2
2
|
//#region src/components/Text.vue
|
|
3
|
-
var
|
|
3
|
+
var Text_default = Text_vue_vue_type_script_setup_true_lang_default;
|
|
4
4
|
//#endregion
|
|
5
|
-
export {
|
|
5
|
+
export { Text_default as default };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { getStringSize
|
|
2
|
-
import { reduceCSSCalc
|
|
3
|
-
import { Fragment
|
|
1
|
+
import { getStringSize } from "../utils/attrs.mjs";
|
|
2
|
+
import { reduceCSSCalc } from "../utils/ReduceCSSCalc.mjs";
|
|
3
|
+
import { Fragment, computed, createElementBlock, defineComponent, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
|
|
4
4
|
//#region src/components/Text.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
5
|
+
var _hoisted_1 = [
|
|
6
6
|
"x",
|
|
7
7
|
"y",
|
|
8
8
|
"transform",
|
|
9
9
|
"text-anchor",
|
|
10
10
|
"fill"
|
|
11
|
-
]
|
|
11
|
+
];
|
|
12
|
+
var _hoisted_2 = ["x", "dy"];
|
|
13
|
+
var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
12
14
|
__name: "Text",
|
|
13
15
|
props: {
|
|
14
16
|
x: {
|
|
@@ -37,7 +39,7 @@ var u = [
|
|
|
37
39
|
},
|
|
38
40
|
scaleToFit: {
|
|
39
41
|
type: Boolean,
|
|
40
|
-
default:
|
|
42
|
+
default: false
|
|
41
43
|
},
|
|
42
44
|
textAnchor: {
|
|
43
45
|
type: String,
|
|
@@ -61,7 +63,7 @@ var u = [
|
|
|
61
63
|
},
|
|
62
64
|
breakAll: {
|
|
63
65
|
type: Boolean,
|
|
64
|
-
default:
|
|
66
|
+
default: false
|
|
65
67
|
},
|
|
66
68
|
maxLines: {
|
|
67
69
|
type: Number,
|
|
@@ -76,79 +78,114 @@ var u = [
|
|
|
76
78
|
default: ""
|
|
77
79
|
}
|
|
78
80
|
},
|
|
79
|
-
setup(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
setup(__props) {
|
|
82
|
+
const props = __props;
|
|
83
|
+
const BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
|
|
84
|
+
function calculateWordWidths(children, breakAll, style) {
|
|
85
|
+
let words = [];
|
|
86
|
+
if (children !== void 0 && children !== null) words = breakAll ? children.toString().split("") : children.toString().split(BREAKING_SPACES);
|
|
87
|
+
return {
|
|
88
|
+
wordsWithComputedWidth: words.map((word) => ({
|
|
89
|
+
word,
|
|
90
|
+
width: getStringSize(word, style).width
|
|
87
91
|
})),
|
|
88
|
-
spaceWidth:
|
|
92
|
+
spaceWidth: breakAll ? 0 : getStringSize("\xA0", style).width
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
95
|
+
function calculateWordsByLines(maxLines, value, style, breakAll, initialWordsWithComputedWidth, spaceWidth, lineWidth, scaleToFit) {
|
|
96
|
+
const shouldLimitLines = typeof maxLines === "number";
|
|
97
|
+
const text = value;
|
|
98
|
+
const calculate = (words = []) => {
|
|
99
|
+
return words.reduce((result, { word, width }) => {
|
|
100
|
+
const currentLine = result[result.length - 1];
|
|
101
|
+
if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {
|
|
102
|
+
currentLine.words.push(word);
|
|
103
|
+
currentLine.width += width + spaceWidth;
|
|
104
|
+
} else result.push({
|
|
105
|
+
words: [word],
|
|
106
|
+
width
|
|
107
|
+
});
|
|
108
|
+
return result;
|
|
109
|
+
}, []);
|
|
110
|
+
};
|
|
111
|
+
const originalResult = calculate(initialWordsWithComputedWidth);
|
|
112
|
+
const findLongestLine = (words) => words.reduce((a, b) => a.width > b.width ? a : b);
|
|
113
|
+
if (!shouldLimitLines || scaleToFit) return originalResult;
|
|
114
|
+
if (!(originalResult.length > maxLines || findLongestLine(originalResult).width > Number(lineWidth))) return originalResult;
|
|
115
|
+
const suffix = "…";
|
|
116
|
+
const checkOverflow = (index) => {
|
|
117
|
+
const { wordsWithComputedWidth } = calculateWordWidths(text.slice(0, index) + suffix, breakAll, style);
|
|
118
|
+
const result = calculate(wordsWithComputedWidth);
|
|
119
|
+
return [result.length > maxLines || findLongestLine(result).width > Number(lineWidth), result];
|
|
120
|
+
};
|
|
121
|
+
let start = 0;
|
|
122
|
+
let end = text.length - 1;
|
|
123
|
+
let iterations = 0;
|
|
124
|
+
let trimmedResult;
|
|
125
|
+
while (start <= end && iterations <= text.length - 1) {
|
|
126
|
+
const middle = Math.floor((start + end) / 2);
|
|
127
|
+
const [doesPrevOverflow, result] = checkOverflow(middle - 1);
|
|
128
|
+
const [doesMiddleOverflow] = checkOverflow(middle);
|
|
129
|
+
if (!doesPrevOverflow && !doesMiddleOverflow) start = middle + 1;
|
|
130
|
+
if (doesPrevOverflow && doesMiddleOverflow) end = middle - 1;
|
|
131
|
+
if (!doesPrevOverflow && doesMiddleOverflow) {
|
|
132
|
+
trimmedResult = result;
|
|
108
133
|
break;
|
|
109
134
|
}
|
|
110
|
-
|
|
135
|
+
iterations++;
|
|
111
136
|
}
|
|
112
|
-
return
|
|
137
|
+
return trimmedResult || originalResult;
|
|
113
138
|
}
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
139
|
+
function getWordsByLines({ width, scaleToFit, value, style, breakAll, maxLines }) {
|
|
140
|
+
if (width || scaleToFit) {
|
|
141
|
+
const wordWidths = calculateWordWidths(value, breakAll, style);
|
|
142
|
+
const wordsWithComputedWidth = wordWidths.wordsWithComputedWidth;
|
|
143
|
+
const spaceWidth = wordWidths.spaceWidth;
|
|
144
|
+
return calculateWordsByLines(maxLines, value, style, breakAll, wordsWithComputedWidth, spaceWidth, width, scaleToFit);
|
|
118
145
|
}
|
|
119
|
-
return [{ words:
|
|
146
|
+
return [{ words: value !== void 0 && value !== null ? value.toString().split(BREAKING_SPACES) : [] }];
|
|
120
147
|
}
|
|
121
|
-
|
|
122
|
-
width:
|
|
123
|
-
scaleToFit:
|
|
124
|
-
value:
|
|
125
|
-
style:
|
|
126
|
-
breakAll:
|
|
127
|
-
maxLines:
|
|
128
|
-
}))
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
const wordsByLines = computed(() => getWordsByLines({
|
|
149
|
+
width: props.width,
|
|
150
|
+
scaleToFit: props.scaleToFit,
|
|
151
|
+
value: props.value,
|
|
152
|
+
style: props.style,
|
|
153
|
+
breakAll: props.breakAll,
|
|
154
|
+
maxLines: props.maxLines
|
|
155
|
+
}));
|
|
156
|
+
const x = computed(() => Number(props.x) + (typeof props.dx === "number" ? props.dx : 0));
|
|
157
|
+
const y = computed(() => Number(props.y) + (typeof props.dy === "number" ? props.dy : 0));
|
|
158
|
+
const startDy = computed(() => {
|
|
159
|
+
switch (props.verticalAnchor) {
|
|
160
|
+
case "start": return reduceCSSCalc(`calc(${props.capHeight})`);
|
|
161
|
+
case "middle": return reduceCSSCalc(`calc(${(wordsByLines.value.length - 1) / 2} * -${props.lineHeight} + (${props.capHeight} / 2))`);
|
|
162
|
+
default: return reduceCSSCalc(`calc(${wordsByLines.value.length - 1} * -${props.lineHeight})`);
|
|
133
163
|
}
|
|
134
|
-
}), x = r(() => {
|
|
135
|
-
let e = [];
|
|
136
|
-
return f.scaleToFit && _.value[0]?.width && f.width && e.push(`scale(${Number(f.width) / _.value[0].width})`), f.angle && e.push(`rotate(${f.angle}, ${v.value}, ${y.value})`), e.join(" ");
|
|
137
164
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
const transforms = computed(() => {
|
|
166
|
+
const arr = [];
|
|
167
|
+
if (props.scaleToFit && wordsByLines.value[0]?.width && props.width) arr.push(`scale(${Number(props.width) / wordsByLines.value[0].width})`);
|
|
168
|
+
if (props.angle) arr.push(`rotate(${props.angle}, ${x.value}, ${y.value})`);
|
|
169
|
+
return arr.join(" ");
|
|
170
|
+
});
|
|
171
|
+
return (_ctx, _cache) => {
|
|
172
|
+
return openBlock(), createElementBlock("text", {
|
|
173
|
+
x: x.value,
|
|
174
|
+
y: y.value,
|
|
175
|
+
transform: transforms.value || void 0,
|
|
176
|
+
"text-anchor": props.textAnchor,
|
|
177
|
+
fill: props.fill && props.fill.includes("url") ? "#808080" : props.fill,
|
|
178
|
+
class: "v-charts-text",
|
|
179
|
+
style: normalizeStyle(props.style)
|
|
180
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(wordsByLines.value, (line, index) => {
|
|
181
|
+
return openBlock(), createElementBlock("tspan", {
|
|
182
|
+
key: index,
|
|
183
|
+
x: x.value,
|
|
184
|
+
dy: index === 0 ? startDy.value : props.lineHeight
|
|
185
|
+
}, toDisplayString(line.words.join(props.breakAll ? "" : " ")), 9, _hoisted_2);
|
|
186
|
+
}), 128))], 12, _hoisted_1);
|
|
187
|
+
};
|
|
151
188
|
}
|
|
152
189
|
});
|
|
153
190
|
//#endregion
|
|
154
|
-
export {
|
|
191
|
+
export { Text_vue_vue_type_script_setup_true_lang_default as default };
|