vue-chrts 0.1.1 → 0.1.3

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
@@ -1,4 +1,4 @@
1
- # Vue-Chrts
1
+ # Vue-chrts
2
2
 
3
3
  A Vue 3 charts package inspired by [Tremor](https://tremor.so/), built on top of [Unovis](https://unovis.dev). Vue-Chrts provides beautiful, responsive charts for your Vue applications with minimal setup.
4
4
 
@@ -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 appearance
12
+ - 🎨 Customizable
13
13
  - 📱 Responsive design
14
14
  - 💡 Simple, intuitive API
15
15
  - 🚀 Built with Vue 3 and TypeScript
16
16
 
17
- ## Installation
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 E, ref as T, computed as f, createApp as N, onUnmounted as P, createElementBlock as u, openBlock as l, normalizeClass as L, createVNode as s, createCommentVNode as g, unref as o, withCtx as M, createBlock as h, Fragment as b, renderList as U, mergeProps as j } from "vue";
2
- import { Position as C, CurveType as x } from "@unovis/ts";
3
- import { VisXYContainer as I, VisTooltip as S, VisArea as w, VisLine as z, VisAxis as B, VisCrosshair as R, VisBulletLegend as X } from "@unovis/vue";
1
+ import { defineComponent as G, ref as T, computed as f, createApp as N, onUnmounted as P, createElementBlock as u, openBlock as l, normalizeClass as L, createVNode as s, createCommentVNode as g, unref as o, withCtx as M, createBlock as h, Fragment as b, renderList as U, mergeProps as j } from "vue";
2
+ import { Position as C, CurveType as B } from "@unovis/ts";
3
+ import { VisXYContainer as I, VisTooltip as S, VisArea as w, VisLine as z, VisAxis as x, VisCrosshair as R, VisBulletLegend as X } from "@unovis/vue";
4
4
  import Y from "../Tooltip.js";
5
5
  import { LegendPosition as H } from "../../types.js";
6
- const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
6
+ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ G({
7
7
  __name: "AreaChart",
8
8
  props: {
9
9
  data: {},
@@ -20,15 +20,16 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
20
20
  yNumTicks: { default: (i) => i.data.length > p ? p / V : i.data.length - 1 },
21
21
  hideLegend: { type: Boolean },
22
22
  hideTooltip: { type: Boolean },
23
- xGridLine: { type: Boolean },
23
+ legendPosition: {},
24
24
  xDomainLine: { type: Boolean },
25
- yGridLine: { type: Boolean },
26
25
  yDomainLine: { type: Boolean },
27
26
  xTickLine: { type: Boolean },
28
- legendPosition: {}
27
+ yTickLine: { type: Boolean },
28
+ xGridLine: { type: Boolean },
29
+ yGridLine: { type: Boolean }
29
30
  },
30
31
  setup(i) {
31
- const r = i, m = Object.values(r.categories).map((e) => e.color), d = T(null), v = T(null), D = f(() => (e, t) => {
32
+ const r = i, m = Object.values(r.categories).map((e) => e.color), d = T(null), k = T(null), D = f(() => (e, t) => {
32
33
  if (typeof window > "u" || typeof document > "u")
33
34
  return "";
34
35
  try {
@@ -45,7 +46,7 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
45
46
  }
46
47
  });
47
48
  P(() => {
48
- d.value && (d.value.unmount(), d.value = null), v.value && (v.value = null);
49
+ d.value && (d.value.unmount(), d.value = null), k.value && (k.value = null);
49
50
  });
50
51
  function F(e) {
51
52
  var t;
@@ -62,7 +63,7 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
62
63
  </linearGradient>
63
64
  `;
64
65
  }
65
- function G(e, t) {
66
+ function $(e, t) {
66
67
  return `
67
68
  <linearGradient id="gradient${e}-${t}" gradientTransform="rotate(90)">
68
69
  <stop offset="0%" stop-color="${t}" stop-opacity="1" />
@@ -70,20 +71,20 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
70
71
  </linearGradient>
71
72
  `;
72
73
  }
73
- const $ = f(
74
+ const E = f(
74
75
  () => m.map(
75
- (e, t) => e != null && e.includes("#") ? G(t, e) : O(t, e ?? A)
76
+ (e, t) => e != null && e.includes("#") ? $(t, e) : O(t, e ?? A)
76
77
  ).join("")
77
- ), k = f(
78
+ ), v = f(
78
79
  () => r.legendPosition === H.Top
79
80
  );
80
81
  return (e, t) => (l(), u("div", {
81
- class: L(["flex flex-col space-y-4", { "flex-col-reverse": k.value }])
82
+ class: L(["flex flex-col space-y-4", { "flex-col-reverse": v.value }])
82
83
  }, [
83
84
  s(o(I), {
84
85
  data: e.data,
85
86
  height: e.height,
86
- "svg-defs": $.value
87
+ "svg-defs": E.value
87
88
  }, {
88
89
  default: M(() => [
89
90
  e.hideTooltip ? g("", !0) : (l(), h(o(S), {
@@ -98,16 +99,16 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
98
99
  }, F(n), {
99
100
  color: `url(#gradient${a}-${o(m)[a]})`,
100
101
  opacity: q,
101
- "curve-type": e.curveType ?? o(x).MonotoneX
102
+ "curve-type": e.curveType ?? o(B).MonotoneX
102
103
  }), null, 16, ["x", "color", "curve-type"]),
103
104
  s(o(z), {
104
105
  x: (c, y) => y,
105
106
  y: (c) => c[n],
106
107
  color: o(m)[a],
107
- "curve-type": e.curveType ?? o(x).MonotoneX
108
+ "curve-type": e.curveType ?? o(B).MonotoneX
108
109
  }, null, 8, ["x", "y", "color", "curve-type"])
109
110
  ], 64))), 128)),
110
- s(o(B), {
111
+ s(o(x), {
111
112
  type: "x",
112
113
  "tick-format": e.xFormatter,
113
114
  label: e.xLabel,
@@ -119,14 +120,14 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
119
120
  "tick-values": e.xExplicitTicks,
120
121
  "min-max-ticks-only": e.minMaxTicksOnly
121
122
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "num-ticks", "tick-line", "tick-values", "min-max-ticks-only"]),
122
- s(o(B), {
123
+ s(o(x), {
123
124
  type: "y",
124
125
  "num-ticks": e.yNumTicks,
125
126
  "tick-format": e.yFormatter,
126
127
  label: e.yLabel,
127
128
  "grid-line": e.yGridLine,
128
129
  "domain-line": e.yDomainLine,
129
- "tick-line": !!e.yGridLine
130
+ "tick-line": e.yTickLine
130
131
  }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"]),
131
132
  e.hideTooltip ? g("", !0) : (l(), h(o(R), {
132
133
  key: 1,
@@ -138,7 +139,7 @@ const p = 24, V = 4, q = 0.5, A = "#3b82f6", _ = /* @__PURE__ */ E({
138
139
  }, 8, ["data", "height", "svg-defs"]),
139
140
  e.hideLegend ? g("", !0) : (l(), u("div", {
140
141
  key: 0,
141
- class: L(["flex items-center justify-end", { "pb-4": k.value }])
142
+ class: L(["flex items-center justify-end", { "pb-4": v.value }])
142
143
  }, [
143
144
  s(o(X), {
144
145
  items: Object.values(e.categories)
@@ -68,17 +68,14 @@ export interface AreaChartProps<T> {
68
68
  */
69
69
  hideTooltip?: boolean;
70
70
  /**
71
- * If `true`, displays grid lines along the x-axis.
71
+ * Optional position for the legend, if applicable.
72
+ * See `LegendPosition` for available options.
72
73
  */
73
- xGridLine?: boolean;
74
+ legendPosition?: LegendPosition;
74
75
  /**
75
76
  * If `true`, displays a domain line (axis line) along the x-axis.
76
77
  */
77
78
  xDomainLine?: boolean;
78
- /**
79
- * If `true`, displays grid lines along the y-axis.
80
- */
81
- yGridLine?: boolean;
82
79
  /**
83
80
  * If `true`, displays a domain line (axis line) along the y-axis.
84
81
  */
@@ -88,8 +85,15 @@ export interface AreaChartProps<T> {
88
85
  */
89
86
  xTickLine?: boolean;
90
87
  /**
91
- * Optional position for the legend, if applicable.
92
- * See `LegendPosition` for available options.
88
+ * If `true`, displays tick lines on the y-axis.
93
89
  */
94
- legendPosition?: LegendPosition;
90
+ yTickLine?: boolean;
91
+ /**
92
+ * If `true`, displays grid lines along the x-axis.
93
+ */
94
+ xGridLine?: boolean;
95
+ /**
96
+ * If `true`, displays grid lines along the y-axis.
97
+ */
98
+ yGridLine?: boolean;
95
99
  }
@@ -103,10 +103,10 @@ const S = /* @__PURE__ */ v({
103
103
  label: e.yLabel,
104
104
  "grid-line": e.orientation !== i(o).Horizontal && e.yGridLine,
105
105
  "domain-line": !!e.yDomainLine,
106
- "tick-format": () => "",
106
+ "tick-format": e.yFormatter,
107
107
  "num-ticks": e.yNumTicks,
108
108
  "tick-line": e.yTickLine
109
- }, 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"])
110
110
  ]),
111
111
  _: 1
112
112
  }, 8, ["height"]),
@@ -66,11 +66,11 @@ export interface BarChartProps<T> {
66
66
  */
67
67
  groupPadding?: number;
68
68
  /**
69
- * The padding between bars within the same group in pixels.
69
+ * Fractional padding between the bars in the range of [0,1). Default: 0
70
70
  */
71
71
  barPadding?: number;
72
72
  /**
73
- * The corner radius of the bars in pixels.
73
+ * Rounded corners for top bars. Boolean or number (to set the radius in pixels). Default: 2
74
74
  */
75
75
  radius?: number;
76
76
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"