nuxt-charts 2.2.1 → 3.0.0-beta.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.
Files changed (92) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +80 -79
  3. package/dist/module.d.mts +4 -4
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +64 -95
  6. package/dist/runtime/assets/components.css +1 -0
  7. package/dist/runtime/assets/theme.css +1 -0
  8. package/dist/runtime/components/AreaChart.d.vue.ts +19 -0
  9. package/dist/runtime/components/AreaChart.vue +149 -0
  10. package/dist/runtime/components/AreaChart.vue.d.ts +19 -0
  11. package/dist/runtime/components/BarChart.d.vue.ts +19 -0
  12. package/dist/runtime/components/BarChart.vue +175 -0
  13. package/dist/runtime/components/BarChart.vue.d.ts +19 -0
  14. package/dist/runtime/components/BubbleChart.d.vue.ts +19 -0
  15. package/dist/runtime/components/BubbleChart.vue +213 -0
  16. package/dist/runtime/components/BubbleChart.vue.d.ts +19 -0
  17. package/dist/runtime/components/CandlestickChart.d.vue.ts +19 -0
  18. package/dist/runtime/components/CandlestickChart.vue +329 -0
  19. package/dist/runtime/components/CandlestickChart.vue.d.ts +19 -0
  20. package/dist/runtime/components/DonutChart.d.vue.ts +21 -0
  21. package/dist/runtime/components/DonutChart.vue +116 -0
  22. package/dist/runtime/components/DonutChart.vue.d.ts +21 -0
  23. package/dist/runtime/components/FunnelChart.d.vue.ts +19 -0
  24. package/dist/runtime/components/FunnelChart.vue +152 -0
  25. package/dist/runtime/components/FunnelChart.vue.d.ts +19 -0
  26. package/dist/runtime/components/LineChart.d.vue.ts +19 -0
  27. package/dist/runtime/components/LineChart.vue +84 -0
  28. package/dist/runtime/components/LineChart.vue.d.ts +19 -0
  29. package/dist/runtime/components/RadarChart.d.vue.ts +19 -0
  30. package/dist/runtime/components/RadarChart.vue +90 -0
  31. package/dist/runtime/components/RadarChart.vue.d.ts +19 -0
  32. package/dist/runtime/components/RadialBarChart.d.vue.ts +19 -0
  33. package/dist/runtime/components/RadialBarChart.vue +81 -0
  34. package/dist/runtime/components/RadialBarChart.vue.d.ts +19 -0
  35. package/dist/runtime/components/StatusTrackerChart.d.vue.ts +19 -0
  36. package/dist/runtime/components/StatusTrackerChart.vue +147 -0
  37. package/dist/runtime/components/StatusTrackerChart.vue.d.ts +19 -0
  38. package/dist/runtime/components/internal/CandlestickTooltip.d.vue.ts +17 -0
  39. package/dist/runtime/components/internal/CandlestickTooltip.vue +38 -0
  40. package/dist/runtime/components/internal/CandlestickTooltip.vue.d.ts +17 -0
  41. package/dist/runtime/components/internal/CartesianFrame.d.vue.ts +40 -0
  42. package/dist/runtime/components/internal/CartesianFrame.vue +321 -0
  43. package/dist/runtime/components/internal/CartesianFrame.vue.d.ts +40 -0
  44. package/dist/runtime/components/internal/ChartLegend.d.vue.ts +11 -0
  45. package/dist/runtime/components/internal/ChartLegend.vue +22 -0
  46. package/dist/runtime/components/internal/ChartLegend.vue.d.ts +11 -0
  47. package/dist/runtime/components/internal/ChartTooltip.d.vue.ts +3 -0
  48. package/dist/runtime/components/internal/ChartTooltip.vue +39 -0
  49. package/dist/runtime/components/internal/ChartTooltip.vue.d.ts +3 -0
  50. package/dist/runtime/components/internal/CubeBarShape.d.vue.ts +28 -0
  51. package/dist/runtime/components/internal/CubeBarShape.vue +69 -0
  52. package/dist/runtime/components/internal/CubeBarShape.vue.d.ts +28 -0
  53. package/dist/runtime/components/internal/DitherDefs.d.ts +98 -0
  54. package/dist/runtime/components/internal/DitherDefs.js +158 -0
  55. package/dist/runtime/components/internal/FunnelLayeredShape.d.vue.ts +42 -0
  56. package/dist/runtime/components/internal/FunnelLayeredShape.vue +124 -0
  57. package/dist/runtime/components/internal/FunnelLayeredShape.vue.d.ts +42 -0
  58. package/dist/runtime/components/internal/GradientDefs.d.ts +46 -0
  59. package/dist/runtime/components/internal/GradientDefs.js +38 -0
  60. package/dist/runtime/enums.d.ts +65 -0
  61. package/dist/runtime/enums.js +40 -0
  62. package/dist/runtime/types/charts.d.ts +642 -0
  63. package/dist/runtime/types/charts.js +0 -0
  64. package/dist/runtime/types/shared.d.ts +202 -0
  65. package/dist/runtime/types/shared.js +0 -0
  66. package/dist/runtime/types.d.ts +8 -0
  67. package/dist/runtime/types.js +0 -0
  68. package/dist/runtime/utils/axis.d.ts +132 -0
  69. package/dist/runtime/utils/axis.js +93 -0
  70. package/dist/runtime/utils/categories.d.ts +36 -0
  71. package/dist/runtime/utils/categories.js +18 -0
  72. package/dist/runtime/utils/cubes.d.ts +100 -0
  73. package/dist/runtime/utils/cubes.js +73 -0
  74. package/dist/runtime/utils/curve.d.ts +12 -0
  75. package/dist/runtime/utils/curve.js +26 -0
  76. package/dist/runtime/utils/dither.d.ts +55 -0
  77. package/dist/runtime/utils/dither.js +45 -0
  78. package/dist/runtime/utils/gradient.d.ts +12 -0
  79. package/dist/runtime/utils/gradient.js +8 -0
  80. package/dist/runtime/utils/index.d.ts +6 -0
  81. package/dist/runtime/utils/index.js +6 -0
  82. package/dist/runtime/utils/legend.d.ts +27 -0
  83. package/dist/runtime/utils/legend.js +19 -0
  84. package/dist/runtime/utils/marker.d.ts +20 -0
  85. package/dist/runtime/utils/marker.js +21 -0
  86. package/dist/runtime/utils/style.d.ts +14 -0
  87. package/dist/runtime/utils/style.js +10 -0
  88. package/dist/runtime/utils/theme.d.ts +36 -0
  89. package/dist/runtime/utils/theme.js +45 -0
  90. package/package.json +56 -12
  91. package/dist/runtime/vue-chrts.d.ts +0 -1
  92. package/dist/runtime/vue-chrts.js +0 -13
@@ -0,0 +1,175 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { Bar, BarChart as VccsBarChart, LabelList, Rectangle } from "vccs";
4
+ import CartesianFrame from "./internal/CartesianFrame.vue";
5
+ import CubeBarShape from "./internal/CubeBarShape.vue";
6
+ import {
7
+ categoriesToSeries,
8
+ PRIMARY_Y_AXIS_ID
9
+ } from "../utils/categories";
10
+ import {
11
+ DEFAULT_CUBE_EMPTY_COLOR,
12
+ DEFAULT_CUBE_GAP,
13
+ DEFAULT_CUBE_RADIUS,
14
+ DEFAULT_CUBE_SIZE
15
+ } from "../utils/cubes";
16
+ const props = defineProps({
17
+ yAxis: { type: Array, required: true },
18
+ xAxis: { type: null, required: false },
19
+ stacked: { type: Boolean, required: false },
20
+ orientation: { type: String, required: false },
21
+ radius: { type: Number, required: false },
22
+ barGap: { type: [Number, String], required: false },
23
+ barCategoryGap: { type: [Number, String], required: false },
24
+ barPadding: { type: Number, required: false },
25
+ groupPadding: { type: Number, required: false },
26
+ valueLabel: { type: Object, required: false },
27
+ variant: { type: String, required: false, default: "solid" },
28
+ cubeGap: { type: Number, required: false, default: DEFAULT_CUBE_GAP },
29
+ cubeRadius: { type: Number, required: false, default: DEFAULT_CUBE_RADIUS },
30
+ cubeSize: { type: Number, required: false, default: DEFAULT_CUBE_SIZE },
31
+ cubeMinSize: { type: Number, required: false },
32
+ cubeMinOpacity: { type: Number, required: false },
33
+ cubeEmptyColor: { type: String, required: false, default: DEFAULT_CUBE_EMPTY_COLOR },
34
+ stackAndGrouped: { type: Boolean, required: false },
35
+ stackedGroupedSpacing: { type: Number, required: false },
36
+ data: { type: Array, required: true },
37
+ height: { type: Number, required: true },
38
+ xLabel: { type: String, required: false },
39
+ yLabel: { type: String, required: false },
40
+ padding: { type: Object, required: false },
41
+ categories: { type: Object, required: true },
42
+ xFormatter: { type: Function, required: false },
43
+ yFormatter: { type: Function, required: false },
44
+ tooltipTitleFormatter: { type: Function, required: false },
45
+ xNumTicks: { type: Number, required: false },
46
+ yNumTicks: { type: Number, required: false },
47
+ hideLegend: { type: Boolean, required: false },
48
+ hideTooltip: { type: Boolean, required: false },
49
+ legendPosition: { type: String, required: false },
50
+ legendStyle: { type: [String, Object], required: false },
51
+ xDomainLine: { type: Boolean, required: false },
52
+ yDomainLine: { type: Boolean, required: false },
53
+ xTickLine: { type: Boolean, required: false },
54
+ yTickLine: { type: Boolean, required: false },
55
+ xGridLine: { type: Boolean, required: false },
56
+ yGridLine: { type: Boolean, required: false },
57
+ hideXAxis: { type: Boolean, required: false },
58
+ hideYAxis: { type: Boolean, required: false },
59
+ xDomain: { type: Array, required: false },
60
+ yDomain: { type: Array, required: false },
61
+ duration: { type: Number, required: false },
62
+ xAxisConfig: { type: Object, required: false },
63
+ yAxisConfig: { type: Object, required: false },
64
+ yAxes: { type: Object, required: false },
65
+ tooltip: { type: Object, required: false },
66
+ referenceLines: { type: Array, required: false },
67
+ syncId: { type: String, required: false },
68
+ minMaxTicksOnly: { type: Boolean, required: false },
69
+ xExplicitTicks: { type: Array, required: false },
70
+ yExplicitTicks: { type: Array, required: false },
71
+ crosshairConfig: { type: Object, required: false },
72
+ theme: { type: Object, required: false }
73
+ });
74
+ const isCubes = computed(() => props.variant === "cubes");
75
+ const valueAccessor = computed(() => {
76
+ const fn = props.valueLabel?.label;
77
+ if (!fn) return void 0;
78
+ return (entry, index) => {
79
+ const y = Array.isArray(entry.value) ? entry.value[entry.value.length - 1] : entry.value;
80
+ return fn({ ...entry, y }, index);
81
+ };
82
+ });
83
+ const categoryByKey = computed(() => {
84
+ const map = /* @__PURE__ */ new Map();
85
+ for (const s of categoriesToSeries(props.categories)) map.set(s.dataKey, s);
86
+ return map;
87
+ });
88
+ const series = computed(
89
+ () => props.yAxis.map((key) => {
90
+ const k = String(key);
91
+ const cat = categoryByKey.value.get(k);
92
+ return {
93
+ dataKey: k,
94
+ name: cat?.name ?? k,
95
+ color: cat?.color,
96
+ hidden: cat?.hidden ?? false,
97
+ yAxisId: cat?.yAxisId ?? PRIMARY_Y_AXIS_ID
98
+ };
99
+ })
100
+ );
101
+ const stackIdFor = (yAxisId) => props.stacked ? `stack-${yAxisId}` : void 0;
102
+ const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : void 0);
103
+ const chartContainerProps = computed(() => {
104
+ const barGap = props.barGap ?? props.barPadding;
105
+ const barCategoryGap = props.barCategoryGap ?? props.groupPadding;
106
+ return {
107
+ ...barGap !== void 0 ? { barGap } : {},
108
+ ...barCategoryGap !== void 0 ? { barCategoryGap } : {}
109
+ };
110
+ });
111
+ function barRadius(index) {
112
+ const r = props.radius ?? 2;
113
+ if (!props.stacked) return r;
114
+ const isLast = index === series.value.length - 1;
115
+ if (props.orientation === "horizontal") {
116
+ return isLast ? [0, r, r, 0] : 0;
117
+ }
118
+ return isLast ? [r, r, 0, 0] : 0;
119
+ }
120
+ </script>
121
+
122
+ <template>
123
+ <CartesianFrame
124
+ :container="VccsBarChart"
125
+ :x-axis-key="xAxisKey"
126
+ :container-props="chartContainerProps"
127
+ v-bind="props"
128
+ >
129
+ <Bar
130
+ v-for="(s, i) in series"
131
+ :key="s.dataKey"
132
+ :data-key="s.dataKey"
133
+ :name="s.name"
134
+ :y-axis-id="s.yAxisId"
135
+ :stack-id="stackIdFor(s.yAxisId)"
136
+ :fill="s.color"
137
+ :radius="isCubes ? 0 : barRadius(i)"
138
+ :hide="s.hidden"
139
+ :is-animation-active="duration !== void 0 && duration !== 0"
140
+ >
141
+ <!--
142
+ Always register `#shape`. vccs reads `slots.shape` once in Bar setup, so a
143
+ `v-if` on the slot means switching solid→cubes never picks up the cube renderer.
144
+ -->
145
+ <template #shape="shapeProps">
146
+ <CubeBarShape
147
+ v-if="isCubes"
148
+ :x="shapeProps.x"
149
+ :y="shapeProps.y"
150
+ :width="shapeProps.width"
151
+ :height="shapeProps.height"
152
+ :background="shapeProps.background"
153
+ :fill="shapeProps.fill ?? s.color"
154
+ :gap="cubeGap"
155
+ :radius="cubeRadius"
156
+ :preferred-size="cubeSize"
157
+ :min-size="typeof cubeMinSize === 'number' ? cubeMinSize : void 0"
158
+ :min-opacity="typeof cubeMinOpacity === 'number' ? cubeMinOpacity : void 0"
159
+ :empty-color="cubeEmptyColor"
160
+ :include-empty="!stacked || i === 0"
161
+ />
162
+ <Rectangle v-else v-bind="shapeProps" />
163
+ </template>
164
+ <LabelList
165
+ v-if="valueLabel && !isCubes"
166
+ :data-key="s.dataKey"
167
+ :value-accessor="valueAccessor"
168
+ :position="orientation === 'horizontal' ? 'right' : 'top'"
169
+ :offset="valueLabel.labelSpacing ?? 8"
170
+ :font-size="valueLabel.labelFontSize ?? 12"
171
+ :fill="valueLabel.color ?? 'currentColor'"
172
+ />
173
+ </Bar>
174
+ </CartesianFrame>
175
+ </template>
@@ -0,0 +1,19 @@
1
+ import type { BarChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<BarChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,19 @@
1
+ import type { BubbleChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<BubbleChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,213 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ CartesianGrid,
5
+ Legend,
6
+ ResponsiveContainer,
7
+ Scatter,
8
+ ScatterChart,
9
+ Tooltip,
10
+ XAxis,
11
+ YAxis,
12
+ ZAxis
13
+ } from "vccs";
14
+ import ChartTooltip from "./internal/ChartTooltip.vue";
15
+ import ChartLegend from "./internal/ChartLegend.vue";
16
+ import { categoriesToSeries } from "../utils/categories";
17
+ import { legendPositionToLegendProps, resolveLegendWrapperStyle } from "../utils/legend";
18
+ import {
19
+ AXIS_TICK_MARGIN,
20
+ resolveAxisProps,
21
+ resolveXAxisHeight,
22
+ resolveYAxisWidth,
23
+ toTickFormatter,
24
+ toTickProp
25
+ } from "../utils/axis";
26
+ import { toAxisDomain, toCssProperties } from "../utils/style";
27
+ import { axisTickVars, resolveHoverRadius, resolveHoverVisible, themeToVars } from "../utils/theme";
28
+ const props = defineProps({
29
+ xAccessor: { type: Function, required: true, skipCheck: true },
30
+ yAccessor: { type: Function, required: true, skipCheck: true },
31
+ sizeAccessor: { type: Function, required: false, skipCheck: true },
32
+ categoryKey: { type: null, required: true },
33
+ sizeRange: { type: Array, required: false },
34
+ opacity: { type: Number, required: false },
35
+ sizeOptions: { type: Object, required: false },
36
+ data: { type: Array, required: true },
37
+ height: { type: Number, required: true },
38
+ xLabel: { type: String, required: false },
39
+ yLabel: { type: String, required: false },
40
+ padding: { type: Object, required: false },
41
+ categories: { type: Object, required: true },
42
+ xFormatter: { type: Function, required: false },
43
+ yFormatter: { type: Function, required: false },
44
+ tooltipTitleFormatter: { type: Function, required: false },
45
+ xNumTicks: { type: Number, required: false },
46
+ yNumTicks: { type: Number, required: false },
47
+ hideLegend: { type: Boolean, required: false },
48
+ hideTooltip: { type: Boolean, required: false },
49
+ legendPosition: { type: String, required: false },
50
+ legendStyle: { type: [String, Object], required: false },
51
+ xDomainLine: { type: Boolean, required: false },
52
+ yDomainLine: { type: Boolean, required: false },
53
+ xTickLine: { type: Boolean, required: false },
54
+ yTickLine: { type: Boolean, required: false },
55
+ xGridLine: { type: Boolean, required: false },
56
+ yGridLine: { type: Boolean, required: false },
57
+ hideXAxis: { type: Boolean, required: false },
58
+ hideYAxis: { type: Boolean, required: false },
59
+ xDomain: { type: Array, required: false },
60
+ yDomain: { type: Array, required: false },
61
+ duration: { type: Number, required: false },
62
+ xAxisConfig: { type: Object, required: false },
63
+ yAxisConfig: { type: Object, required: false },
64
+ yAxes: { type: Object, required: false },
65
+ tooltip: { type: Object, required: false },
66
+ referenceLines: { type: Array, required: false },
67
+ syncId: { type: String, required: false },
68
+ minMaxTicksOnly: { type: Boolean, required: false },
69
+ xExplicitTicks: { type: Array, required: false },
70
+ yExplicitTicks: { type: Array, required: false },
71
+ crosshairConfig: { type: Object, required: false },
72
+ theme: { type: Object, required: false }
73
+ });
74
+ function resolveAccessor(accessor) {
75
+ if (accessor === void 0) return void 0;
76
+ return typeof accessor === "function" ? accessor : String(accessor);
77
+ }
78
+ const xKey = computed(() => resolveAccessor(props.xAccessor));
79
+ const yKey = computed(() => resolveAccessor(props.yAccessor));
80
+ const zKey = computed(() => resolveAccessor(props.sizeAccessor));
81
+ const categoryKey = computed(() => String(props.categoryKey));
82
+ const legend = computed(() => legendPositionToLegendProps(props.legendPosition));
83
+ const sizeRange = computed(() => {
84
+ if (props.sizeRange) return props.sizeRange;
85
+ const min = props.sizeOptions?.minRadius;
86
+ const max = props.sizeOptions?.maxRadius;
87
+ if (min !== void 0 || max !== void 0) {
88
+ const rMin = min ?? 4;
89
+ const rMax = max ?? 20;
90
+ return [Math.PI * rMin * rMin, Math.PI * rMax * rMax];
91
+ }
92
+ return [60, 400];
93
+ });
94
+ const xTickFormatter = computed(() => toTickFormatter(props.xFormatter));
95
+ const yTickFormatter = computed(() => toTickFormatter(props.yFormatter));
96
+ const xAxisDomain = computed(() => toAxisDomain(props.xDomain));
97
+ const yAxisDomain = computed(() => toAxisDomain(props.yDomain));
98
+ const legendWrapperStyle = computed(
99
+ () => resolveLegendWrapperStyle(props.legendPosition, toCssProperties(props.legendStyle))
100
+ );
101
+ const xAxis = computed(
102
+ () => resolveAxisProps(props.xExplicitTicks, props.xAxisConfig, props.minMaxTicksOnly)
103
+ );
104
+ const yAxis = computed(() => resolveAxisProps(void 0, props.yAxisConfig, props.minMaxTicksOnly));
105
+ const xAxisHeight = computed(() => resolveXAxisHeight({ hasTitle: !!props.xLabel }));
106
+ const yAxisWidth = computed(
107
+ () => resolveYAxisWidth({ hasTitle: !!props.yLabel, isCategoryAxis: false })
108
+ );
109
+ const themeVars = computed(() => ({
110
+ ...themeToVars(props.theme),
111
+ ...axisTickVars("x", xAxis.value.tick),
112
+ ...axisTickVars("y", yAxis.value.tick)
113
+ }));
114
+ const xTickProp = computed(() => toTickProp(xAxis.value.tick));
115
+ const yTickProp = computed(() => toTickProp(yAxis.value.tick));
116
+ const axisLineStyle = { stroke: "var(--vc-axis-line-color)" };
117
+ const xTickLineProp = computed(
118
+ () => props.xAxisConfig?.tickLine ?? props.xTickLine ?? false ? axisLineStyle : false
119
+ );
120
+ const yTickLineProp = computed(
121
+ () => props.yAxisConfig?.tickLine ?? props.yTickLine ?? false ? axisLineStyle : false
122
+ );
123
+ const cursor = computed(
124
+ () => resolveHoverVisible(props.theme) ? {
125
+ fill: "var(--vc-hover-fill)",
126
+ stroke: "var(--vc-hover-stroke)",
127
+ radius: resolveHoverRadius(props.theme)
128
+ } : false
129
+ );
130
+ const groups = computed(() => {
131
+ const colorByCat = /* @__PURE__ */ new Map();
132
+ for (const s of categoriesToSeries(props.categories)) colorByCat.set(s.dataKey, s.color);
133
+ const byCategory = /* @__PURE__ */ new Map();
134
+ for (const row of props.data) {
135
+ const cat = String(row[categoryKey.value]);
136
+ const bucket = byCategory.get(cat);
137
+ if (bucket) bucket.push(row);
138
+ else byCategory.set(cat, [row]);
139
+ }
140
+ return Array.from(byCategory.entries()).map(([name, data]) => ({
141
+ name,
142
+ data,
143
+ color: colorByCat.get(name)
144
+ }));
145
+ });
146
+ </script>
147
+
148
+ <template>
149
+ <div class="vue-chrts" :style="themeVars">
150
+ <ResponsiveContainer width="100%" :height="height">
151
+ <ScatterChart>
152
+ <CartesianGrid
153
+ v-if="(xGridLine ?? true) || (yGridLine ?? true)"
154
+ stroke="var(--vc-grid-color)"
155
+ stroke-dasharray="var(--vc-grid-dash)"
156
+ :stroke-width="'var(--vc-grid-width)'"
157
+ />
158
+ <XAxis
159
+ v-if="!hideXAxis"
160
+ type="number"
161
+ :data-key="xKey"
162
+ :name="xLabel"
163
+ :height="xAxisHeight"
164
+ :tick="xTickProp"
165
+ :tick-margin="AXIS_TICK_MARGIN.x"
166
+ :tick-line="xTickLineProp"
167
+ :axis-line="axisLineStyle"
168
+ :tick-formatter="xTickFormatter"
169
+ :domain="xAxisDomain"
170
+ :ticks="xAxis.ticks"
171
+ :interval="xAxis.interval"
172
+ />
173
+ <YAxis
174
+ v-if="!hideYAxis"
175
+ type="number"
176
+ :data-key="yKey"
177
+ :name="yLabel"
178
+ :width="yAxisWidth"
179
+ :tick="yTickProp"
180
+ :tick-margin="AXIS_TICK_MARGIN.y"
181
+ :tick-line="yTickLineProp"
182
+ :axis-line="axisLineStyle"
183
+ :tick-formatter="yTickFormatter"
184
+ :domain="yAxisDomain"
185
+ :interval="yAxis.interval"
186
+ />
187
+ <ZAxis v-if="zKey" type="number" :data-key="zKey" :range="sizeRange" />
188
+
189
+ <Scatter
190
+ v-for="g in groups"
191
+ :key="g.name"
192
+ :name="g.name"
193
+ :data="g.data"
194
+ :fill="g.color"
195
+ :fill-opacity="opacity ?? 0.7"
196
+ />
197
+
198
+ <Tooltip v-if="!hideTooltip" :content="ChartTooltip" :cursor="cursor" :is-animation-active="false" />
199
+ <Legend
200
+ v-if="!hideLegend"
201
+ :align="legend.align"
202
+ :vertical-align="legend.verticalAlign"
203
+ :layout="legend.layout"
204
+ :wrapper-style="legendWrapperStyle"
205
+ >
206
+ <template #content="slotProps">
207
+ <ChartLegend v-bind="slotProps" />
208
+ </template>
209
+ </Legend>
210
+ </ScatterChart>
211
+ </ResponsiveContainer>
212
+ </div>
213
+ </template>
@@ -0,0 +1,19 @@
1
+ import type { BubbleChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<BubbleChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,19 @@
1
+ import type { CandlestickChartProps } from "../types/charts.js";
2
+ declare const __VLS_export: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<CandlestickChartProps<T>> & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: {};
9
+ emit: {};
10
+ }>) => import("vue").VNode & {
11
+ __ctx?: Awaited<typeof __VLS_setup>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};