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,45 +1,49 @@
|
|
|
1
|
-
import { isNumber
|
|
2
|
-
import { warn
|
|
3
|
-
import { useIsPanorama
|
|
4
|
-
import { getTicksOfAxis
|
|
5
|
-
import { selectAxisPropsNeededForCartesianGridTicksGenerator
|
|
6
|
-
import { useAppSelector
|
|
7
|
-
import { useChartHeight
|
|
8
|
-
import { CartesianAxisDefaultProps
|
|
9
|
-
import { getTicks
|
|
10
|
-
import { CartesianAxis
|
|
11
|
-
import { resolveDefaultProps
|
|
12
|
-
import { getCoordinatesOfGrid
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { createVNode
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { warn } from "../../utils/log.mjs";
|
|
3
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
4
|
+
import { getTicksOfAxis } from "../../utils/chart.mjs";
|
|
5
|
+
import { selectAxisPropsNeededForCartesianGridTicksGenerator } from "../../state/selectors/axisSelectors.mjs";
|
|
6
|
+
import { useAppSelector } from "../../state/hooks.mjs";
|
|
7
|
+
import { useChartHeight, useChartWidth, useOffset } from "../../context/chartLayoutContext.mjs";
|
|
8
|
+
import { CartesianAxisDefaultProps } from "./const.mjs";
|
|
9
|
+
import { getTicks } from "../utils/get-ticks.mjs";
|
|
10
|
+
import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
|
|
11
|
+
import { resolveDefaultProps } from "../../utils/resolveDefaultProps.mjs";
|
|
12
|
+
import { getCoordinatesOfGrid } from "../../utils/grid.mjs";
|
|
13
|
+
import Background from "./Background.mjs";
|
|
14
|
+
import HorizontalStripes from "./HorizontalStripes.mjs";
|
|
15
|
+
import VerticalStripes from "./VerticalStripes.mjs";
|
|
16
|
+
import HorizontalGridLines from "./HorizontalGridLines.mjs";
|
|
17
|
+
import VerticalGridLines from "./VerticalGridLines.mjs";
|
|
18
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
19
19
|
//#region src/cartesian/cartesian-grid/CartesianGrid.tsx
|
|
20
|
-
var
|
|
21
|
-
...
|
|
22
|
-
...
|
|
23
|
-
ticks:
|
|
20
|
+
var defaultHorizontalCoordinatesGenerator = ({ yAxis, width, height, offset }, syncWithTicks) => getCoordinatesOfGrid(getTicks({
|
|
21
|
+
...CartesianAxisDefaultProps,
|
|
22
|
+
...yAxis,
|
|
23
|
+
ticks: getTicksOfAxis(yAxis, true),
|
|
24
24
|
viewBox: {
|
|
25
25
|
x: 0,
|
|
26
26
|
y: 0,
|
|
27
|
-
width
|
|
28
|
-
height
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
29
|
}
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
}), offset.top, offset.top + offset.height, syncWithTicks);
|
|
31
|
+
var defaultVerticalCoordinatesGenerator = ({ xAxis, width, height, offset }, syncWithTicks) => {
|
|
32
|
+
return getCoordinatesOfGrid(getTicks({
|
|
33
|
+
...CartesianAxis.defaultProps,
|
|
34
|
+
...xAxis,
|
|
35
|
+
ticks: getTicksOfAxis(xAxis, true),
|
|
36
|
+
viewBox: {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0,
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
}
|
|
42
|
+
}), offset.left, offset.left + offset.width, syncWithTicks);
|
|
43
|
+
};
|
|
44
|
+
var defaultProps = {
|
|
45
|
+
horizontal: true,
|
|
46
|
+
vertical: true,
|
|
43
47
|
horizontalPoints: [],
|
|
44
48
|
verticalPoints: [],
|
|
45
49
|
stroke: "#ccc",
|
|
@@ -48,9 +52,10 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
|
|
|
48
52
|
horizontalFill: [],
|
|
49
53
|
xAxisId: 0,
|
|
50
54
|
yAxisId: 0
|
|
51
|
-
}
|
|
55
|
+
};
|
|
56
|
+
var CartesianGrid = /* @__PURE__ */ defineComponent({
|
|
52
57
|
name: "CartesianGrid",
|
|
53
|
-
inheritAttrs:
|
|
58
|
+
inheritAttrs: false,
|
|
54
59
|
props: {
|
|
55
60
|
xAxisId: {
|
|
56
61
|
type: [String, Number],
|
|
@@ -70,11 +75,11 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
|
|
|
70
75
|
},
|
|
71
76
|
horizontal: {
|
|
72
77
|
type: [Boolean, Object],
|
|
73
|
-
default:
|
|
78
|
+
default: true
|
|
74
79
|
},
|
|
75
80
|
vertical: {
|
|
76
81
|
type: [Boolean, Object],
|
|
77
|
-
default:
|
|
82
|
+
default: true
|
|
78
83
|
},
|
|
79
84
|
horizontalPoints: Array,
|
|
80
85
|
verticalPoints: Array,
|
|
@@ -86,70 +91,84 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
|
|
|
86
91
|
verticalCoordinatesGenerator: Function,
|
|
87
92
|
horizontalCoordinatesGenerator: Function
|
|
88
93
|
},
|
|
89
|
-
setup(
|
|
90
|
-
|
|
94
|
+
setup(props, { attrs, slots }) {
|
|
95
|
+
const chartWidth = useChartWidth();
|
|
96
|
+
const chartHeight = useChartHeight();
|
|
97
|
+
const offset = useOffset();
|
|
98
|
+
const isPanorama = useIsPanorama();
|
|
99
|
+
const xAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "xAxis", props.xAxisId, isPanorama));
|
|
100
|
+
const yAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "yAxis", props.yAxisId, isPanorama));
|
|
91
101
|
return () => {
|
|
92
|
-
|
|
93
|
-
...
|
|
94
|
-
...
|
|
95
|
-
...
|
|
96
|
-
},
|
|
97
|
-
x:
|
|
98
|
-
y:
|
|
99
|
-
width:
|
|
100
|
-
height:
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
const propsIncludingDefaults = {
|
|
103
|
+
...resolveDefaultProps({
|
|
104
|
+
...props,
|
|
105
|
+
...attrs
|
|
106
|
+
}, defaultProps),
|
|
107
|
+
x: isNumber(props.x) ? props.x : offset.value.left,
|
|
108
|
+
y: isNumber(props.y) ? props.y : offset.value.top,
|
|
109
|
+
width: isNumber(props.width) ? props.width : offset.value.width,
|
|
110
|
+
height: isNumber(props.height) ? props.height : offset.value.height
|
|
111
|
+
};
|
|
112
|
+
const { x, y, width, height, syncWithTicks, horizontalValues, verticalValues } = propsIncludingDefaults;
|
|
113
|
+
const verticalCoordinatesGenerator = propsIncludingDefaults.verticalCoordinatesGenerator || defaultVerticalCoordinatesGenerator;
|
|
114
|
+
const horizontalCoordinatesGenerator = propsIncludingDefaults.horizontalCoordinatesGenerator || defaultHorizontalCoordinatesGenerator;
|
|
115
|
+
let { horizontalPoints, verticalPoints } = propsIncludingDefaults;
|
|
116
|
+
if ((!horizontalPoints || !horizontalPoints.length) && typeof horizontalCoordinatesGenerator === "function") {
|
|
117
|
+
const isHorizontalValues = horizontalValues && horizontalValues.length;
|
|
118
|
+
const generatorResult = horizontalCoordinatesGenerator({
|
|
119
|
+
yAxis: yAxis.value ? {
|
|
120
|
+
...yAxis.value,
|
|
121
|
+
ticks: isHorizontalValues ? horizontalValues : yAxis.value?.ticks
|
|
107
122
|
} : void 0,
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
110
|
-
offset:
|
|
111
|
-
},
|
|
112
|
-
|
|
123
|
+
width: chartWidth.value,
|
|
124
|
+
height: chartHeight.value,
|
|
125
|
+
offset: offset.value
|
|
126
|
+
}, isHorizontalValues ? true : syncWithTicks);
|
|
127
|
+
warn(Array.isArray(generatorResult), `horizontalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
|
|
128
|
+
if (Array.isArray(generatorResult)) horizontalPoints = generatorResult;
|
|
113
129
|
}
|
|
114
|
-
if ((!
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
if ((!verticalPoints || !verticalPoints.length) && typeof verticalCoordinatesGenerator === "function") {
|
|
131
|
+
const isVerticalValues = verticalValues && verticalValues.length;
|
|
132
|
+
const generatorResult = verticalCoordinatesGenerator({
|
|
133
|
+
xAxis: xAxis.value ? {
|
|
134
|
+
...xAxis.value,
|
|
135
|
+
ticks: isVerticalValues ? verticalValues : xAxis.value?.ticks
|
|
119
136
|
} : void 0,
|
|
120
|
-
width:
|
|
121
|
-
height:
|
|
122
|
-
offset:
|
|
123
|
-
},
|
|
124
|
-
|
|
137
|
+
width: chartWidth.value,
|
|
138
|
+
height: chartHeight.value,
|
|
139
|
+
offset: offset.value
|
|
140
|
+
}, isVerticalValues ? true : syncWithTicks);
|
|
141
|
+
warn(Array.isArray(generatorResult), `verticalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
|
|
142
|
+
if (Array.isArray(generatorResult)) verticalPoints = generatorResult;
|
|
125
143
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0 || !isNumber(x) || x !== +x || !isNumber(y) || y !== +y) return null;
|
|
145
|
+
return createVNode("g", { "class": "v-charts-cartesian-grid" }, [
|
|
146
|
+
createVNode(Background, {
|
|
147
|
+
"fill": propsIncludingDefaults.fill,
|
|
148
|
+
"fillOpacity": propsIncludingDefaults.fillOpacity,
|
|
149
|
+
"x": propsIncludingDefaults.x,
|
|
150
|
+
"y": propsIncludingDefaults.y,
|
|
151
|
+
"width": propsIncludingDefaults.width,
|
|
152
|
+
"height": propsIncludingDefaults.height,
|
|
153
|
+
"ry": propsIncludingDefaults.ry
|
|
135
154
|
}, null),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
offset:
|
|
140
|
-
horizontalPoints:
|
|
141
|
-
xAxis:
|
|
142
|
-
yAxis:
|
|
143
|
-
}), { default: () => [
|
|
144
|
-
|
|
145
|
-
offset:
|
|
146
|
-
verticalPoints:
|
|
147
|
-
xAxis:
|
|
148
|
-
yAxis:
|
|
149
|
-
}), { default: () => [
|
|
155
|
+
createVNode(HorizontalStripes, mergeProps(propsIncludingDefaults, { "horizontalPoints": horizontalPoints }), null),
|
|
156
|
+
createVNode(VerticalStripes, mergeProps(propsIncludingDefaults, { "verticalPoints": verticalPoints }), null),
|
|
157
|
+
createVNode(HorizontalGridLines, mergeProps(propsIncludingDefaults, {
|
|
158
|
+
"offset": offset.value,
|
|
159
|
+
"horizontalPoints": horizontalPoints,
|
|
160
|
+
"xAxis": xAxis.value,
|
|
161
|
+
"yAxis": yAxis.value
|
|
162
|
+
}), { default: () => [slots.horizontal ? { horizontal: slots.horizontal } : void 0] }),
|
|
163
|
+
createVNode(VerticalGridLines, mergeProps(propsIncludingDefaults, {
|
|
164
|
+
"offset": offset,
|
|
165
|
+
"verticalPoints": verticalPoints,
|
|
166
|
+
"xAxis": xAxis,
|
|
167
|
+
"yAxis": yAxis
|
|
168
|
+
}), { default: () => [slots.vertical ? { vertical: slots.vertical } : void 0] })
|
|
150
169
|
]);
|
|
151
170
|
};
|
|
152
171
|
}
|
|
153
172
|
});
|
|
154
173
|
//#endregion
|
|
155
|
-
export {
|
|
174
|
+
export { CartesianGrid };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { renderLineItem
|
|
2
|
-
import { createVNode
|
|
1
|
+
import { renderLineItem } from "./utils.mjs";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
3
|
//#region src/cartesian/cartesian-grid/HorizontalGridLines.tsx
|
|
4
|
-
var
|
|
4
|
+
var HorizontalGridLines = /* @__PURE__ */ defineComponent({
|
|
5
5
|
name: "HorizontalGridLines",
|
|
6
|
-
inheritAttrs:
|
|
6
|
+
inheritAttrs: false,
|
|
7
7
|
props: {
|
|
8
8
|
x: Number,
|
|
9
9
|
width: Number,
|
|
@@ -21,29 +21,30 @@ var r = /* @__PURE__ */ n({
|
|
|
21
21
|
xAxis: Object,
|
|
22
22
|
yAxis: Object
|
|
23
23
|
},
|
|
24
|
-
setup(
|
|
24
|
+
setup(props, { attrs, slots }) {
|
|
25
25
|
return () => {
|
|
26
|
-
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
...
|
|
26
|
+
const { x, width, horizontal = true, horizontalPoints } = props;
|
|
27
|
+
if (!horizontal || !horizontalPoints || !horizontalPoints.length) return null;
|
|
28
|
+
const { xAxisId, yAxisId, ...otherLineItemProps } = {
|
|
29
|
+
...props,
|
|
30
|
+
...attrs
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...
|
|
35
|
-
...
|
|
36
|
-
x1:
|
|
37
|
-
y1:
|
|
38
|
-
x2:
|
|
39
|
-
y2:
|
|
40
|
-
key: `line-${
|
|
41
|
-
index:
|
|
32
|
+
const items = horizontalPoints.map((entry, i) => {
|
|
33
|
+
const lineItemProps = {
|
|
34
|
+
...otherLineItemProps,
|
|
35
|
+
...attrs,
|
|
36
|
+
x1: x,
|
|
37
|
+
y1: entry,
|
|
38
|
+
x2: x + width,
|
|
39
|
+
y2: entry,
|
|
40
|
+
key: `line-${i}`,
|
|
41
|
+
index: i
|
|
42
42
|
};
|
|
43
|
-
return
|
|
44
|
-
})
|
|
43
|
+
return renderLineItem(slots.horizontal, horizontal, lineItemProps);
|
|
44
|
+
});
|
|
45
|
+
return createVNode("g", { "class": "v-charts-cartesian-grid-horizontal" }, [items]);
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
//#endregion
|
|
49
|
-
export {
|
|
50
|
+
export { HorizontalGridLines as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createVNode
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
2
|
//#region src/cartesian/cartesian-grid/HorizontalStripes.tsx
|
|
3
|
-
var
|
|
3
|
+
var HorizontalStripes = /* @__PURE__ */ defineComponent({
|
|
4
4
|
name: "HorizontalStripes",
|
|
5
|
-
inheritAttrs:
|
|
5
|
+
inheritAttrs: false,
|
|
6
6
|
props: {
|
|
7
7
|
horizontalFill: Array,
|
|
8
8
|
fillOpacity: Number,
|
|
@@ -13,31 +13,31 @@ var n = /* @__PURE__ */ t({
|
|
|
13
13
|
horizontalPoints: Array,
|
|
14
14
|
horizontal: [Boolean, Object]
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
16
|
+
setup(props) {
|
|
17
17
|
return () => {
|
|
18
|
-
|
|
19
|
-
if (!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
key: `react-${
|
|
28
|
-
y:
|
|
29
|
-
x:
|
|
30
|
-
height:
|
|
31
|
-
width:
|
|
32
|
-
stroke: "none",
|
|
33
|
-
fill:
|
|
34
|
-
"fill-opacity":
|
|
35
|
-
class: "v-charts-cartesian-grid-bg"
|
|
18
|
+
const { horizontalFill, fillOpacity, x, y, width, height, horizontalPoints, horizontal = true } = props;
|
|
19
|
+
if (!horizontal || !horizontalFill || !horizontalFill.length) return null;
|
|
20
|
+
const roundedSortedHorizontalPoints = horizontalPoints?.map((e) => Math.round(e + y - y)).sort((a, b) => a - b);
|
|
21
|
+
if (y !== roundedSortedHorizontalPoints?.[0]) roundedSortedHorizontalPoints?.unshift(0);
|
|
22
|
+
const items = roundedSortedHorizontalPoints?.map((entry, i) => {
|
|
23
|
+
const lineHeight = !roundedSortedHorizontalPoints[i + 1] ? y + height - entry : roundedSortedHorizontalPoints[i + 1] - entry;
|
|
24
|
+
if (lineHeight <= 0) return null;
|
|
25
|
+
const colorIndex = i % horizontalFill.length;
|
|
26
|
+
return createVNode("rect", {
|
|
27
|
+
"key": `react-${i}`,
|
|
28
|
+
"y": entry,
|
|
29
|
+
"x": x,
|
|
30
|
+
"height": lineHeight,
|
|
31
|
+
"width": width,
|
|
32
|
+
"stroke": "none",
|
|
33
|
+
"fill": horizontalFill[colorIndex],
|
|
34
|
+
"fill-opacity": fillOpacity,
|
|
35
|
+
"class": "v-charts-cartesian-grid-bg"
|
|
36
36
|
}, null);
|
|
37
37
|
});
|
|
38
|
-
return
|
|
38
|
+
return createVNode("g", { "class": "v-charts-cartesian-gridstripes-horizontal" }, [items]);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
//#endregion
|
|
43
|
-
export {
|
|
43
|
+
export { HorizontalStripes as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { renderLineItem
|
|
2
|
-
import { createVNode
|
|
1
|
+
import { renderLineItem } from "./utils.mjs";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
3
|
//#region src/cartesian/cartesian-grid/VerticalGridLines.tsx
|
|
4
|
-
var
|
|
4
|
+
var VerticalGridLines = /* @__PURE__ */ defineComponent({
|
|
5
5
|
name: "VerticalGridLines",
|
|
6
|
-
inheritAttrs:
|
|
6
|
+
inheritAttrs: false,
|
|
7
7
|
props: {
|
|
8
8
|
x: Number,
|
|
9
9
|
y: Number,
|
|
@@ -17,28 +17,29 @@ var r = /* @__PURE__ */ n({
|
|
|
17
17
|
yAxis: Object,
|
|
18
18
|
vertical: [Boolean, Object]
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
20
|
+
setup(props, { attrs, slots }) {
|
|
21
21
|
return () => {
|
|
22
|
-
|
|
23
|
-
if (!
|
|
24
|
-
|
|
25
|
-
...
|
|
26
|
-
...
|
|
22
|
+
const { y, height, vertical = true, verticalPoints } = props;
|
|
23
|
+
if (!vertical || !verticalPoints || !verticalPoints.length) return null;
|
|
24
|
+
const { xAxisId, yAxisId, ...otherLineItemProps } = {
|
|
25
|
+
...props,
|
|
26
|
+
...attrs
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
...
|
|
31
|
-
x1:
|
|
32
|
-
y1:
|
|
33
|
-
x2:
|
|
34
|
-
y2:
|
|
35
|
-
key: `line-${
|
|
36
|
-
index:
|
|
28
|
+
const items = verticalPoints.map((entry, i) => {
|
|
29
|
+
const lineItemProps = {
|
|
30
|
+
...otherLineItemProps,
|
|
31
|
+
x1: entry,
|
|
32
|
+
y1: y,
|
|
33
|
+
x2: entry,
|
|
34
|
+
y2: y + height,
|
|
35
|
+
key: `line-${i}`,
|
|
36
|
+
index: i
|
|
37
37
|
};
|
|
38
|
-
return
|
|
39
|
-
})
|
|
38
|
+
return renderLineItem(slots.vertical, vertical, lineItemProps);
|
|
39
|
+
});
|
|
40
|
+
return createVNode("g", { "class": "v-charts-cartesian-grid-vertical" }, [items]);
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
//#endregion
|
|
44
|
-
export {
|
|
45
|
+
export { VerticalGridLines as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createVNode
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
2
|
//#region src/cartesian/cartesian-grid/VerticalStripes.tsx
|
|
3
|
-
var
|
|
3
|
+
var VerticalStripes = /* @__PURE__ */ defineComponent({
|
|
4
4
|
name: "VerticalStripes",
|
|
5
|
-
inheritAttrs:
|
|
5
|
+
inheritAttrs: false,
|
|
6
6
|
props: {
|
|
7
7
|
verticalFill: Array,
|
|
8
8
|
fillOpacity: Number,
|
|
@@ -13,31 +13,31 @@ var n = /* @__PURE__ */ t({
|
|
|
13
13
|
verticalPoints: Array,
|
|
14
14
|
vertical: [Boolean, Object]
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
16
|
+
setup(props) {
|
|
17
17
|
return () => {
|
|
18
|
-
|
|
19
|
-
if (!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
key: `react-${
|
|
28
|
-
x:
|
|
29
|
-
y:
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
32
|
-
stroke: "none",
|
|
33
|
-
fill:
|
|
34
|
-
"fill-opacity":
|
|
35
|
-
class: "v-charts-cartesian-grid-bg"
|
|
18
|
+
const { verticalFill, fillOpacity, x, y, width, height, verticalPoints, vertical = true } = props;
|
|
19
|
+
if (!vertical || !verticalFill || !verticalFill.length) return null;
|
|
20
|
+
const roundedSortedVerticalPoints = verticalPoints?.map((e) => Math.round(e + x - x)).sort((a, b) => a - b);
|
|
21
|
+
if (x !== roundedSortedVerticalPoints?.[0]) roundedSortedVerticalPoints?.unshift(0);
|
|
22
|
+
const items = roundedSortedVerticalPoints?.map((entry, i) => {
|
|
23
|
+
const lineWidth = !roundedSortedVerticalPoints[i + 1] ? x + width - entry : roundedSortedVerticalPoints[i + 1] - entry;
|
|
24
|
+
if (lineWidth <= 0) return null;
|
|
25
|
+
const colorIndex = i % verticalFill.length;
|
|
26
|
+
return createVNode("rect", {
|
|
27
|
+
"key": `react-${i}`,
|
|
28
|
+
"x": entry,
|
|
29
|
+
"y": y,
|
|
30
|
+
"width": lineWidth,
|
|
31
|
+
"height": height,
|
|
32
|
+
"stroke": "none",
|
|
33
|
+
"fill": verticalFill[colorIndex],
|
|
34
|
+
"fill-opacity": fillOpacity,
|
|
35
|
+
"class": "v-charts-cartesian-grid-bg"
|
|
36
36
|
}, null);
|
|
37
37
|
});
|
|
38
|
-
return
|
|
38
|
+
return createVNode("g", { "class": "v-charts-cartesian-gridstripes-vertical" }, [items]);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
//#endregion
|
|
43
|
-
export {
|
|
43
|
+
export { VerticalStripes as default };
|