vue-chrts 0.2.0-test.1 → 0.2.0-test.10
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/components/AreaChart/AreaChart.js +68 -63
- package/dist/components/AreaChart/AreaChart.vue.d.ts +4 -2
- package/dist/components/AreaChart/types.d.ts +33 -3
- package/dist/components/AreaStackedChart/AreaStackedChart.js +20 -23
- package/dist/components/AreaStackedChart/types.d.ts +18 -0
- package/dist/components/BarChart/BarChart.js +77 -99
- package/dist/components/BarChart/BarChart.vue.d.ts +5 -3
- package/dist/components/BarChart/stackedGroupedUtils.d.ts +19 -0
- package/dist/components/BarChart/stackedGroupedUtils.js +67 -0
- package/dist/components/BarChart/types.d.ts +41 -22
- package/dist/components/DonutChart/DonutChart.js +43 -37
- package/dist/components/DonutChart/DonutChart.vue.d.ts +4 -2
- package/dist/components/DonutChart/types.d.ts +7 -3
- package/dist/components/LineChart/LineChart.js +67 -57
- package/dist/components/LineChart/LineChart.vue.d.ts +4 -2
- package/dist/components/LineChart/types.d.ts +34 -3
- package/dist/components/Tooltip.js +10 -10
- package/dist/components/Tooltip.vue.d.ts +3 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.js +9 -11
- package/dist/types.d.ts +7 -38
- package/dist/types.js +2 -4
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +45 -5
- package/package.json +17 -16
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Position as
|
|
3
|
-
import { getFirstPropertyValue as
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as P, computed as k, useSlots as x, useTemplateRef as O, ref as j, createElementBlock as u, openBlock as n, normalizeClass as g, createVNode as s, createCommentVNode as a, createElementVNode as w, unref as i, withCtx as M, createBlock as m, Fragment as W, renderList as E, mergeProps as G, renderSlot as h } from "vue";
|
|
2
|
+
import { Position as v, CurveType as X } from "@unovis/ts";
|
|
3
|
+
import { createMarkers as $, getFirstPropertyValue as z } from "../../utils.js";
|
|
4
|
+
import R from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as Y, VisTooltip as S, VisLine as H, VisAxis as T, VisCrosshair as U, VisBulletLegend as q } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as I } from "../../types.js";
|
|
7
|
+
const J = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
class: "hidden"
|
|
10
|
-
},
|
|
10
|
+
}, te = /* @__PURE__ */ P({
|
|
11
11
|
__name: "LineChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -21,13 +21,16 @@ const S = {
|
|
|
21
21
|
left: 5
|
|
22
22
|
}) },
|
|
23
23
|
categories: {},
|
|
24
|
+
markerConfig: {},
|
|
24
25
|
xFormatter: {},
|
|
25
26
|
yFormatter: {},
|
|
26
27
|
curveType: {},
|
|
27
|
-
|
|
28
|
+
lineWidth: { default: 2 },
|
|
29
|
+
lineDashArray: {},
|
|
30
|
+
xNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
|
|
28
31
|
xExplicitTicks: {},
|
|
29
32
|
minMaxTicksOnly: { type: Boolean },
|
|
30
|
-
yNumTicks: { default: (
|
|
33
|
+
yNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
|
|
31
34
|
hideTooltip: { type: Boolean },
|
|
32
35
|
hideLegend: { type: Boolean },
|
|
33
36
|
legendPosition: {},
|
|
@@ -38,42 +41,53 @@ const S = {
|
|
|
38
41
|
xTickLine: { type: Boolean },
|
|
39
42
|
yTickLine: { type: Boolean },
|
|
40
43
|
hideXAxis: { type: Boolean },
|
|
41
|
-
hideYAxis: { type: Boolean }
|
|
44
|
+
hideYAxis: { type: Boolean },
|
|
45
|
+
crosshairConfig: { default: () => ({
|
|
46
|
+
color: "#666"
|
|
47
|
+
}) }
|
|
42
48
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
|
|
49
|
+
emits: ["click"],
|
|
50
|
+
setup(o, { emit: L }) {
|
|
51
|
+
const C = L, t = o, b = k(() => t.markerConfig ? $(t.markerConfig) : ""), B = x(), c = O("slotWrapper"), l = j();
|
|
52
|
+
function D(e) {
|
|
53
|
+
return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
|
|
49
54
|
}
|
|
50
|
-
function
|
|
51
|
-
return l.value = e,
|
|
55
|
+
function V(e) {
|
|
56
|
+
return l.value = e, D();
|
|
52
57
|
}
|
|
53
|
-
const
|
|
54
|
-
() =>
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
const p = k(
|
|
59
|
+
() => t.legendPosition === I.Top
|
|
60
|
+
), A = Object.values(t.categories).map(
|
|
61
|
+
(e, r) => `var(--vis-color${r})`
|
|
62
|
+
), F = (e) => Object.values(t.categories)[e].color ?? A[e];
|
|
63
|
+
return (e, r) => (n(), u("div", {
|
|
64
|
+
class: g(["flex flex-col space-y-4", {
|
|
65
|
+
"flex-col-reverse": p.value,
|
|
66
|
+
markers: !!t.markerConfig
|
|
67
|
+
}]),
|
|
68
|
+
onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
|
|
58
69
|
}, [
|
|
59
|
-
|
|
70
|
+
s(i(Y), {
|
|
60
71
|
data: e.data,
|
|
61
72
|
padding: e.padding,
|
|
62
|
-
height: e.height
|
|
73
|
+
height: e.height,
|
|
74
|
+
svgDefs: b.value
|
|
63
75
|
}, {
|
|
64
|
-
default:
|
|
65
|
-
|
|
66
|
-
"horizontal-placement": i(
|
|
67
|
-
"vertical-placement": i(
|
|
76
|
+
default: M(() => [
|
|
77
|
+
s(i(S), {
|
|
78
|
+
"horizontal-placement": i(v).Right,
|
|
79
|
+
"vertical-placement": i(v).Top
|
|
68
80
|
}, null, 8, ["horizontal-placement", "vertical-placement"]),
|
|
69
|
-
(
|
|
70
|
-
key:
|
|
71
|
-
x: (
|
|
72
|
-
y: (
|
|
73
|
-
color:
|
|
74
|
-
"curve-type": e.curveType ?? i(
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
(n(!0), u(W, null, E(Object.keys(t.categories), (d, y) => (n(), m(i(H), {
|
|
82
|
+
key: y,
|
|
83
|
+
x: (f, N) => N,
|
|
84
|
+
y: (f) => f[d],
|
|
85
|
+
color: F(y),
|
|
86
|
+
"curve-type": e.curveType ?? i(X).MonotoneX,
|
|
87
|
+
"line-width": e.lineWidth,
|
|
88
|
+
lineDashArray: e.lineDashArray
|
|
89
|
+
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
|
|
90
|
+
e.hideXAxis ? a("", !0) : (n(), m(i(T), {
|
|
77
91
|
key: 0,
|
|
78
92
|
type: "x",
|
|
79
93
|
"tick-format": e.xFormatter,
|
|
@@ -84,9 +98,9 @@ const S = {
|
|
|
84
98
|
"tick-line": e.xTickLine,
|
|
85
99
|
"num-ticks": e.xNumTicks,
|
|
86
100
|
"tick-values": e.xExplicitTicks,
|
|
87
|
-
|
|
88
|
-
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "
|
|
89
|
-
e.hideYAxis ? a("", !0) : (
|
|
101
|
+
"min-max-ticks-only": e.minMaxTicksOnly
|
|
102
|
+
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
|
|
103
|
+
e.hideYAxis ? a("", !0) : (n(), m(i(T), {
|
|
90
104
|
key: 1,
|
|
91
105
|
type: "y",
|
|
92
106
|
"tick-format": e.yFormatter,
|
|
@@ -96,32 +110,28 @@ const S = {
|
|
|
96
110
|
"grid-line": e.yGridLine,
|
|
97
111
|
"tick-line": e.yTickLine
|
|
98
112
|
}, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
|
|
99
|
-
e.hideTooltip ? a("", !0) : (
|
|
100
|
-
key: 2,
|
|
101
|
-
color: "#666",
|
|
102
|
-
template: B
|
|
103
|
-
}))
|
|
113
|
+
e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
|
|
104
114
|
]),
|
|
105
115
|
_: 1
|
|
106
|
-
}, 8, ["data", "padding", "height"]),
|
|
107
|
-
e.hideLegend ? a("", !0) : (
|
|
116
|
+
}, 8, ["data", "padding", "height", "svgDefs"]),
|
|
117
|
+
e.hideLegend ? a("", !0) : (n(), u("div", {
|
|
108
118
|
key: 0,
|
|
109
|
-
class:
|
|
119
|
+
class: g(["flex items center justify-end", { "pb-4": p.value }])
|
|
110
120
|
}, [
|
|
111
|
-
|
|
121
|
+
s(i(q), {
|
|
112
122
|
items: Object.values(e.categories)
|
|
113
123
|
}, null, 8, ["items"])
|
|
114
124
|
], 2)),
|
|
115
|
-
|
|
116
|
-
i(
|
|
125
|
+
w("div", J, [
|
|
126
|
+
i(B).tooltip ? h(e.$slots, "tooltip", {
|
|
117
127
|
key: 0,
|
|
118
128
|
values: l.value
|
|
119
|
-
}) : l.value ?
|
|
120
|
-
|
|
129
|
+
}) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
|
|
130
|
+
s(R, {
|
|
121
131
|
data: l.value,
|
|
122
132
|
categories: e.categories,
|
|
123
|
-
toolTipTitle: i(
|
|
124
|
-
yFormatter:
|
|
133
|
+
toolTipTitle: i(z)(l.value) ?? "",
|
|
134
|
+
yFormatter: t.yFormatter
|
|
125
135
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
126
136
|
]) : a("", !0)
|
|
127
137
|
], 512)
|
|
@@ -129,5 +139,5 @@ const S = {
|
|
|
129
139
|
}
|
|
130
140
|
});
|
|
131
141
|
export {
|
|
132
|
-
|
|
142
|
+
te as default
|
|
133
143
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LineChartProps } from './types';
|
|
2
2
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
|
|
5
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
4
6
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
5
7
|
attrs: any;
|
|
6
8
|
slots: {
|
|
@@ -9,7 +11,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
9
11
|
}): any;
|
|
10
12
|
fallback?(_: {}): any;
|
|
11
13
|
};
|
|
12
|
-
emit:
|
|
14
|
+
emit: (e: "click", event: MouseEvent, values?: T) => void;
|
|
13
15
|
}>) => import('vue').VNode & {
|
|
14
16
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
15
17
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
|
|
2
|
+
import { axisFormatter, LegendPosition, MarkerConfig } from '../../types';
|
|
2
3
|
export interface LineChartProps<T> {
|
|
3
4
|
/**
|
|
4
5
|
* The data to be displayed in the line chart.
|
|
@@ -33,25 +34,37 @@ export interface LineChartProps<T> {
|
|
|
33
34
|
* This defines the visual representation and labels for each category in the chart's legend.
|
|
34
35
|
*/
|
|
35
36
|
categories: Record<string, BulletLegendItemInterface>;
|
|
37
|
+
/**
|
|
38
|
+
* A record mapping marker keys to show custom patterns.
|
|
39
|
+
*/
|
|
40
|
+
markerConfig?: Record<string, MarkerConfig>;
|
|
36
41
|
/**
|
|
37
42
|
* @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
|
|
38
43
|
* @param {number} i - The index of the tick in the `ticks` array.
|
|
39
44
|
* @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
|
|
40
45
|
* @returns {string} The formatted string representation of the tick.
|
|
41
46
|
*/
|
|
42
|
-
xFormatter?: axisFormatter
|
|
47
|
+
xFormatter?: axisFormatter;
|
|
43
48
|
/**
|
|
44
49
|
* @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
|
|
45
50
|
* @param {number} i - The index of the tick in the `ticks` array.
|
|
46
51
|
* @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
|
|
47
52
|
* @returns {string} The formatted string representation of the tick.
|
|
48
53
|
*/
|
|
49
|
-
yFormatter?: axisFormatter
|
|
54
|
+
yFormatter?: axisFormatter;
|
|
50
55
|
/**
|
|
51
56
|
* The type of curve to use for the line chart.
|
|
52
57
|
* See `CurveType` for available options.
|
|
53
58
|
*/
|
|
54
59
|
curveType?: CurveType;
|
|
60
|
+
/**
|
|
61
|
+
* The width of the line in pixels. Default is 2px.
|
|
62
|
+
*/
|
|
63
|
+
lineWidth?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Line dash array, see SVG's stroke-dasharray. Default: `undefined`
|
|
66
|
+
*/
|
|
67
|
+
lineDashArray?: number[];
|
|
55
68
|
/**
|
|
56
69
|
* The desired number of ticks on the x-axis.
|
|
57
70
|
*/
|
|
@@ -113,4 +126,22 @@ export interface LineChartProps<T> {
|
|
|
113
126
|
* If `true`, hide the y-axis.
|
|
114
127
|
*/
|
|
115
128
|
hideYAxis?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
131
|
+
*/
|
|
132
|
+
crosshairConfig?: {
|
|
133
|
+
/**
|
|
134
|
+
* The color of the crosshair line. Accepts any valid CSS color string.
|
|
135
|
+
* Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
|
|
136
|
+
*/
|
|
137
|
+
color?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The stroke color of the crosshair line. Accepts any valid CSS color string.
|
|
140
|
+
*/
|
|
141
|
+
strokeColor?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The stroke width of the crosshair line in pixels.
|
|
144
|
+
*/
|
|
145
|
+
strokeWidth?: number;
|
|
146
|
+
};
|
|
116
147
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { defineComponent as b, computed as v, createElementBlock as r, openBlock as l, createElementVNode as o, toDisplayString as i, Fragment as
|
|
1
|
+
import { defineComponent as b, computed as v, createElementBlock as r, openBlock as l, createElementVNode as o, toDisplayString as i, Fragment as y, renderList as h, normalizeStyle as n } from "vue";
|
|
2
2
|
const f = {
|
|
3
3
|
class: "capitalize border-b mb-1 pb-1",
|
|
4
4
|
style: {
|
|
5
5
|
color: "var(--tooltip-value-color)",
|
|
6
6
|
borderColor: "rgba(255, 255, 255, 0.05)"
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, F = /* @__PURE__ */ b({
|
|
9
9
|
__name: "Tooltip",
|
|
10
10
|
props: {
|
|
11
11
|
data: {},
|
|
12
12
|
categories: {},
|
|
13
13
|
toolTipTitle: {},
|
|
14
|
-
yFormatter: {}
|
|
14
|
+
yFormatter: { type: Function }
|
|
15
15
|
},
|
|
16
16
|
setup(p) {
|
|
17
|
-
const
|
|
18
|
-
([e, g]) => !d.includes(e) && Object.keys(
|
|
17
|
+
const a = p, d = ["_index", "_stacked", "_ending"], m = v(() => Object.entries(a.data ?? []).filter(
|
|
18
|
+
([e, g]) => !d.includes(e) && Object.keys(a.categories).includes(e)
|
|
19
19
|
));
|
|
20
20
|
return (e, g) => (l(), r("div", null, [
|
|
21
21
|
o("div", f, i(e.toolTipTitle), 1),
|
|
22
|
-
(l(!0), r(
|
|
22
|
+
(l(!0), r(y, null, h(m.value, ([t, s], u) => {
|
|
23
23
|
var c;
|
|
24
24
|
return l(), r("div", {
|
|
25
25
|
key: t,
|
|
26
26
|
style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
|
|
27
27
|
}, [
|
|
28
28
|
o("span", {
|
|
29
|
-
style:
|
|
29
|
+
style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
|
|
30
30
|
backgroundColor: (c = e.categories[t]) != null && c.color ? e.categories[t].color : `var(--vis-color${u})`
|
|
31
31
|
}])
|
|
32
32
|
}, null, 4),
|
|
33
33
|
o("div", null, [
|
|
34
34
|
o("span", {
|
|
35
|
-
style:
|
|
35
|
+
style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
|
|
36
36
|
}, i(e.categories[t].name) + ":", 1),
|
|
37
37
|
o("span", {
|
|
38
|
-
style:
|
|
38
|
+
style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
|
|
39
39
|
}, i(e.yFormatter ? e.yFormatter(s) : s), 1)
|
|
40
40
|
])
|
|
41
41
|
]);
|
|
@@ -44,5 +44,5 @@ const f = {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
F as default
|
|
48
48
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { axisFormatter
|
|
1
|
+
import { axisFormatter } from '../types';
|
|
2
|
+
import { BulletLegendItemInterface } from '@unovis/ts';
|
|
2
3
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
5
|
data: T;
|
|
5
6
|
categories: Record<string, BulletLegendItemInterface>;
|
|
6
7
|
toolTipTitle: string | number;
|
|
7
|
-
yFormatter?: axisFormatter
|
|
8
|
+
yFormatter?: axisFormatter;
|
|
8
9
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
9
10
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
10
11
|
attrs: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ import { default as AreaStackedChart } from './components/AreaStackedChart/AreaS
|
|
|
3
3
|
import { default as LineChart } from './components/LineChart/LineChart.vue';
|
|
4
4
|
import { default as BarChart } from './components/BarChart/BarChart.vue';
|
|
5
5
|
import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
|
|
6
|
-
import { LegendPosition
|
|
7
|
-
export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart,
|
|
8
|
-
export type { BulletLegendItemInterface, };
|
|
6
|
+
import { LegendPosition } from './types';
|
|
7
|
+
export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, LegendPosition };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as t } from "./components/AreaChart/AreaChart.js";
|
|
2
2
|
import { default as o } from "./components/AreaStackedChart/AreaStackedChart.js";
|
|
3
3
|
import { default as d } from "./components/LineChart/LineChart.js";
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import {
|
|
4
|
+
import { default as p } from "./components/BarChart/BarChart.js";
|
|
5
|
+
import { default as u } from "./components/DonutChart/DonutChart.js";
|
|
6
|
+
import { LegendPosition as h } from "./types.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
t as AreaChart,
|
|
9
9
|
o as AreaStackedChart,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
d as LineChart,
|
|
15
|
-
h as Orientation
|
|
10
|
+
p as BarChart,
|
|
11
|
+
u as DonutChart,
|
|
12
|
+
h as LegendPosition,
|
|
13
|
+
d as LineChart
|
|
16
14
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { BarChartProps } from './components/BarChart/types';
|
|
3
|
-
import { LineChartProps } from './components/LineChart/types';
|
|
4
|
-
import { DonutChartProps } from './components/DonutChart/types';
|
|
5
|
-
declare enum LegendPosition {
|
|
1
|
+
export declare enum LegendPosition {
|
|
6
2
|
Top = "top",
|
|
7
3
|
Bottom = "bottom"
|
|
8
4
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Cardinal = "cardinal",
|
|
15
|
-
CardinalClosed = "cardinalClosed",
|
|
16
|
-
CardinalOpen = "cardinalOpen",
|
|
17
|
-
CatmullRom = "catmullRom",
|
|
18
|
-
CatmullRomClosed = "catmullRomClosed",
|
|
19
|
-
CatmullRomOpen = "catmullRomOpen",
|
|
20
|
-
Linear = "linear",
|
|
21
|
-
LinearClosed = "linearClosed",
|
|
22
|
-
MonotoneX = "monotoneX",
|
|
23
|
-
MonotoneY = "monotoneY",
|
|
24
|
-
Natural = "natural",
|
|
25
|
-
Step = "step",
|
|
26
|
-
StepAfter = "stepAfter",
|
|
27
|
-
StepBefore = "stepBefore"
|
|
28
|
-
}
|
|
29
|
-
interface BulletLegendItemInterface {
|
|
30
|
-
name: string | number;
|
|
5
|
+
export type axisFormatter = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
|
|
6
|
+
export interface MarkerConfig {
|
|
7
|
+
type?: "circle" | "square" | "triangle" | "diamond";
|
|
8
|
+
size?: number;
|
|
9
|
+
strokeWidth?: number;
|
|
31
10
|
color?: string;
|
|
32
|
-
|
|
33
|
-
shape?: any;
|
|
34
|
-
inactive?: boolean;
|
|
35
|
-
hidden?: boolean;
|
|
36
|
-
pointer?: boolean;
|
|
37
|
-
}
|
|
38
|
-
declare enum Orientation {
|
|
39
|
-
Horizontal = "horizontal",
|
|
40
|
-
Vertical = "vertical"
|
|
11
|
+
strokeColor?: string;
|
|
41
12
|
}
|
|
42
|
-
export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, };
|
|
43
|
-
export type axisFormatter<T> = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var o = /* @__PURE__ */ ((t) => (t.Top = "top", t.Bottom = "bottom", t))(o || {});
|
|
2
2
|
export {
|
|
3
|
-
o as
|
|
4
|
-
l as LegendPosition,
|
|
5
|
-
t as Orientation
|
|
3
|
+
o as LegendPosition
|
|
6
4
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { MarkerConfig } from './types';
|
|
1
2
|
export declare function getDistributedIndices(length: number, numTicks: number): number[];
|
|
2
3
|
export declare function getFirstPropertyValue(obj: unknown): undefined;
|
|
4
|
+
export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string, strokeColor: string) => string;
|
|
5
|
+
export declare function createMarkers(markerConfig: Record<string, MarkerConfig>): string;
|
|
6
|
+
export declare const flattenData: (data: any[], xAxis: string) => {
|
|
7
|
+
month: any;
|
|
8
|
+
}[];
|
package/dist/utils.js
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
const
|
|
4
|
-
return e
|
|
1
|
+
function o(n) {
|
|
2
|
+
if (n && Object.keys(n).length > 0) {
|
|
3
|
+
const e = Object.keys(n)[0];
|
|
4
|
+
return n[e];
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
const u = (n, e, r, t, $) => {
|
|
8
|
+
switch (n) {
|
|
9
|
+
case "circle":
|
|
10
|
+
return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
11
|
+
case "square":
|
|
12
|
+
return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
13
|
+
case "triangle":
|
|
14
|
+
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e - r / 2} ${r / 2},${e - r / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
15
|
+
case "diamond":
|
|
16
|
+
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e / 2} ${e / 2},${e - r / 2} ${r / 2},${e / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
17
|
+
default:
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function m(n) {
|
|
22
|
+
return Object.entries(n).map(([e, r]) => {
|
|
23
|
+
const t = r.type || "circle", $ = r.size || 10, c = r.strokeWidth || 2, a = r.color || "#000", l = r.strokeColor || r.color || "#000";
|
|
24
|
+
return `<marker id="circle-marker-${e}" viewBox="0 0 ${$} ${$}" refX="${$ / 2}" refY="${$ / 2}" markerWidth="${$ / 2}" markerHeight="${$ / 2}">
|
|
25
|
+
${u(t, $, c, a, l)}
|
|
26
|
+
</marker>`;
|
|
27
|
+
}).join(`
|
|
28
|
+
`);
|
|
29
|
+
}
|
|
30
|
+
function p(n) {
|
|
31
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
32
|
+
}
|
|
33
|
+
const y = (n, e) => {
|
|
34
|
+
const r = Object.keys(n[0]).filter(($) => $ !== e), t = Object.keys(n[0][r[0]]);
|
|
35
|
+
return n.map(($) => ({
|
|
36
|
+
month: $.month,
|
|
37
|
+
...r.flatMap(
|
|
38
|
+
(c) => t.map((a) => ({
|
|
39
|
+
[`${c}${p(a)}`]: $[c][a]
|
|
40
|
+
}))
|
|
41
|
+
).reduce((c, a) => ({ ...c, ...a }), {})
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
7
44
|
export {
|
|
8
|
-
|
|
45
|
+
m as createMarkers,
|
|
46
|
+
y as flattenData,
|
|
47
|
+
o as getFirstPropertyValue,
|
|
48
|
+
u as markerShape
|
|
9
49
|
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-chrts",
|
|
3
|
-
"version": "0.2.0-test.
|
|
3
|
+
"version": "0.2.0-test.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
|
-
"main": "./dist/index.
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"import": "./dist/index.js"
|
|
14
|
-
"require": "./dist/index.umd.cjs"
|
|
13
|
+
"import": "./dist/index.js"
|
|
15
14
|
}
|
|
16
15
|
},
|
|
17
16
|
"scripts": {
|
|
@@ -21,26 +20,28 @@
|
|
|
21
20
|
"release": "commit-and-tag-version"
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
|
-
"@unovis/ts": "^1.5.2"
|
|
23
|
+
"@unovis/ts": "^1.5.2",
|
|
24
|
+
"@unovis/vue": "^1.5.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": "^3.5.13"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tailwindcss/vite": "^4.
|
|
31
|
-
"@tanstack/vue-table": "^8.21.
|
|
32
|
-
"@types/node": "^22.
|
|
30
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
31
|
+
"@tanstack/vue-table": "^8.21.3",
|
|
32
|
+
"@types/node": "^22.16.5",
|
|
33
|
+
"@unovis/ts": "^1.5.2",
|
|
33
34
|
"@unovis/vue": "^1.5.2",
|
|
34
|
-
"@vitejs/plugin-vue": "^5.2.
|
|
35
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
35
36
|
"@vue/tsconfig": "^0.7.0",
|
|
36
|
-
"@vueuse/core": "^13.
|
|
37
|
+
"@vueuse/core": "^13.5.0",
|
|
37
38
|
"commit-and-tag-version": "^12.5.1",
|
|
38
|
-
"tailwindcss": "^4.
|
|
39
|
-
"typescript": "~5.7.
|
|
40
|
-
"vite": "^6.
|
|
41
|
-
"vite-plugin-dts": "^4.5.
|
|
42
|
-
"vue-router": "^4.5.
|
|
43
|
-
"vue-tsc": "^2.2.
|
|
39
|
+
"tailwindcss": "^4.1.11",
|
|
40
|
+
"typescript": "~5.7.3",
|
|
41
|
+
"vite": "^6.3.5",
|
|
42
|
+
"vite-plugin-dts": "^4.5.4",
|
|
43
|
+
"vue-router": "^4.5.1",
|
|
44
|
+
"vue-tsc": "^2.2.12"
|
|
44
45
|
},
|
|
45
46
|
"packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
|
|
46
47
|
}
|