@katlux/block-charts 0.1.1-alpha.120 → 0.1.1-alpha.122
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/README.md +44 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/KAreaChart/KAreaChart.d.vue.ts +2 -2
- package/dist/runtime/components/KAreaChart/KAreaChart.vue +44 -246
- package/dist/runtime/components/KAreaChart/KAreaChart.vue.d.ts +2 -2
- package/dist/runtime/components/KBarChart/KBarChart.d.vue.ts +5 -5
- package/dist/runtime/components/KBarChart/KBarChart.vue +25 -294
- package/dist/runtime/components/KBarChart/KBarChart.vue.d.ts +5 -5
- package/dist/runtime/components/KHeatMap/KHeatMap.d.vue.ts +2 -2
- package/dist/runtime/components/KHeatMap/KHeatMap.vue.d.ts +2 -2
- package/dist/runtime/components/KLineChart/KLineChart.d.vue.ts +2 -2
- package/dist/runtime/components/KLineChart/KLineChart.vue +44 -228
- package/dist/runtime/components/KLineChart/KLineChart.vue.d.ts +2 -2
- package/dist/runtime/components/KScatterChart/KScatterChart.d.vue.ts +2 -2
- package/dist/runtime/components/KScatterChart/KScatterChart.vue.d.ts +2 -2
- package/dist/runtime/composables/useChartData.d.ts +3 -2
- package/dist/runtime/composables/useChartData.js +30 -10
- package/dist/runtime/utils/barChartCanvas.d.ts +31 -0
- package/dist/runtime/utils/barChartCanvas.js +297 -0
- package/dist/runtime/utils/canvasDrawHelpers.d.ts +27 -0
- package/dist/runtime/utils/canvasDrawHelpers.js +131 -0
- package/dist/runtime/utils/xySeriesHelpers.d.ts +30 -0
- package/dist/runtime/utils/xySeriesHelpers.js +196 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @katlux/block-charts
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@katlux/block-charts)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
Pre-built, responsive charting block components for the Katlux UI toolkit, powered by `@katlux/providers`.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @katlux/block-charts@alpha
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Register the module in `nuxt.config.ts` alongside `@katlux/toolkit`:
|
|
15
|
+
```ts
|
|
16
|
+
export default defineNuxtConfig({
|
|
17
|
+
modules: [
|
|
18
|
+
'@katlux/toolkit',
|
|
19
|
+
'@katlux/block-charts'
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Included Components
|
|
25
|
+
|
|
26
|
+
- `KLineChart`: Multi-series line chart with zoom, pan, interactive hit-testing, and hover tooltips.
|
|
27
|
+
- `KAreaChart`: Stacked/layered area chart with smooth interpolation and dynamic DPR canvas rendering.
|
|
28
|
+
- `KBarChart`: Grouped and stacked bar chart supporting negative baselines.
|
|
29
|
+
- `KPieChart`: Donut/pie chart with animated segments and interactive legends.
|
|
30
|
+
- `KScatterChart`: High-volume scatter plot with axis scaling and timestamp precomputation.
|
|
31
|
+
- `KHeatMap`: Matrix heat map supporting custom color scales and 3/6-digit hex colors.
|
|
32
|
+
|
|
33
|
+
## Documentation & Changelog
|
|
34
|
+
|
|
35
|
+
- **Monorepo Repository**: [https://github.com/katlux-ui/KatluxShowcase](https://github.com/katlux-ui/KatluxShowcase)
|
|
36
|
+
- **Changelog & Migration Guide**: [CHANGELOG.md](https://github.com/katlux-ui/KatluxShowcase/blob/dev/CHANGELOG.md)
|
|
37
|
+
|
|
38
|
+
## License & Trademark Policy
|
|
39
|
+
|
|
40
|
+
The code in this repository is completely free and open-source under the **Apache 2.0 License** (see [LICENSE](./LICENSE)).
|
|
41
|
+
However, **Katlux™** and the Katlux logo are unregistered trademarks of the Katlux project.
|
|
42
|
+
|
|
43
|
+
To protect our users from fraud, you may not use the "Katlux" name or logo to brand your own modified forks, derivative works, or malicious distributions without explicit permission. You are, however, completely free to state "Built with Katlux" in your projects!
|
|
44
|
+
|
package/dist/module.json
CHANGED
|
@@ -37,6 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
37
37
|
y: number;
|
|
38
38
|
}) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
|
+
xAxisTitle: string;
|
|
41
|
+
yAxisTitle: string;
|
|
40
42
|
xField: string;
|
|
41
43
|
yField: string;
|
|
42
44
|
seriesField: string;
|
|
@@ -48,8 +50,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
48
50
|
colors: string[];
|
|
49
51
|
backgroundColor: string;
|
|
50
52
|
showLegend: boolean;
|
|
51
|
-
xAxisTitle: string;
|
|
52
|
-
yAxisTitle: string;
|
|
53
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
54
|
declare const _default: typeof __VLS_export;
|
|
55
55
|
export default _default;
|
|
@@ -61,16 +61,23 @@
|
|
|
61
61
|
</template>
|
|
62
62
|
|
|
63
63
|
<script setup>
|
|
64
|
-
import { ref, watch, computed, onMounted, nextTick, useId
|
|
64
|
+
import { ref, watch, computed, onMounted, nextTick, useId } from "vue";
|
|
65
65
|
import { useChartCanvas } from "../../composables/useChartCanvas";
|
|
66
66
|
import { useChartSvg } from "../../composables/useChartSvg";
|
|
67
67
|
import { useChartData } from "../../composables/useChartData";
|
|
68
|
-
import { useChartAxes
|
|
68
|
+
import { useChartAxes } from "../../composables/useChartAxes";
|
|
69
69
|
import { useChartViewport } from "../../composables/useChartViewport";
|
|
70
70
|
import { useChartAnimation, easeOut } from "../../composables/useChartAnimation";
|
|
71
71
|
import { useChartExport } from "../../composables/useChartExport";
|
|
72
72
|
import { useChartHitTest } from "../../composables/useChartHitTest";
|
|
73
73
|
import { cleanNumber, safeMax } from "../../composables/chartUtils";
|
|
74
|
+
import {
|
|
75
|
+
isChartProviderLoading,
|
|
76
|
+
drawChartGrid,
|
|
77
|
+
drawChartLegend,
|
|
78
|
+
drawXYSeriesAxes
|
|
79
|
+
} from "../../utils/canvasDrawHelpers";
|
|
80
|
+
import { useXYSeriesData, drawAreaSeries } from "../../utils/xySeriesHelpers";
|
|
74
81
|
const clipId = useId();
|
|
75
82
|
const props = defineProps({
|
|
76
83
|
dataProvider: { type: null, required: false },
|
|
@@ -98,13 +105,7 @@ const dataRef = computed(() => props.dataProvider);
|
|
|
98
105
|
const { items, loading: dataLoading } = useChartData(dataRef);
|
|
99
106
|
const { progress, animate } = useChartAnimation();
|
|
100
107
|
const { exportPng, exportSvg: exportSvgFile } = useChartExport();
|
|
101
|
-
const isLoading = computed(() =>
|
|
102
|
-
const dp = props.dataProvider;
|
|
103
|
-
if (!dp) return dataLoading.value;
|
|
104
|
-
const rawLoading = dp.loading !== void 0 ? isRef(dp.loading) ? dp.loading.value : dp.loading?.value ?? dp.loading : false;
|
|
105
|
-
const rawInitial = dp.initialLoad !== void 0 ? isRef(dp.initialLoad) ? dp.initialLoad.value : dp.initialLoad?.value ?? dp.initialLoad : false;
|
|
106
|
-
return Boolean(dataLoading.value || rawLoading || rawInitial);
|
|
107
|
-
});
|
|
108
|
+
const isLoading = computed(() => isChartProviderLoading(props.dataProvider, dataLoading));
|
|
108
109
|
const tooltipStyle = computed(() => ({
|
|
109
110
|
left: `${tooltipState.value.x}px`,
|
|
110
111
|
top: `${tooltipState.value.y}px`
|
|
@@ -138,81 +139,19 @@ const {
|
|
|
138
139
|
} = viewport;
|
|
139
140
|
const xFieldRef = computed(() => props.xField);
|
|
140
141
|
const yFieldRef = computed(() => props.yField);
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
const isAllMidnight = computed(() => {
|
|
156
|
-
if (xAxisType.value !== "datetime" || !items.value.length) return false;
|
|
157
|
-
const checkCount = Math.min(items.value.length, 100);
|
|
158
|
-
for (let i = 0; i < checkCount; i++) {
|
|
159
|
-
const ts = parseValue(items.value[i][props.xField]);
|
|
160
|
-
const d = new Date(ts);
|
|
161
|
-
if (d.getHours() !== 0 || d.getMinutes() !== 0) return false;
|
|
162
|
-
}
|
|
163
|
-
return true;
|
|
164
|
-
});
|
|
165
|
-
const categoryList = computed(() => {
|
|
166
|
-
if (xAxisType.value !== "category") return [];
|
|
167
|
-
const seen = /* @__PURE__ */ new Set();
|
|
168
|
-
const list = [];
|
|
169
|
-
for (const item of items.value) {
|
|
170
|
-
const val = String(item[props.xField] ?? "");
|
|
171
|
-
if (!seen.has(val)) {
|
|
172
|
-
seen.add(val);
|
|
173
|
-
list.push(val);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return list;
|
|
177
|
-
});
|
|
178
|
-
const categoryIndexMap = computed(() => {
|
|
179
|
-
const map = {};
|
|
180
|
-
categoryList.value.forEach((cat, i) => {
|
|
181
|
-
map[cat] = i;
|
|
182
|
-
});
|
|
183
|
-
return map;
|
|
184
|
-
});
|
|
185
|
-
const resolveX = (item, index = 0) => {
|
|
186
|
-
if (!item) return index;
|
|
187
|
-
const raw = item[props.xField];
|
|
188
|
-
if (xAxisType.value === "category") return categoryIndexMap.value[String(raw)] ?? index;
|
|
189
|
-
return parseValue(raw, index);
|
|
190
|
-
};
|
|
191
|
-
const seriesMap = computed(() => {
|
|
192
|
-
const map = /* @__PURE__ */ new Map();
|
|
193
|
-
for (const item of items.value) {
|
|
194
|
-
const key = String(item[props.seriesField] ?? "default");
|
|
195
|
-
if (!map.has(key)) map.set(key, []);
|
|
196
|
-
map.get(key).push(item);
|
|
197
|
-
}
|
|
198
|
-
return map;
|
|
199
|
-
});
|
|
200
|
-
const sortedSeriesMap = computed(() => {
|
|
201
|
-
const map = /* @__PURE__ */ new Map();
|
|
202
|
-
const itemIndexMap = /* @__PURE__ */ new Map();
|
|
203
|
-
for (let i = 0; i < items.value.length; i++) {
|
|
204
|
-
itemIndexMap.set(items.value[i], i);
|
|
205
|
-
}
|
|
206
|
-
for (const [key, seriesItems] of seriesMap.value) {
|
|
207
|
-
const enriched = seriesItems.map((item, idx) => ({
|
|
208
|
-
item,
|
|
209
|
-
index: itemIndexMap.get(item) ?? idx,
|
|
210
|
-
xVal: resolveX(item, idx),
|
|
211
|
-
yVal: cleanNumber(item[props.yField])
|
|
212
|
-
})).sort((a, b) => a.xVal - b.xVal);
|
|
213
|
-
map.set(key, enriched);
|
|
214
|
-
}
|
|
215
|
-
return map;
|
|
142
|
+
const seriesFieldRef = computed(() => props.seriesField);
|
|
143
|
+
const {
|
|
144
|
+
xAxisType,
|
|
145
|
+
isAllMidnight,
|
|
146
|
+
categoryList,
|
|
147
|
+
resolveX,
|
|
148
|
+
seriesMap,
|
|
149
|
+
sortedSeriesMap
|
|
150
|
+
} = useXYSeriesData({
|
|
151
|
+
items,
|
|
152
|
+
xField: xFieldRef,
|
|
153
|
+
yField: yFieldRef,
|
|
154
|
+
seriesField: seriesFieldRef
|
|
216
155
|
});
|
|
217
156
|
const stackedMaxY = computed(() => {
|
|
218
157
|
if (!props.stacked) return 0;
|
|
@@ -251,82 +190,18 @@ const draw = () => {
|
|
|
251
190
|
clear(props.backgroundColor);
|
|
252
191
|
const c = ctx.value;
|
|
253
192
|
const p = props.animated ? easeOut(progress.value) : 1;
|
|
254
|
-
c.
|
|
255
|
-
c
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
c.beginPath();
|
|
267
|
-
c.moveTo(x, axes.plotTop);
|
|
268
|
-
c.lineTo(x, axes.plotTop + axes.plotHeight.value);
|
|
269
|
-
c.stroke();
|
|
270
|
-
}
|
|
271
|
-
c.restore();
|
|
272
|
-
c.save();
|
|
273
|
-
c.fillStyle = "rgba(150,150,170,0.8)";
|
|
274
|
-
c.font = "11px system-ui, sans-serif";
|
|
275
|
-
c.textAlign = "right";
|
|
276
|
-
for (let i = 0; i <= 5; i++) {
|
|
277
|
-
const val = axes.yMin.value + (effectiveYMax.value - axes.yMin.value) * (i / 5);
|
|
278
|
-
c.fillText(val.toFixed(1), axes.plotLeft - 8, toStackedY(val) + 4);
|
|
279
|
-
}
|
|
280
|
-
c.textAlign = "center";
|
|
281
|
-
if (xAxisType.value === "category") {
|
|
282
|
-
const count = categoryList.value.length;
|
|
283
|
-
if (count > 0) {
|
|
284
|
-
const xSteps = Math.min(10, count - 1);
|
|
285
|
-
const stepSize = xSteps > 0 ? (count - 1) / xSteps : 1;
|
|
286
|
-
for (let i = 0; i <= xSteps; i++) {
|
|
287
|
-
const idx = Math.round(i * stepSize);
|
|
288
|
-
const x = axes.toX(idx);
|
|
289
|
-
const label = categoryList.value[idx] ?? "";
|
|
290
|
-
c.fillText(label, x, axes.plotTop + axes.plotHeight.value + 16);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
for (let i = 0; i <= 5; i++) {
|
|
295
|
-
const val = axes.xMin.value + (axes.xMax.value - axes.xMin.value) * (i / 5);
|
|
296
|
-
const x = axes.toX(val);
|
|
297
|
-
let label;
|
|
298
|
-
if (xAxisType.value === "datetime") {
|
|
299
|
-
label = isAllMidnight.value ? new Date(val).toLocaleDateString([], { month: "short", day: "numeric" }) : new Date(val).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
300
|
-
} else {
|
|
301
|
-
label = val.toFixed(1);
|
|
302
|
-
}
|
|
303
|
-
c.fillText(label, x, axes.plotTop + axes.plotHeight.value + 16);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
c.strokeStyle = "rgba(150,150,170,0.5)";
|
|
307
|
-
c.beginPath();
|
|
308
|
-
c.moveTo(axes.plotLeft, axes.plotTop + axes.plotHeight.value);
|
|
309
|
-
c.lineTo(axes.plotLeft + axes.plotWidth.value, axes.plotTop + axes.plotHeight.value);
|
|
310
|
-
c.stroke();
|
|
311
|
-
c.beginPath();
|
|
312
|
-
c.moveTo(axes.plotLeft, axes.plotTop);
|
|
313
|
-
c.lineTo(axes.plotLeft, axes.plotTop + axes.plotHeight.value);
|
|
314
|
-
c.stroke();
|
|
315
|
-
if (props.xAxisTitle) {
|
|
316
|
-
c.fillStyle = "rgba(120,120,140,0.8)";
|
|
317
|
-
c.textAlign = "center";
|
|
318
|
-
c.fillText(props.xAxisTitle, axes.plotLeft + axes.plotWidth.value / 2, axes.plotTop + axes.plotHeight.value + 34);
|
|
319
|
-
}
|
|
320
|
-
if (props.yAxisTitle) {
|
|
321
|
-
c.save();
|
|
322
|
-
c.fillStyle = "rgba(120,120,140,0.8)";
|
|
323
|
-
c.translate(axes.plotLeft - 40, axes.plotTop + axes.plotHeight.value / 2);
|
|
324
|
-
c.rotate(-Math.PI / 2);
|
|
325
|
-
c.textAlign = "center";
|
|
326
|
-
c.fillText(props.yAxisTitle, 0, 0);
|
|
327
|
-
c.restore();
|
|
328
|
-
}
|
|
329
|
-
c.restore();
|
|
193
|
+
drawChartGrid(c, axes.plotLeft, axes.plotTop, axes.plotWidth.value, axes.plotHeight.value);
|
|
194
|
+
drawXYSeriesAxes(c, {
|
|
195
|
+
axes,
|
|
196
|
+
xAxisType: xAxisType.value,
|
|
197
|
+
isAllMidnight: isAllMidnight.value,
|
|
198
|
+
categoryList: categoryList.value,
|
|
199
|
+
yMin: axes.yMin.value,
|
|
200
|
+
yMax: effectiveYMax.value,
|
|
201
|
+
toY: toStackedY,
|
|
202
|
+
xAxisTitle: props.xAxisTitle,
|
|
203
|
+
yAxisTitle: props.yAxisTitle
|
|
204
|
+
});
|
|
330
205
|
c.save();
|
|
331
206
|
c.beginPath();
|
|
332
207
|
c.rect(axes.plotLeft, axes.plotTop, axes.plotWidth.value, axes.plotHeight.value);
|
|
@@ -335,98 +210,21 @@ const draw = () => {
|
|
|
335
210
|
let seriesIdx = 0;
|
|
336
211
|
for (const [, seriesItems] of sortedSeriesMap.value) {
|
|
337
212
|
const color = props.colors[seriesIdx % props.colors.length];
|
|
338
|
-
|
|
339
|
-
const pts = seriesItems.slice(0, drawCount);
|
|
340
|
-
c.save();
|
|
341
|
-
c.beginPath();
|
|
342
|
-
if (props.stacked) {
|
|
343
|
-
const topPoints = [];
|
|
344
|
-
const bottomPoints = [];
|
|
345
|
-
for (const pt of pts) {
|
|
346
|
-
const x = axes.toX(pt.xVal);
|
|
347
|
-
const base = currentBaseline.get(pt.xVal) || 0;
|
|
348
|
-
const safeVal = Math.max(0, pt.yVal);
|
|
349
|
-
const top = base + safeVal;
|
|
350
|
-
const yTop = toStackedY(top);
|
|
351
|
-
const yBottom = toStackedY(base);
|
|
352
|
-
topPoints.push({ x, y: yTop });
|
|
353
|
-
bottomPoints.push({ x, y: yBottom });
|
|
354
|
-
currentBaseline.set(pt.xVal, top);
|
|
355
|
-
}
|
|
356
|
-
topPoints.forEach((pt, i) => {
|
|
357
|
-
if (i === 0) c.moveTo(pt.x, pt.y);
|
|
358
|
-
else c.lineTo(pt.x, pt.y);
|
|
359
|
-
});
|
|
360
|
-
for (let i = bottomPoints.length - 1; i >= 0; i--) {
|
|
361
|
-
c.lineTo(bottomPoints[i].x, bottomPoints[i].y);
|
|
362
|
-
}
|
|
363
|
-
c.closePath();
|
|
364
|
-
c.fillStyle = color + "44";
|
|
365
|
-
c.fill();
|
|
366
|
-
c.beginPath();
|
|
367
|
-
topPoints.forEach((pt, i) => {
|
|
368
|
-
if (i === 0) c.moveTo(pt.x, pt.y);
|
|
369
|
-
else c.lineTo(pt.x, pt.y);
|
|
370
|
-
});
|
|
371
|
-
c.strokeStyle = color;
|
|
372
|
-
c.lineWidth = 2;
|
|
373
|
-
c.stroke();
|
|
374
|
-
} else {
|
|
375
|
-
pts.forEach((pt, i) => {
|
|
376
|
-
const x = axes.toX(pt.xVal);
|
|
377
|
-
const y = toStackedY(pt.yVal);
|
|
378
|
-
if (i === 0) c.moveTo(x, y);
|
|
379
|
-
else c.lineTo(x, y);
|
|
380
|
-
});
|
|
381
|
-
if (pts.length > 0) {
|
|
382
|
-
const lastX = axes.toX(pts[pts.length - 1].xVal);
|
|
383
|
-
const firstX = axes.toX(pts[0].xVal);
|
|
384
|
-
const baselineY = axes.plotTop + axes.plotHeight.value;
|
|
385
|
-
c.lineTo(lastX, baselineY);
|
|
386
|
-
c.lineTo(firstX, baselineY);
|
|
387
|
-
c.closePath();
|
|
388
|
-
}
|
|
389
|
-
c.fillStyle = color + "33";
|
|
390
|
-
c.fill();
|
|
391
|
-
c.beginPath();
|
|
392
|
-
pts.forEach((pt, i) => {
|
|
393
|
-
const x = axes.toX(pt.xVal);
|
|
394
|
-
const y = toStackedY(pt.yVal);
|
|
395
|
-
if (i === 0) c.moveTo(x, y);
|
|
396
|
-
else c.lineTo(x, y);
|
|
397
|
-
});
|
|
398
|
-
c.strokeStyle = color;
|
|
399
|
-
c.lineWidth = 2;
|
|
400
|
-
c.lineJoin = "round";
|
|
401
|
-
c.stroke();
|
|
402
|
-
}
|
|
403
|
-
c.restore();
|
|
213
|
+
drawAreaSeries(c, seriesItems, axes, toStackedY, color, p, props.stacked, currentBaseline);
|
|
404
214
|
seriesIdx++;
|
|
405
215
|
}
|
|
406
216
|
c.restore();
|
|
407
217
|
if (props.showLegend) {
|
|
408
|
-
|
|
218
|
+
drawChartLegend(
|
|
219
|
+
c,
|
|
220
|
+
Array.from(seriesMap.value.keys()),
|
|
221
|
+
props.colors,
|
|
222
|
+
axes.plotLeft,
|
|
223
|
+
axes.plotTop + axes.plotHeight.value + 28,
|
|
224
|
+
"rect"
|
|
225
|
+
);
|
|
409
226
|
}
|
|
410
227
|
};
|
|
411
|
-
const drawLegend = (c) => {
|
|
412
|
-
c.save();
|
|
413
|
-
c.font = "11px system-ui, sans-serif";
|
|
414
|
-
c.textAlign = "left";
|
|
415
|
-
c.textBaseline = "middle";
|
|
416
|
-
const keys = Array.from(seriesMap.value.keys());
|
|
417
|
-
let xOffset = axes.plotLeft;
|
|
418
|
-
const yPos = axes.plotTop + axes.plotHeight.value + 28;
|
|
419
|
-
keys.forEach((key, i) => {
|
|
420
|
-
const color = props.colors[i % props.colors.length];
|
|
421
|
-
c.fillStyle = color;
|
|
422
|
-
c.fillRect(xOffset, yPos - 4, 10, 8);
|
|
423
|
-
c.fillStyle = "rgba(150,150,170,0.9)";
|
|
424
|
-
const label = key === "default" ? "Series" : key;
|
|
425
|
-
c.fillText(label, xOffset + 15, yPos);
|
|
426
|
-
xOffset += c.measureText(label).width + 35;
|
|
427
|
-
});
|
|
428
|
-
c.restore();
|
|
429
|
-
};
|
|
430
228
|
watch(progress, draw);
|
|
431
229
|
watch([scale, panOffset, hoveredIndex, resizeTick, width, height, () => props.stacked], draw);
|
|
432
230
|
watch(items, () => {
|
|
@@ -37,6 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
37
37
|
y: number;
|
|
38
38
|
}) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
|
+
xAxisTitle: string;
|
|
41
|
+
yAxisTitle: string;
|
|
40
42
|
xField: string;
|
|
41
43
|
yField: string;
|
|
42
44
|
seriesField: string;
|
|
@@ -48,8 +50,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
48
50
|
colors: string[];
|
|
49
51
|
backgroundColor: string;
|
|
50
52
|
showLegend: boolean;
|
|
51
|
-
xAxisTitle: string;
|
|
52
|
-
yAxisTitle: string;
|
|
53
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
54
|
declare const _default: typeof __VLS_export;
|
|
55
55
|
export default _default;
|
|
@@ -38,6 +38,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
38
38
|
y: number;
|
|
39
39
|
}) => any) | undefined;
|
|
40
40
|
}>, {
|
|
41
|
+
xAxisTitle: string;
|
|
42
|
+
yAxisTitle: string;
|
|
41
43
|
animated: boolean;
|
|
42
44
|
zoomable: boolean;
|
|
43
45
|
wheelNavigation: boolean;
|
|
@@ -45,13 +47,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
45
47
|
colors: string[];
|
|
46
48
|
backgroundColor: string;
|
|
47
49
|
showLegend: boolean;
|
|
48
|
-
|
|
49
|
-
yAxisTitle: string;
|
|
50
|
-
categoryField: string;
|
|
51
|
-
valueField: string;
|
|
50
|
+
mode: "simple" | "clustered" | "stacked";
|
|
52
51
|
groupField: string;
|
|
52
|
+
valueField: string;
|
|
53
|
+
categoryField: string;
|
|
53
54
|
orientation: "vertical" | "horizontal";
|
|
54
|
-
mode: "simple" | "clustered" | "stacked";
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
56
|
declare const _default: typeof __VLS_export;
|
|
57
57
|
export default _default;
|