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,10 +1,10 @@
|
|
|
1
|
-
import { CurveVueProps
|
|
1
|
+
import { CurveVueProps } from "../../shape/Curve.mjs";
|
|
2
2
|
//#region src/cartesian/area/type.ts
|
|
3
|
-
var
|
|
4
|
-
...
|
|
3
|
+
var AreaVueProps = {
|
|
4
|
+
...CurveVueProps,
|
|
5
5
|
activeDot: {
|
|
6
6
|
type: Boolean,
|
|
7
|
-
default:
|
|
7
|
+
default: true
|
|
8
8
|
},
|
|
9
9
|
baseValue: {
|
|
10
10
|
type: [Number, String],
|
|
@@ -12,7 +12,7 @@ var t = {
|
|
|
12
12
|
},
|
|
13
13
|
connectNulls: {
|
|
14
14
|
type: Boolean,
|
|
15
|
-
default:
|
|
15
|
+
default: false
|
|
16
16
|
},
|
|
17
17
|
data: {
|
|
18
18
|
type: Array,
|
|
@@ -24,11 +24,11 @@ var t = {
|
|
|
24
24
|
Number,
|
|
25
25
|
Function
|
|
26
26
|
],
|
|
27
|
-
required:
|
|
27
|
+
required: true
|
|
28
28
|
},
|
|
29
29
|
dot: {
|
|
30
30
|
type: Boolean,
|
|
31
|
-
default:
|
|
31
|
+
default: false
|
|
32
32
|
},
|
|
33
33
|
fill: {
|
|
34
34
|
type: String,
|
|
@@ -45,11 +45,11 @@ var t = {
|
|
|
45
45
|
},
|
|
46
46
|
hide: {
|
|
47
47
|
type: Boolean,
|
|
48
|
-
default:
|
|
48
|
+
default: false
|
|
49
49
|
},
|
|
50
50
|
isAnimationActive: {
|
|
51
51
|
type: Boolean,
|
|
52
|
-
default:
|
|
52
|
+
default: true
|
|
53
53
|
},
|
|
54
54
|
label: {
|
|
55
55
|
type: [Boolean, Object],
|
|
@@ -76,7 +76,7 @@ var t = {
|
|
|
76
76
|
},
|
|
77
77
|
needClip: {
|
|
78
78
|
type: Boolean,
|
|
79
|
-
default:
|
|
79
|
+
default: false
|
|
80
80
|
},
|
|
81
81
|
stackId: {
|
|
82
82
|
type: [String, Number],
|
|
@@ -133,4 +133,4 @@ var t = {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
//#endregion
|
|
136
|
-
export {
|
|
136
|
+
export { AreaVueProps };
|
|
@@ -1,59 +1,79 @@
|
|
|
1
|
-
import { isNumber
|
|
2
|
-
import { getCateCoordinateOfLine
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { getCateCoordinateOfLine, getValueByDataKey } from "../../utils/chart.mjs";
|
|
3
3
|
//#region src/cartesian/area/utils.ts
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
function getBaseValue(layout, chartBaseValue, itemBaseValue, xAxis, yAxis) {
|
|
5
|
+
const baseValue = itemBaseValue ?? chartBaseValue;
|
|
6
|
+
if (isNumber(baseValue)) return baseValue;
|
|
7
|
+
const numericAxis = layout === "horizontal" ? yAxis : xAxis;
|
|
8
|
+
const domain = numericAxis.scale.domain();
|
|
9
|
+
if (numericAxis.type === "number") {
|
|
10
|
+
const domainMax = Math.max(domain[0], domain[1]);
|
|
11
|
+
const domainMin = Math.min(domain[0], domain[1]);
|
|
12
|
+
if (baseValue === "dataMin") return domainMin;
|
|
13
|
+
if (baseValue === "dataMax") return domainMax;
|
|
14
|
+
return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
if (baseValue === "dataMin") return domain[0];
|
|
17
|
+
if (baseValue === "dataMax") return domain[1];
|
|
18
|
+
return domain[0];
|
|
13
19
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function computeArea({ areaSettings: { connectNulls, baseValue: itemBaseValue, dataKey }, stackedData, layout, chartBaseValue, xAxis, yAxis, displayedData, dataStartIndex, xAxisTicks, yAxisTicks, bandSize }) {
|
|
21
|
+
const hasStack = stackedData && stackedData.length;
|
|
22
|
+
const baseValue = getBaseValue(layout, chartBaseValue, itemBaseValue, xAxis, yAxis);
|
|
23
|
+
const isHorizontalLayout = layout === "horizontal";
|
|
24
|
+
let isRange = false;
|
|
25
|
+
const points = displayedData.map((entry, index) => {
|
|
26
|
+
let value;
|
|
27
|
+
if (hasStack) value = stackedData[dataStartIndex + index];
|
|
28
|
+
else {
|
|
29
|
+
value = getValueByDataKey(entry, dataKey);
|
|
30
|
+
if (!Array.isArray(value)) value = [baseValue, value];
|
|
31
|
+
else isRange = true;
|
|
32
|
+
}
|
|
33
|
+
const isBreakPoint = value[1] == null || hasStack && !connectNulls && getValueByDataKey(entry, dataKey) == null;
|
|
34
|
+
if (isHorizontalLayout) return {
|
|
35
|
+
x: getCateCoordinateOfLine({
|
|
36
|
+
axis: xAxis,
|
|
37
|
+
ticks: xAxisTicks,
|
|
38
|
+
bandSize,
|
|
39
|
+
entry,
|
|
40
|
+
index
|
|
26
41
|
}),
|
|
27
|
-
y:
|
|
28
|
-
value
|
|
29
|
-
payload:
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
y: isBreakPoint ? null : yAxis.scale(value[1]),
|
|
43
|
+
value,
|
|
44
|
+
payload: entry
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
x: isBreakPoint ? null : xAxis.scale(value[1]),
|
|
48
|
+
y: getCateCoordinateOfLine({
|
|
49
|
+
axis: yAxis,
|
|
50
|
+
ticks: yAxisTicks,
|
|
51
|
+
bandSize,
|
|
52
|
+
entry,
|
|
53
|
+
index
|
|
38
54
|
}),
|
|
39
|
-
value
|
|
40
|
-
payload:
|
|
55
|
+
value,
|
|
56
|
+
payload: entry
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
let baseLine;
|
|
60
|
+
if (hasStack || isRange) baseLine = points.map((entry) => {
|
|
61
|
+
const x = Array.isArray(entry.value) ? entry.value[0] : null;
|
|
62
|
+
if (isHorizontalLayout) return {
|
|
63
|
+
x: entry.x,
|
|
64
|
+
y: x != null && entry.y != null ? yAxis.scale(x) : null
|
|
41
65
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return v ? {
|
|
46
|
-
x: e.x,
|
|
47
|
-
y: t != null && e.y != null ? u.scale(t) : null
|
|
48
|
-
} : {
|
|
49
|
-
x: t == null ? null : l.scale(t),
|
|
50
|
-
y: e.y
|
|
66
|
+
return {
|
|
67
|
+
x: x != null ? xAxis.scale(x) : null,
|
|
68
|
+
y: entry.y
|
|
51
69
|
};
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
});
|
|
71
|
+
else baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);
|
|
72
|
+
return {
|
|
73
|
+
points,
|
|
74
|
+
baseLine,
|
|
75
|
+
isRange
|
|
56
76
|
};
|
|
57
77
|
}
|
|
58
78
|
//#endregion
|
|
59
|
-
export {
|
|
79
|
+
export { computeArea };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { useIsPanorama
|
|
2
|
-
import { selectAxisViewBox
|
|
3
|
-
import { implicitXAxis
|
|
4
|
-
import { useAppDispatch
|
|
5
|
-
import { addXAxis
|
|
6
|
-
import { CartesianAxis
|
|
7
|
-
import { createVNode
|
|
1
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
2
|
+
import { selectAxisViewBox } from "../../state/selectors/selectChartOffset.mjs";
|
|
3
|
+
import { implicitXAxis, selectAxisScale, selectTicksOfAxis, selectXAxisPosition, selectXAxisSize } from "../../state/selectors/axisSelectors.mjs";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
|
|
5
|
+
import { addXAxis, removeXAxis } from "../../state/cartesianAxisSlice.mjs";
|
|
6
|
+
import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
|
|
7
|
+
import { createVNode, defineComponent, mergeProps, watchEffect } from "vue";
|
|
8
8
|
//#region src/cartesian/axis/XAxis.tsx
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @fileOverview X Axis
|
|
11
|
+
*/
|
|
12
|
+
var XAxisImpl = /* @__PURE__ */ defineComponent({
|
|
10
13
|
props: {
|
|
11
14
|
xAxisId: {
|
|
12
15
|
type: [String, Number],
|
|
@@ -14,24 +17,32 @@ var g = /* @__PURE__ */ p({
|
|
|
14
17
|
},
|
|
15
18
|
ticks: Array
|
|
16
19
|
},
|
|
17
|
-
inheritAttrs:
|
|
18
|
-
setup(
|
|
19
|
-
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
setup(props, { attrs, slots }) {
|
|
22
|
+
const isPanorama = useIsPanorama();
|
|
23
|
+
const axisType = "xAxis";
|
|
24
|
+
const scale = useAppSelector((state) => selectAxisScale(state, axisType, props.xAxisId, isPanorama));
|
|
25
|
+
const axisSize = useAppSelector((state) => selectXAxisSize(state, props.xAxisId));
|
|
26
|
+
const position = useAppSelector((state) => selectXAxisPosition(state, props.xAxisId));
|
|
27
|
+
const cartesianTickItems = useAppSelector((state) => selectTicksOfAxis(state, axisType, props.xAxisId, isPanorama));
|
|
28
|
+
const viewBox = useAppSelector(selectAxisViewBox);
|
|
20
29
|
return () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const { ticks, ...allOtherProps } = props;
|
|
31
|
+
if (axisSize.value == null || position.value == null) return null;
|
|
32
|
+
return createVNode(CartesianAxis, mergeProps(allOtherProps, attrs, {
|
|
33
|
+
"viewBox": viewBox.value,
|
|
34
|
+
"scale": scale.value,
|
|
35
|
+
"x": position.value?.x,
|
|
36
|
+
"y": position.value?.y,
|
|
37
|
+
"width": axisSize.value?.width,
|
|
38
|
+
"height": axisSize.value?.height,
|
|
39
|
+
"ticks": cartesianTickItems.value,
|
|
40
|
+
"class": ["v-charts-xAxis xAxis", attrs.class]
|
|
41
|
+
}), { default: () => [slots.tick ? { tick: slots.tick } : void 0] });
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
|
-
})
|
|
44
|
+
});
|
|
45
|
+
var XAxisSettingsDispatcher = /* @__PURE__ */ defineComponent({
|
|
35
46
|
props: {
|
|
36
47
|
interval: [String, Number],
|
|
37
48
|
xAxisId: [String, Number],
|
|
@@ -61,94 +72,97 @@ var g = /* @__PURE__ */ p({
|
|
|
61
72
|
minTickGap: Number,
|
|
62
73
|
tick: {
|
|
63
74
|
type: [Boolean, Object],
|
|
64
|
-
default:
|
|
75
|
+
default: true
|
|
65
76
|
},
|
|
66
77
|
tickFormatter: Function
|
|
67
78
|
},
|
|
68
|
-
setup(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
interval:
|
|
73
|
-
id:
|
|
74
|
-
scale:
|
|
75
|
-
type:
|
|
76
|
-
padding:
|
|
77
|
-
allowDataOverflow:
|
|
78
|
-
domain:
|
|
79
|
-
dataKey:
|
|
80
|
-
allowDuplicatedCategory:
|
|
81
|
-
allowDecimals:
|
|
82
|
-
tickCount:
|
|
83
|
-
includeHidden:
|
|
84
|
-
reversed:
|
|
85
|
-
ticks:
|
|
86
|
-
height:
|
|
87
|
-
orientation:
|
|
88
|
-
mirror:
|
|
89
|
-
hide:
|
|
90
|
-
unit:
|
|
91
|
-
name:
|
|
92
|
-
angle:
|
|
93
|
-
minTickGap:
|
|
94
|
-
tick:
|
|
95
|
-
tickFormatter:
|
|
79
|
+
setup(props, { slots: dispatcherSlots }) {
|
|
80
|
+
const dispatch = useAppDispatch();
|
|
81
|
+
watchEffect((onCleanup) => {
|
|
82
|
+
const settings = {
|
|
83
|
+
interval: props.interval ?? "preserveEnd",
|
|
84
|
+
id: props.xAxisId,
|
|
85
|
+
scale: props.scale,
|
|
86
|
+
type: props.type,
|
|
87
|
+
padding: props.padding,
|
|
88
|
+
allowDataOverflow: props.allowDataOverflow,
|
|
89
|
+
domain: props.domain,
|
|
90
|
+
dataKey: props.dataKey,
|
|
91
|
+
allowDuplicatedCategory: props.allowDuplicatedCategory,
|
|
92
|
+
allowDecimals: props.allowDecimals,
|
|
93
|
+
tickCount: props.tickCount,
|
|
94
|
+
includeHidden: props.includeHidden ?? false,
|
|
95
|
+
reversed: props.reversed,
|
|
96
|
+
ticks: props.ticks,
|
|
97
|
+
height: props.height,
|
|
98
|
+
orientation: props.orientation,
|
|
99
|
+
mirror: props.mirror,
|
|
100
|
+
hide: props.hide,
|
|
101
|
+
unit: props.unit,
|
|
102
|
+
name: props.name,
|
|
103
|
+
angle: props.angle ?? 0,
|
|
104
|
+
minTickGap: props.minTickGap ?? 5,
|
|
105
|
+
tick: props.tick ?? true,
|
|
106
|
+
tickFormatter: props.tickFormatter
|
|
96
107
|
};
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
dispatch(addXAxis(settings));
|
|
109
|
+
onCleanup(() => {
|
|
110
|
+
dispatch(removeXAxis(settings));
|
|
99
111
|
});
|
|
100
|
-
})
|
|
112
|
+
});
|
|
113
|
+
return () => createVNode(XAxisImpl, props, { default: () => [dispatcherSlots.tick ? { tick: dispatcherSlots.tick } : void 0] });
|
|
101
114
|
}
|
|
102
|
-
})
|
|
115
|
+
});
|
|
116
|
+
var XAxis = /* @__PURE__ */ defineComponent({
|
|
103
117
|
name: "XAxis",
|
|
104
118
|
props: {
|
|
105
119
|
allowDataOverflow: {
|
|
106
120
|
type: Boolean,
|
|
107
|
-
default:
|
|
121
|
+
default: implicitXAxis.allowDataOverflow
|
|
108
122
|
},
|
|
109
123
|
allowDecimals: {
|
|
110
124
|
type: Boolean,
|
|
111
|
-
default:
|
|
125
|
+
default: implicitXAxis.allowDecimals
|
|
112
126
|
},
|
|
113
127
|
allowDuplicatedCategory: {
|
|
114
128
|
type: Boolean,
|
|
115
|
-
default:
|
|
129
|
+
default: implicitXAxis.allowDuplicatedCategory
|
|
116
130
|
},
|
|
117
131
|
height: {
|
|
118
132
|
type: Number,
|
|
119
|
-
default:
|
|
133
|
+
default: implicitXAxis.height
|
|
120
134
|
},
|
|
121
135
|
hide: {
|
|
122
136
|
type: Boolean,
|
|
123
|
-
default:
|
|
137
|
+
default: false
|
|
124
138
|
},
|
|
125
139
|
mirror: {
|
|
126
140
|
type: Boolean,
|
|
127
|
-
default:
|
|
141
|
+
default: implicitXAxis.mirror
|
|
128
142
|
},
|
|
129
143
|
orientation: {
|
|
130
144
|
type: String,
|
|
131
|
-
default:
|
|
145
|
+
default: implicitXAxis.orientation
|
|
132
146
|
},
|
|
133
147
|
padding: {
|
|
134
148
|
type: Object,
|
|
135
|
-
default:
|
|
149
|
+
default: implicitXAxis.padding
|
|
136
150
|
},
|
|
137
151
|
reversed: {
|
|
138
152
|
type: Boolean,
|
|
139
|
-
default:
|
|
153
|
+
default: implicitXAxis.reversed
|
|
140
154
|
},
|
|
141
155
|
scale: {
|
|
142
156
|
type: [String, Function],
|
|
143
|
-
default:
|
|
157
|
+
default: implicitXAxis.scale
|
|
144
158
|
},
|
|
145
159
|
tickCount: {
|
|
146
160
|
type: Number,
|
|
147
|
-
default:
|
|
161
|
+
default: implicitXAxis.tickCount
|
|
148
162
|
},
|
|
149
163
|
type: {
|
|
150
164
|
type: String,
|
|
151
|
-
default:
|
|
165
|
+
default: implicitXAxis.type
|
|
152
166
|
},
|
|
153
167
|
xAxisId: {
|
|
154
168
|
type: [String, Number],
|
|
@@ -165,14 +179,14 @@ var g = /* @__PURE__ */ p({
|
|
|
165
179
|
domain: { type: Array },
|
|
166
180
|
axisLine: {
|
|
167
181
|
type: Boolean,
|
|
168
|
-
default:
|
|
182
|
+
default: true
|
|
169
183
|
},
|
|
170
184
|
ticks: { type: Array },
|
|
171
185
|
interval: { type: [String, Number] },
|
|
172
186
|
unit: { type: String },
|
|
173
187
|
tickLine: {
|
|
174
188
|
type: [Boolean, Object],
|
|
175
|
-
default:
|
|
189
|
+
default: true
|
|
176
190
|
},
|
|
177
191
|
tickMargin: Number,
|
|
178
192
|
minTickGap: {
|
|
@@ -181,9 +195,9 @@ var g = /* @__PURE__ */ p({
|
|
|
181
195
|
},
|
|
182
196
|
tickFormatter: Function
|
|
183
197
|
},
|
|
184
|
-
setup(
|
|
185
|
-
return () =>
|
|
198
|
+
setup(props, { attrs, slots }) {
|
|
199
|
+
return () => createVNode(XAxisSettingsDispatcher, mergeProps(props, attrs), { default: () => [slots.tick ? { tick: slots.tick } : void 0] });
|
|
186
200
|
}
|
|
187
201
|
});
|
|
188
202
|
//#endregion
|
|
189
|
-
export {
|
|
203
|
+
export { XAxis };
|
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
import { useIsPanorama
|
|
2
|
-
import { selectAxisViewBox
|
|
3
|
-
import { implicitYAxis
|
|
4
|
-
import { useAppDispatch
|
|
5
|
-
import { addYAxis
|
|
6
|
-
import { CartesianAxis
|
|
7
|
-
import { createVNode
|
|
1
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
2
|
+
import { selectAxisViewBox } from "../../state/selectors/selectChartOffset.mjs";
|
|
3
|
+
import { implicitYAxis, selectAxisScale, selectTicksOfAxis, selectYAxisPosition, selectYAxisSize } from "../../state/selectors/axisSelectors.mjs";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
|
|
5
|
+
import { addYAxis, removeYAxis } from "../../state/cartesianAxisSlice.mjs";
|
|
6
|
+
import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
|
|
7
|
+
import { createVNode, defineComponent, mergeProps, watchEffect } from "vue";
|
|
8
8
|
//#region src/cartesian/axis/YAxis.tsx
|
|
9
|
-
var
|
|
9
|
+
var YAxisImpl = /* @__PURE__ */ defineComponent({
|
|
10
10
|
props: { yAxisId: {
|
|
11
11
|
type: [String, Number],
|
|
12
12
|
default: 0
|
|
13
13
|
} },
|
|
14
|
-
inheritAttrs:
|
|
15
|
-
setup(
|
|
16
|
-
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
setup(props, { attrs }) {
|
|
16
|
+
const isPanorama = useIsPanorama();
|
|
17
|
+
const axisType = "yAxis";
|
|
18
|
+
const scale = useAppSelector((state) => selectAxisScale(state, axisType, props.yAxisId, isPanorama));
|
|
19
|
+
const axisSize = useAppSelector((state) => selectYAxisSize(state, props.yAxisId));
|
|
20
|
+
const position = useAppSelector((state) => selectYAxisPosition(state, props.yAxisId));
|
|
21
|
+
const cartesianTickItems = useAppSelector((state) => selectTicksOfAxis(state, axisType, props.yAxisId, isPanorama));
|
|
22
|
+
const viewBox = useAppSelector(selectAxisViewBox);
|
|
17
23
|
return () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const { ...allOtherProps } = props;
|
|
25
|
+
if (axisSize.value == null || position.value == null) return null;
|
|
26
|
+
return createVNode(CartesianAxis, mergeProps(allOtherProps, attrs, {
|
|
27
|
+
"viewBox": viewBox.value,
|
|
28
|
+
"scale": scale.value,
|
|
29
|
+
"x": position.value?.x,
|
|
30
|
+
"y": position.value?.y,
|
|
31
|
+
"width": axisSize.value?.width,
|
|
32
|
+
"height": axisSize.value?.height,
|
|
33
|
+
"ticks": cartesianTickItems.value,
|
|
34
|
+
"class": ["v-charts-yAxis yAxis", attrs.class]
|
|
28
35
|
}), null);
|
|
29
36
|
};
|
|
30
37
|
}
|
|
31
|
-
})
|
|
38
|
+
});
|
|
39
|
+
var YAxisSettingsDispatcher = /* @__PURE__ */ defineComponent({
|
|
32
40
|
props: {
|
|
33
41
|
interval: [String, Number],
|
|
34
42
|
yAxisId: {
|
|
@@ -55,7 +63,7 @@ var g = /* @__PURE__ */ p({
|
|
|
55
63
|
minTickGap: Number,
|
|
56
64
|
tick: {
|
|
57
65
|
type: [Boolean, Object],
|
|
58
|
-
default:
|
|
66
|
+
default: true
|
|
59
67
|
},
|
|
60
68
|
tickFormatter: Function,
|
|
61
69
|
domain: Array,
|
|
@@ -68,74 +76,77 @@ var g = /* @__PURE__ */ p({
|
|
|
68
76
|
default: void 0
|
|
69
77
|
}
|
|
70
78
|
},
|
|
71
|
-
setup(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
...
|
|
76
|
-
interval:
|
|
77
|
-
id:
|
|
78
|
-
dataKey:
|
|
79
|
-
includeHidden:
|
|
80
|
-
angle:
|
|
81
|
-
minTickGap:
|
|
82
|
-
tick:
|
|
79
|
+
setup(props) {
|
|
80
|
+
const dispatch = useAppDispatch();
|
|
81
|
+
watchEffect((onCleanup) => {
|
|
82
|
+
const settings = {
|
|
83
|
+
...props,
|
|
84
|
+
interval: props.interval ?? "preserveEnd",
|
|
85
|
+
id: props.yAxisId,
|
|
86
|
+
dataKey: props.dataKey,
|
|
87
|
+
includeHidden: props.includeHidden ?? false,
|
|
88
|
+
angle: props.angle ?? 0,
|
|
89
|
+
minTickGap: props.minTickGap ?? 5,
|
|
90
|
+
tick: props.tick ?? true
|
|
83
91
|
};
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
dispatch(addYAxis(settings));
|
|
93
|
+
onCleanup(() => {
|
|
94
|
+
dispatch(removeYAxis(settings));
|
|
86
95
|
});
|
|
87
|
-
})
|
|
96
|
+
});
|
|
97
|
+
return () => createVNode(YAxisImpl, props, null);
|
|
88
98
|
}
|
|
89
|
-
})
|
|
99
|
+
});
|
|
100
|
+
var YAxis = /* @__PURE__ */ defineComponent({
|
|
90
101
|
name: "YAxis",
|
|
91
102
|
props: {
|
|
92
103
|
allowDataOverflow: {
|
|
93
104
|
type: Boolean,
|
|
94
|
-
default:
|
|
105
|
+
default: implicitYAxis.allowDataOverflow
|
|
95
106
|
},
|
|
96
107
|
allowDecimals: {
|
|
97
108
|
type: Boolean,
|
|
98
|
-
default:
|
|
109
|
+
default: implicitYAxis.allowDecimals
|
|
99
110
|
},
|
|
100
111
|
allowDuplicatedCategory: {
|
|
101
112
|
type: Boolean,
|
|
102
|
-
default:
|
|
113
|
+
default: implicitYAxis.allowDuplicatedCategory
|
|
103
114
|
},
|
|
104
115
|
width: {
|
|
105
116
|
type: Number,
|
|
106
|
-
default:
|
|
117
|
+
default: implicitYAxis.width
|
|
107
118
|
},
|
|
108
119
|
hide: {
|
|
109
120
|
type: Boolean,
|
|
110
|
-
default:
|
|
121
|
+
default: false
|
|
111
122
|
},
|
|
112
123
|
mirror: {
|
|
113
124
|
type: Boolean,
|
|
114
|
-
default:
|
|
125
|
+
default: implicitYAxis.mirror
|
|
115
126
|
},
|
|
116
127
|
orientation: {
|
|
117
128
|
type: String,
|
|
118
|
-
default:
|
|
129
|
+
default: implicitYAxis.orientation
|
|
119
130
|
},
|
|
120
131
|
padding: {
|
|
121
132
|
type: Object,
|
|
122
|
-
default:
|
|
133
|
+
default: implicitYAxis.padding
|
|
123
134
|
},
|
|
124
135
|
reversed: {
|
|
125
136
|
type: Boolean,
|
|
126
|
-
default:
|
|
137
|
+
default: implicitYAxis.reversed
|
|
127
138
|
},
|
|
128
139
|
scale: {
|
|
129
140
|
type: [String, Function],
|
|
130
|
-
default:
|
|
141
|
+
default: implicitYAxis.scale
|
|
131
142
|
},
|
|
132
143
|
tickCount: {
|
|
133
144
|
type: Number,
|
|
134
|
-
default:
|
|
145
|
+
default: implicitYAxis.tickCount
|
|
135
146
|
},
|
|
136
147
|
type: {
|
|
137
148
|
type: String,
|
|
138
|
-
default:
|
|
149
|
+
default: implicitYAxis.type
|
|
139
150
|
},
|
|
140
151
|
yAxisId: { type: [String, Number] },
|
|
141
152
|
dataKey: {
|
|
@@ -161,11 +172,11 @@ var g = /* @__PURE__ */ p({
|
|
|
161
172
|
},
|
|
162
173
|
axisLine: {
|
|
163
174
|
type: [Boolean, Object],
|
|
164
|
-
default:
|
|
175
|
+
default: true
|
|
165
176
|
},
|
|
166
177
|
tickLine: {
|
|
167
178
|
type: [Boolean, Object],
|
|
168
|
-
default:
|
|
179
|
+
default: true
|
|
169
180
|
},
|
|
170
181
|
tickMargin: Number,
|
|
171
182
|
minTickGap: {
|
|
@@ -173,9 +184,9 @@ var g = /* @__PURE__ */ p({
|
|
|
173
184
|
default: 5
|
|
174
185
|
}
|
|
175
186
|
},
|
|
176
|
-
setup(
|
|
177
|
-
return () =>
|
|
187
|
+
setup(props, { attrs }) {
|
|
188
|
+
return () => createVNode(YAxisSettingsDispatcher, mergeProps(props, attrs), null);
|
|
178
189
|
}
|
|
179
190
|
});
|
|
180
191
|
//#endregion
|
|
181
|
-
export {
|
|
192
|
+
export { YAxis };
|