vue-chrts 0.1.1-test.4 → 0.1.2
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
CHANGED
|
@@ -9,12 +9,33 @@ A Vue 3 charts package inspired by [Tremor](https://tremor.so/), built on top of
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- 📊 Multiple chart types: Line, Bar, Area, Stacked Area, Donut
|
|
12
|
-
- 🎨 Customizable
|
|
12
|
+
- 🎨 Customizable
|
|
13
13
|
- 📱 Responsive design
|
|
14
14
|
- 💡 Simple, intuitive API
|
|
15
15
|
- 🚀 Built with Vue 3 and TypeScript
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
[Check the docs and examples](https://nuxtcharts.com/docs)
|
|
19
|
+
|
|
20
|
+
## Installation Nuxt
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# npm
|
|
24
|
+
npm install nuxt-charts
|
|
25
|
+
|
|
26
|
+
# yarn
|
|
27
|
+
yarn add nuxt-charts
|
|
28
|
+
|
|
29
|
+
# pnpm
|
|
30
|
+
pnpm add nuxt-charts
|
|
31
|
+
|
|
32
|
+
# Add module to your nuxt.config.ts
|
|
33
|
+
export default defineNuxtConfig({
|
|
34
|
+
modules: ["nuxt-charts"]
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Installation Vue.js
|
|
18
39
|
|
|
19
40
|
```bash
|
|
20
41
|
# npm
|
|
@@ -25,7 +46,12 @@ yarn add vue-chrts
|
|
|
25
46
|
|
|
26
47
|
# pnpm
|
|
27
48
|
pnpm add vue-chrts
|
|
49
|
+
|
|
50
|
+
# import component
|
|
51
|
+
import { LineChart } from 'vue-chrts';
|
|
52
|
+
|
|
28
53
|
```
|
|
54
|
+
|
|
29
55
|
[Check the docs and examples](https://nuxtcharts.com/docs)
|
|
30
56
|
|
|
31
57
|
## Usage Example
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Orientation as
|
|
3
|
-
import { VisXYContainer as
|
|
4
|
-
import
|
|
5
|
-
import { LegendPosition as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as v, computed as c, createApp as V, createElementBlock as f, openBlock as s, normalizeClass as b, createVNode as l, createCommentVNode as P, unref as i, withCtx as x, createBlock as L } from "vue";
|
|
2
|
+
import { Orientation as o, StackedBar as A, GroupedBar as O } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as C, VisTooltip as G, VisGroupedBar as N, VisStackedBar as j, VisAxis as h, VisBulletLegend as w } from "@unovis/vue";
|
|
4
|
+
import E from "../Tooltip.js";
|
|
5
|
+
import { LegendPosition as z } from "../../types.js";
|
|
6
|
+
const S = /* @__PURE__ */ v({
|
|
7
7
|
__name: "BarChart",
|
|
8
8
|
props: {
|
|
9
9
|
data: {},
|
|
@@ -23,7 +23,7 @@ const z = /* @__PURE__ */ b({
|
|
|
23
23
|
barPadding: {},
|
|
24
24
|
radius: {},
|
|
25
25
|
hideLegend: { type: Boolean },
|
|
26
|
-
orientation: { default:
|
|
26
|
+
orientation: { default: o.Vertical },
|
|
27
27
|
legendPosition: {},
|
|
28
28
|
xDomainLine: { type: Boolean },
|
|
29
29
|
yDomainLine: { type: Boolean },
|
|
@@ -36,55 +36,56 @@ const z = /* @__PURE__ */ b({
|
|
|
36
36
|
const a = n;
|
|
37
37
|
if (!a.yAxis || a.yAxis.length === 0)
|
|
38
38
|
throw new Error("yAxis is required");
|
|
39
|
-
const
|
|
40
|
-
() => a.legendPosition ===
|
|
41
|
-
),
|
|
39
|
+
const m = c(() => a.yAxis.map((e) => (t) => t[e])), p = (e, t) => Object.values(a.categories)[t].color, g = c(
|
|
40
|
+
() => a.legendPosition === z.Top
|
|
41
|
+
), y = c(() => (e, t) => {
|
|
42
42
|
if (typeof window > "u" || typeof document > "u")
|
|
43
43
|
return "";
|
|
44
|
+
const u = Object.keys(a.categories), B = Object.keys(e).find((r) => !u.includes(r));
|
|
44
45
|
try {
|
|
45
|
-
const r =
|
|
46
|
+
const r = V(E, {
|
|
46
47
|
data: e,
|
|
47
48
|
categories: a.categories,
|
|
48
|
-
xValue:
|
|
49
|
-
}),
|
|
50
|
-
r.mount(
|
|
51
|
-
const
|
|
52
|
-
return r.unmount(),
|
|
49
|
+
xValue: e[B]
|
|
50
|
+
}), k = document.createElement("div");
|
|
51
|
+
r.mount(k);
|
|
52
|
+
const T = k.innerHTML;
|
|
53
|
+
return r.unmount(), T;
|
|
53
54
|
} catch {
|
|
54
55
|
return "";
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
|
-
return (e,
|
|
58
|
-
class:
|
|
58
|
+
return (e, t) => (s(), f("div", {
|
|
59
|
+
class: b(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
|
|
59
60
|
}, [
|
|
60
|
-
l(i(
|
|
61
|
-
default:
|
|
62
|
-
l(i(
|
|
61
|
+
l(i(C), { height: e.height }, {
|
|
62
|
+
default: x(() => [
|
|
63
|
+
l(i(G), {
|
|
63
64
|
triggers: {
|
|
64
|
-
[i(
|
|
65
|
-
[i(
|
|
65
|
+
[i(O).selectors.bar]: y.value,
|
|
66
|
+
[i(A).selectors.bar]: y.value
|
|
66
67
|
}
|
|
67
68
|
}, null, 8, ["triggers"]),
|
|
68
|
-
e.stacked ? (
|
|
69
|
+
e.stacked ? (s(), L(i(j), {
|
|
69
70
|
key: 1,
|
|
70
|
-
data: e.data,
|
|
71
|
-
x: (
|
|
72
|
-
y:
|
|
73
|
-
color:
|
|
71
|
+
data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
|
|
72
|
+
x: (u, d) => d,
|
|
73
|
+
y: m.value,
|
|
74
|
+
color: p,
|
|
74
75
|
"rounded-corners": e.radius ?? 0,
|
|
75
76
|
"group-padding": e.groupPadding ?? 0,
|
|
76
77
|
"bar-padding": e.barPadding ?? 0.2,
|
|
77
|
-
orientation: e.orientation ?? i(
|
|
78
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (
|
|
78
|
+
orientation: e.orientation ?? i(o).Vertical
|
|
79
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (s(), L(i(N), {
|
|
79
80
|
key: 0,
|
|
80
|
-
data: e.data,
|
|
81
|
-
x: (
|
|
82
|
-
y:
|
|
83
|
-
color:
|
|
81
|
+
data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
|
|
82
|
+
x: (u, d) => d,
|
|
83
|
+
y: m.value,
|
|
84
|
+
color: p,
|
|
84
85
|
"rounded-corners": e.radius ?? 0,
|
|
85
86
|
"group-padding": e.groupPadding ?? 0,
|
|
86
87
|
"bar-padding": e.barPadding ?? 0.2,
|
|
87
|
-
orientation: e.orientation ?? i(
|
|
88
|
+
orientation: e.orientation ?? i(o).Vertical
|
|
88
89
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
89
90
|
l(i(h), {
|
|
90
91
|
type: "x",
|
|
@@ -100,20 +101,20 @@ const z = /* @__PURE__ */ b({
|
|
|
100
101
|
l(i(h), {
|
|
101
102
|
type: "y",
|
|
102
103
|
label: e.yLabel,
|
|
103
|
-
"grid-line": e.orientation !== i(
|
|
104
|
+
"grid-line": e.orientation !== i(o).Horizontal && e.yGridLine,
|
|
104
105
|
"domain-line": !!e.yDomainLine,
|
|
105
|
-
"tick-format":
|
|
106
|
+
"tick-format": e.yFormatter,
|
|
106
107
|
"num-ticks": e.yNumTicks,
|
|
107
108
|
"tick-line": e.yTickLine
|
|
108
|
-
}, null, 8, ["label", "grid-line", "domain-line", "num-ticks", "tick-line"])
|
|
109
|
+
}, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"])
|
|
109
110
|
]),
|
|
110
111
|
_: 1
|
|
111
112
|
}, 8, ["height"]),
|
|
112
|
-
e.hideLegend ?
|
|
113
|
+
e.hideLegend ? P("", !0) : (s(), f("div", {
|
|
113
114
|
key: 0,
|
|
114
|
-
class:
|
|
115
|
+
class: b(["flex items center justify-end", { "pb-4": g.value }])
|
|
115
116
|
}, [
|
|
116
|
-
l(i(
|
|
117
|
+
l(i(w), {
|
|
117
118
|
items: Object.values(e.categories)
|
|
118
119
|
}, null, 8, ["items"])
|
|
119
120
|
], 2))
|
|
@@ -121,5 +122,5 @@ const z = /* @__PURE__ */ b({
|
|
|
121
122
|
}
|
|
122
123
|
});
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
+
S as default
|
|
125
126
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarChartProps } from './types';
|
|
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<{
|
|
2
|
+
declare const _default: <T extends {}>(__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
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
4
4
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
5
5
|
attrs: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulletLegendItemInterface } from '
|
|
1
|
+
import { BulletLegendItemInterface } 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
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
data: T;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-chrts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"main": "./dist/index.umd.cjs",
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"import": "./dist/index.js",
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@tailwindcss/vite": "^4.0.15",
|
|
26
27
|
"@tanstack/vue-table": "^8.21.2",
|
|
27
|
-
"@types/culori": "^2.1.1",
|
|
28
28
|
"@types/node": "^22.13.11",
|
|
29
29
|
"@unovis/ts": "^1.5.1",
|
|
30
30
|
"@unovis/vue": "^1.5.1",
|