vue-chrts 0.2.0-test.5 → 0.2.0-test.6
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 +161 -4
- package/dist/components/AreaChart/AreaChart.vue.d.ts +4 -2
- package/dist/components/AreaChart/AreaChart2.js +2 -161
- package/dist/components/AreaChart/types.d.ts +20 -2
- 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 +56 -55
- package/dist/components/LineChart/LineChart.vue.d.ts +4 -2
- package/dist/components/LineChart/types.d.ts +24 -5
- 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 +6 -43
- package/dist/types.js +2 -4
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +33 -18
- package/package.json +14 -15
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/index.js.css +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Position as
|
|
3
|
-
import { createMarkers 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: {},
|
|
@@ -41,48 +41,53 @@ const U = {
|
|
|
41
41
|
xTickLine: { type: Boolean },
|
|
42
42
|
yTickLine: { type: Boolean },
|
|
43
43
|
hideXAxis: { type: Boolean },
|
|
44
|
-
hideYAxis: { type: Boolean }
|
|
44
|
+
hideYAxis: { type: Boolean },
|
|
45
|
+
crosshairConfig: { default: () => ({
|
|
46
|
+
color: "#666"
|
|
47
|
+
}) }
|
|
45
48
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 : "";
|
|
50
54
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
55
|
+
function V(e) {
|
|
56
|
+
return l.value = e, D();
|
|
53
57
|
}
|
|
54
|
-
const
|
|
55
|
-
() => t.legendPosition ===
|
|
56
|
-
),
|
|
57
|
-
(e,
|
|
58
|
-
),
|
|
59
|
-
return (e,
|
|
60
|
-
class:
|
|
61
|
-
"flex-col-reverse":
|
|
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,
|
|
62
66
|
markers: !!t.markerConfig
|
|
63
|
-
}])
|
|
67
|
+
}]),
|
|
68
|
+
onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
|
|
64
69
|
}, [
|
|
65
|
-
|
|
70
|
+
s(i(Y), {
|
|
66
71
|
data: e.data,
|
|
67
72
|
padding: e.padding,
|
|
68
73
|
height: e.height,
|
|
69
|
-
svgDefs:
|
|
74
|
+
svgDefs: b.value
|
|
70
75
|
}, {
|
|
71
|
-
default:
|
|
72
|
-
|
|
73
|
-
"horizontal-placement": i(
|
|
74
|
-
"vertical-placement": i(
|
|
76
|
+
default: M(() => [
|
|
77
|
+
s(i(S), {
|
|
78
|
+
"horizontal-placement": i(v).Right,
|
|
79
|
+
"vertical-placement": i(v).Top
|
|
75
80
|
}, null, 8, ["horizontal-placement", "vertical-placement"]),
|
|
76
|
-
(n(!0),
|
|
77
|
-
key:
|
|
78
|
-
x: (
|
|
79
|
-
y: (
|
|
80
|
-
color:
|
|
81
|
-
"curve-type": e.curveType ?? i(
|
|
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,
|
|
82
87
|
"line-width": e.lineWidth,
|
|
83
88
|
lineDashArray: e.lineDashArray
|
|
84
89
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
|
|
85
|
-
e.hideXAxis ?
|
|
90
|
+
e.hideXAxis ? a("", !0) : (n(), m(i(T), {
|
|
86
91
|
key: 0,
|
|
87
92
|
type: "x",
|
|
88
93
|
"tick-format": e.xFormatter,
|
|
@@ -95,7 +100,7 @@ const U = {
|
|
|
95
100
|
"tick-values": e.xExplicitTicks,
|
|
96
101
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
97
102
|
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
|
|
98
|
-
e.hideYAxis ?
|
|
103
|
+
e.hideYAxis ? a("", !0) : (n(), m(i(T), {
|
|
99
104
|
key: 1,
|
|
100
105
|
type: "y",
|
|
101
106
|
"tick-format": e.yFormatter,
|
|
@@ -105,38 +110,34 @@ const U = {
|
|
|
105
110
|
"grid-line": e.yGridLine,
|
|
106
111
|
"tick-line": e.yTickLine
|
|
107
112
|
}, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
|
|
108
|
-
e.hideTooltip ?
|
|
109
|
-
key: 2,
|
|
110
|
-
color: "#666",
|
|
111
|
-
template: B
|
|
112
|
-
}))
|
|
113
|
+
e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
|
|
113
114
|
]),
|
|
114
115
|
_: 1
|
|
115
116
|
}, 8, ["data", "padding", "height", "svgDefs"]),
|
|
116
|
-
e.hideLegend ?
|
|
117
|
+
e.hideLegend ? a("", !0) : (n(), u("div", {
|
|
117
118
|
key: 0,
|
|
118
|
-
class:
|
|
119
|
+
class: g(["flex items center justify-end", { "pb-4": p.value }])
|
|
119
120
|
}, [
|
|
120
|
-
|
|
121
|
+
s(i(q), {
|
|
121
122
|
items: Object.values(e.categories)
|
|
122
123
|
}, null, 8, ["items"])
|
|
123
124
|
], 2)),
|
|
124
|
-
|
|
125
|
-
i(
|
|
125
|
+
w("div", J, [
|
|
126
|
+
i(B).tooltip ? h(e.$slots, "tooltip", {
|
|
126
127
|
key: 0,
|
|
127
|
-
values:
|
|
128
|
-
}) :
|
|
129
|
-
|
|
130
|
-
data:
|
|
128
|
+
values: l.value
|
|
129
|
+
}) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
|
|
130
|
+
s(R, {
|
|
131
|
+
data: l.value,
|
|
131
132
|
categories: e.categories,
|
|
132
|
-
toolTipTitle: i(
|
|
133
|
+
toolTipTitle: i(z)(l.value) ?? "",
|
|
133
134
|
yFormatter: t.yFormatter
|
|
134
135
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
135
|
-
]) :
|
|
136
|
+
]) : a("", !0)
|
|
136
137
|
], 512)
|
|
137
138
|
], 2));
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
export {
|
|
141
|
-
|
|
142
|
+
te as default
|
|
142
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.
|
|
@@ -43,22 +44,22 @@ export interface LineChartProps<T> {
|
|
|
43
44
|
* @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
|
|
44
45
|
* @returns {string} The formatted string representation of the tick.
|
|
45
46
|
*/
|
|
46
|
-
xFormatter?: axisFormatter
|
|
47
|
+
xFormatter?: axisFormatter;
|
|
47
48
|
/**
|
|
48
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.
|
|
49
50
|
* @param {number} i - The index of the tick in the `ticks` array.
|
|
50
51
|
* @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
|
|
51
52
|
* @returns {string} The formatted string representation of the tick.
|
|
52
53
|
*/
|
|
53
|
-
yFormatter?: axisFormatter
|
|
54
|
+
yFormatter?: axisFormatter;
|
|
54
55
|
/**
|
|
55
56
|
* The type of curve to use for the line chart.
|
|
56
57
|
* See `CurveType` for available options.
|
|
57
58
|
*/
|
|
58
59
|
curveType?: CurveType;
|
|
59
60
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
* The width of the line in pixels. Default is 2px.
|
|
62
|
+
*/
|
|
62
63
|
lineWidth?: number;
|
|
63
64
|
/**
|
|
64
65
|
* Line dash array, see SVG's stroke-dasharray. Default: `undefined`
|
|
@@ -125,4 +126,22 @@ export interface LineChartProps<T> {
|
|
|
125
126
|
* If `true`, hide the y-axis.
|
|
126
127
|
*/
|
|
127
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
|
+
};
|
|
128
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,49 +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
|
-
BasisOpen = "basisOpen",
|
|
13
|
-
Bundle = "bundle",
|
|
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;
|
|
31
|
-
color?: string;
|
|
32
|
-
className?: string;
|
|
33
|
-
shape?: any;
|
|
34
|
-
inactive?: boolean;
|
|
35
|
-
hidden?: boolean;
|
|
36
|
-
pointer?: boolean;
|
|
37
|
-
}
|
|
38
|
-
declare enum Orientation {
|
|
39
|
-
Horizontal = "horizontal",
|
|
40
|
-
Vertical = "vertical"
|
|
41
|
-
}
|
|
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);
|
|
44
|
-
export type MarkerConfig = {
|
|
45
|
-
type: "circle" | "square" | "triangle" | "diamond";
|
|
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";
|
|
46
8
|
size?: number;
|
|
47
9
|
strokeWidth?: number;
|
|
48
10
|
color?: string;
|
|
49
|
-
|
|
11
|
+
strokeColor?: string;
|
|
12
|
+
}
|
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,5 +1,8 @@
|
|
|
1
1
|
import { MarkerConfig } from './types';
|
|
2
2
|
export declare function getDistributedIndices(length: number, numTicks: number): number[];
|
|
3
3
|
export declare function getFirstPropertyValue(obj: unknown): undefined;
|
|
4
|
-
export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string) => string;
|
|
4
|
+
export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string, strokeColor: string) => string;
|
|
5
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,34 +1,49 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
const
|
|
4
|
-
return
|
|
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
|
|
8
|
-
switch (
|
|
7
|
+
const u = (n, e, r, t, $) => {
|
|
8
|
+
switch (n) {
|
|
9
9
|
case "circle":
|
|
10
|
-
return `<circle cx="${
|
|
10
|
+
return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
11
11
|
case "square":
|
|
12
|
-
return `<rect x="${r / 2}" y="${r / 2}" width="${
|
|
12
|
+
return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
|
|
13
13
|
case "triangle":
|
|
14
|
-
return `<polygon points="${
|
|
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
15
|
case "diamond":
|
|
16
|
-
return `<polygon points="${
|
|
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
17
|
default:
|
|
18
18
|
return "";
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
return Object.entries(
|
|
23
|
-
const
|
|
24
|
-
return `<marker id="circle-marker-${
|
|
25
|
-
${
|
|
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
26
|
</marker>`;
|
|
27
27
|
}).join(`
|
|
28
28
|
`);
|
|
29
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
|
+
};
|
|
30
44
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
m as createMarkers,
|
|
46
|
+
y as flattenData,
|
|
47
|
+
o as getFirstPropertyValue,
|
|
48
|
+
u as markerShape
|
|
34
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.6",
|
|
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": {
|
|
@@ -24,21 +23,21 @@
|
|
|
24
23
|
"vue": "^3.5.13"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@tailwindcss/vite": "^4.
|
|
28
|
-
"@tanstack/vue-table": "^8.21.
|
|
29
|
-
"@types/node": "^22.
|
|
26
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
27
|
+
"@tanstack/vue-table": "^8.21.3",
|
|
28
|
+
"@types/node": "^22.16.5",
|
|
30
29
|
"@unovis/ts": "^1.5.2",
|
|
31
30
|
"@unovis/vue": "^1.5.2",
|
|
32
|
-
"@vitejs/plugin-vue": "^5.2.
|
|
31
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
33
32
|
"@vue/tsconfig": "^0.7.0",
|
|
34
|
-
"@vueuse/core": "^13.
|
|
33
|
+
"@vueuse/core": "^13.5.0",
|
|
35
34
|
"commit-and-tag-version": "^12.5.1",
|
|
36
|
-
"tailwindcss": "^4.
|
|
37
|
-
"typescript": "~5.7.
|
|
38
|
-
"vite": "^6.
|
|
39
|
-
"vite-plugin-dts": "^4.5.
|
|
40
|
-
"vue-router": "^4.5.
|
|
41
|
-
"vue-tsc": "^2.2.
|
|
35
|
+
"tailwindcss": "^4.1.11",
|
|
36
|
+
"typescript": "~5.7.3",
|
|
37
|
+
"vite": "^6.3.5",
|
|
38
|
+
"vite-plugin-dts": "^4.5.4",
|
|
39
|
+
"vue-router": "^4.5.1",
|
|
40
|
+
"vue-tsc": "^2.2.12"
|
|
42
41
|
},
|
|
43
42
|
"packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
|
|
44
43
|
}
|
package/dist/index.js.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.markers[data-v-f08e19f3] *[stroke="#156F36"]{marker:url(#circle-marker-desktop)}.markers[data-v-f08e19f3] *[stroke="#4ade80"]{marker:url(#circle-marker-mobile)}
|