vue-chrts 0.2.0-test.4 → 0.2.0-test.5

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.
@@ -1,6 +1,6 @@
1
- import a from "./AreaChart2.js";
2
- import o from "../../_virtual/_plugin-vue_export-helper.js";
3
- const f = /* @__PURE__ */ o(a, [["__scopeId", "data-v-b9ab9df3"]]);
1
+ import o from "./AreaChart2.js";
2
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
3
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-f08e19f3"]]);
4
4
  export {
5
5
  f as default
6
6
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as x, useSlots as P, useTemplateRef as M, ref as U, computed as c, createElementBlock as d, openBlock as a, normalizeClass as h, createVNode as u, createCommentVNode as l, createElementVNode as j, unref as i, withCtx as R, createBlock as m, Fragment as L, renderList as W, mergeProps as X, renderSlot as C } from "vue";
2
- import { Position as b, CurveType as B } from "@unovis/ts";
3
- import { createMarkers as S, getFirstPropertyValue as Y } from "../../utils.js";
4
- import w from "../Tooltip.js";
5
- import { VisXYContainer as z, VisTooltip as I, VisArea as H, VisLine as K, VisAxis as V, VisCrosshair as q, VisBulletLegend as J } from "@unovis/vue";
1
+ import { defineComponent as P, useSlots as W, useTemplateRef as M, ref as U, computed as u, createElementBlock as c, openBlock as a, normalizeClass as T, createVNode as d, createCommentVNode as l, createElementVNode as j, unref as i, withCtx as w, createBlock as m, Fragment as L, renderList as x, mergeProps as R, renderSlot as C } from "vue";
2
+ import { Position as b, CurveType as A } from "@unovis/ts";
3
+ import { createMarkers as X, getFirstPropertyValue as S } from "../../utils.js";
4
+ import Y from "../Tooltip.js";
5
+ import { VisXYContainer as z, VisTooltip as I, VisArea as H, VisLine as K, VisAxis as B, VisCrosshair as q, VisBulletLegend as J } from "@unovis/vue";
6
6
  import { LegendPosition as Q } from "../../types.js";
7
7
  const Z = {
8
8
  ref: "slotWrapper",
9
9
  class: "hidden"
10
- }, y = 24, A = 4, _ = 0.5, F = "#3b82f6", ne = /* @__PURE__ */ x({
10
+ }, y = 24, D = 4, _ = 0.5, V = "#3b82f6", ne = /* @__PURE__ */ P({
11
11
  __name: "AreaChart",
12
12
  props: {
13
13
  data: {},
@@ -20,10 +20,12 @@ const Z = {
20
20
  xFormatter: {},
21
21
  yFormatter: {},
22
22
  curveType: {},
23
- xNumTicks: { default: (n) => n.data.length > y ? y / A : n.data.length - 1 },
23
+ lineWidth: { default: 2 },
24
+ lineDashArray: {},
25
+ xNumTicks: { default: (n) => n.data.length > y ? y / D : n.data.length - 1 },
24
26
  xExplicitTicks: {},
25
27
  minMaxTicksOnly: { type: Boolean },
26
- yNumTicks: { default: (n) => n.data.length > y ? y / A : n.data.length - 1 },
28
+ yNumTicks: { default: (n) => n.data.length > y ? y / D : n.data.length - 1 },
27
29
  hideLegend: { type: Boolean },
28
30
  hideTooltip: { type: Boolean },
29
31
  legendPosition: {},
@@ -37,9 +39,9 @@ const Z = {
37
39
  hideYAxis: { type: Boolean }
38
40
  },
39
41
  setup(n) {
40
- const r = n, D = P(), v = M("slotWrapper"), s = U(), f = c(
42
+ const r = n, F = W(), h = M("slotWrapper"), s = U(), f = u(
41
43
  () => Object.values(r.categories).map((e) => e.color)
42
- ), T = c(() => r.legendPosition === Q.Top), $ = c(() => {
44
+ ), v = u(() => r.legendPosition === Q.Top), $ = u(() => {
43
45
  const e = (t, o) => `
44
46
  <linearGradient id="gradient${t}-${o}" gradientTransform="rotate(90)">
45
47
  <stop offset="0%" stop-color="${o}" stop-opacity="1" />
@@ -52,54 +54,56 @@ const Z = {
52
54
  </linearGradient>
53
55
  `;
54
56
  return f.value.map(
55
- (t, o) => t != null && t.includes("#") ? e(o, t) : p(o, t ?? F)
57
+ (t, o) => t != null && t.includes("#") ? e(o, t) : p(o, t ?? V)
56
58
  ).join("");
57
- }), G = c(() => r.markerConfig ? S(r.markerConfig) : "");
59
+ }), G = u(() => r.markerConfig ? X(r.markerConfig) : "");
58
60
  function O(e) {
59
61
  var p;
60
62
  return {
61
63
  y: (t) => Number(t[e]),
62
- color: ((p = r.categories[e]) == null ? void 0 : p.color) ?? F
64
+ color: ((p = r.categories[e]) == null ? void 0 : p.color) ?? V
63
65
  };
64
66
  }
65
67
  function N(e) {
66
- return typeof window > "u" ? "" : v.value ? v.value.innerHTML : "";
68
+ return typeof window > "u" ? "" : h.value ? h.value.innerHTML : "";
67
69
  }
68
70
  function E(e) {
69
71
  return s.value = e, N();
70
72
  }
71
- return (e, p) => (a(), d("div", {
72
- class: h(["flex flex-col space-y-4", { "flex-col-reverse": T.value, markers: !!r.markerConfig }])
73
+ return (e, p) => (a(), c("div", {
74
+ class: T(["flex flex-col space-y-4", { "flex-col-reverse": v.value, markers: !!r.markerConfig }])
73
75
  }, [
74
- u(i(z), {
76
+ d(i(z), {
75
77
  data: e.data,
76
78
  height: e.height,
77
79
  padding: e.padding,
78
80
  "svg-defs": $.value + G.value
79
81
  }, {
80
- default: R(() => [
82
+ default: w(() => [
81
83
  e.hideTooltip ? l("", !0) : (a(), m(i(I), {
82
84
  key: 0,
83
85
  "horizontal-placement": i(b).Right,
84
86
  "vertical-placement": i(b).Top
85
87
  }, null, 8, ["horizontal-placement", "vertical-placement"])),
86
- (a(!0), d(L, null, W(Object.keys(r.categories), (t, o) => (a(), d(L, { key: t }, [
87
- u(i(H), X({
88
+ (a(!0), c(L, null, x(Object.keys(r.categories), (t, o) => (a(), c(L, { key: t }, [
89
+ d(i(H), R({
88
90
  x: (g, k) => k,
89
91
  ref_for: !0
90
92
  }, O(t), {
91
93
  color: `url(#gradient${o}-${f.value[o]})`,
92
94
  opacity: _,
93
- "curve-type": e.curveType ?? i(B).MonotoneX
95
+ "curve-type": e.curveType ?? i(A).MonotoneX
94
96
  }), null, 16, ["x", "color", "curve-type"]),
95
- u(i(K), {
97
+ d(i(K), {
96
98
  x: (g, k) => k,
97
99
  y: (g) => g[t],
98
100
  color: f.value[o],
99
- "curve-type": e.curveType ?? i(B).MonotoneX
100
- }, null, 8, ["x", "y", "color", "curve-type"])
101
+ "curve-type": e.curveType ?? i(A).MonotoneX,
102
+ "line-width": e.lineWidth,
103
+ lineDashArray: e.lineDashArray
104
+ }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
101
105
  ], 64))), 128)),
102
- e.hideXAxis ? l("", !0) : (a(), m(i(V), {
106
+ e.hideXAxis ? l("", !0) : (a(), m(i(B), {
103
107
  key: 1,
104
108
  type: "x",
105
109
  label: e.xLabel,
@@ -112,7 +116,7 @@ const Z = {
112
116
  "tick-line": e.xTickLine,
113
117
  "min-max-ticks-only": e.minMaxTicksOnly
114
118
  }, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
115
- e.hideYAxis ? l("", !0) : (a(), m(i(V), {
119
+ e.hideYAxis ? l("", !0) : (a(), m(i(B), {
116
120
  key: 2,
117
121
  type: "y",
118
122
  label: e.yLabel,
@@ -130,23 +134,23 @@ const Z = {
130
134
  ]),
131
135
  _: 1
132
136
  }, 8, ["data", "height", "padding", "svg-defs"]),
133
- e.hideLegend ? l("", !0) : (a(), d("div", {
137
+ e.hideLegend ? l("", !0) : (a(), c("div", {
134
138
  key: 0,
135
- class: h(["flex items-center justify-end", { "pb-4": T.value }])
139
+ class: T(["flex items-center justify-end", { "pb-4": v.value }])
136
140
  }, [
137
- u(i(J), {
141
+ d(i(J), {
138
142
  items: Object.values(e.categories)
139
143
  }, null, 8, ["items"])
140
144
  ], 2)),
141
145
  j("div", Z, [
142
- i(D).tooltip ? C(e.$slots, "tooltip", {
146
+ i(F).tooltip ? C(e.$slots, "tooltip", {
143
147
  key: 0,
144
148
  values: s.value
145
149
  }, void 0, !0) : s.value ? C(e.$slots, "fallback", { key: 1 }, () => [
146
- u(w, {
150
+ d(Y, {
147
151
  data: s.value,
148
152
  categories: e.categories,
149
- toolTipTitle: i(Y)(s.value) ?? "",
153
+ toolTipTitle: i(S)(s.value) ?? "",
150
154
  yFormatter: r.yFormatter
151
155
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
152
156
  ], !0) : l("", !0)
@@ -57,6 +57,14 @@ export interface AreaChartProps<T> {
57
57
  * See `CurveType` for available options.
58
58
  */
59
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[];
60
68
  /**
61
69
  * The desired number of ticks on the x-axis.
62
70
  */
@@ -1,13 +1,13 @@
1
- import { defineComponent as D, computed as f, useSlots as N, useTemplateRef as O, ref as P, createElementBlock as m, openBlock as n, normalizeClass as k, createVNode as r, createCommentVNode as l, createElementVNode as j, unref as i, withCtx as A, createBlock as s, Fragment as M, renderList as E, renderSlot as g } from "vue";
2
- import { Position as v, CurveType as G } from "@unovis/ts";
3
- import { createMarkers as X, getFirstPropertyValue as $ } from "../../utils.js";
4
- import w from "../Tooltip.js";
5
- import { VisXYContainer as z, VisTooltip as R, VisLine as W, VisAxis as h, VisCrosshair as Y, VisBulletLegend as S } from "@unovis/vue";
1
+ import { defineComponent as F, computed as f, useSlots as x, useTemplateRef as N, ref as O, createElementBlock as d, openBlock as n, normalizeClass as k, createVNode as r, createCommentVNode as l, createElementVNode as P, unref as i, withCtx as j, createBlock as s, Fragment as w, renderList as M, renderSlot as g } from "vue";
2
+ import { Position as h, CurveType as W } from "@unovis/ts";
3
+ import { createMarkers as E, getFirstPropertyValue as G } from "../../utils.js";
4
+ import X from "../Tooltip.js";
5
+ import { VisXYContainer as $, VisTooltip as z, VisLine as R, VisAxis as v, VisCrosshair as Y, VisBulletLegend as S } from "@unovis/vue";
6
6
  import { LegendPosition as H } from "../../types.js";
7
7
  const U = {
8
8
  ref: "slotWrapper",
9
9
  class: "hidden"
10
- }, _ = /* @__PURE__ */ D({
10
+ }, _ = /* @__PURE__ */ F({
11
11
  __name: "LineChart",
12
12
  props: {
13
13
  data: {},
@@ -25,6 +25,8 @@ const U = {
25
25
  xFormatter: {},
26
26
  yFormatter: {},
27
27
  curveType: {},
28
+ lineWidth: { default: 2 },
29
+ lineDashArray: {},
28
30
  xNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
29
31
  xExplicitTicks: {},
30
32
  minMaxTicksOnly: { type: Boolean },
@@ -42,9 +44,9 @@ const U = {
42
44
  hideYAxis: { type: Boolean }
43
45
  },
44
46
  setup(o) {
45
- const t = o, T = f(() => t.markerConfig ? X(t.markerConfig) : ""), L = N(), d = O("slotWrapper"), a = P();
47
+ const t = o, T = f(() => t.markerConfig ? E(t.markerConfig) : ""), L = x(), m = N("slotWrapper"), a = O();
46
48
  function b(e) {
47
- return typeof window > "u" ? "" : d.value ? d.value.innerHTML : "";
49
+ return typeof window > "u" ? "" : m.value ? m.value.innerHTML : "";
48
50
  }
49
51
  function B(e) {
50
52
  return a.value = e, b();
@@ -53,32 +55,34 @@ const U = {
53
55
  () => t.legendPosition === H.Top
54
56
  ), C = Object.values(t.categories).map(
55
57
  (e, c) => `var(--vis-color${c})`
56
- ), V = (e) => Object.values(t.categories)[e].color ?? C[e];
57
- return (e, c) => (n(), m("div", {
58
+ ), D = (e) => Object.values(t.categories)[e].color ?? C[e];
59
+ return (e, c) => (n(), d("div", {
58
60
  class: k(["flex flex-col space-y-4", {
59
61
  "flex-col-reverse": u.value,
60
62
  markers: !!t.markerConfig
61
63
  }])
62
64
  }, [
63
- r(i(z), {
65
+ r(i($), {
64
66
  data: e.data,
65
67
  padding: e.padding,
66
68
  height: e.height,
67
69
  svgDefs: T.value
68
70
  }, {
69
- default: A(() => [
70
- r(i(R), {
71
- "horizontal-placement": i(v).Right,
72
- "vertical-placement": i(v).Top
71
+ default: j(() => [
72
+ r(i(z), {
73
+ "horizontal-placement": i(h).Right,
74
+ "vertical-placement": i(h).Top
73
75
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
74
- (n(!0), m(M, null, E(Object.keys(t.categories), (x, p) => (n(), s(i(W), {
76
+ (n(!0), d(w, null, M(Object.keys(t.categories), (V, p) => (n(), s(i(R), {
75
77
  key: p,
76
- x: (y, F) => F,
77
- y: (y) => y[x],
78
- color: V(p),
79
- "curve-type": e.curveType ?? i(G).MonotoneX
80
- }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
81
- e.hideXAxis ? l("", !0) : (n(), s(i(h), {
78
+ x: (y, A) => A,
79
+ y: (y) => y[V],
80
+ color: D(p),
81
+ "curve-type": e.curveType ?? i(W).MonotoneX,
82
+ "line-width": e.lineWidth,
83
+ lineDashArray: e.lineDashArray
84
+ }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
85
+ e.hideXAxis ? l("", !0) : (n(), s(i(v), {
82
86
  key: 0,
83
87
  type: "x",
84
88
  "tick-format": e.xFormatter,
@@ -91,7 +95,7 @@ const U = {
91
95
  "tick-values": e.xExplicitTicks,
92
96
  "min-max-ticks-only": e.minMaxTicksOnly
93
97
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
94
- e.hideYAxis ? l("", !0) : (n(), s(i(h), {
98
+ e.hideYAxis ? l("", !0) : (n(), s(i(v), {
95
99
  key: 1,
96
100
  type: "y",
97
101
  "tick-format": e.yFormatter,
@@ -109,7 +113,7 @@ const U = {
109
113
  ]),
110
114
  _: 1
111
115
  }, 8, ["data", "padding", "height", "svgDefs"]),
112
- e.hideLegend ? l("", !0) : (n(), m("div", {
116
+ e.hideLegend ? l("", !0) : (n(), d("div", {
113
117
  key: 0,
114
118
  class: k(["flex items center justify-end", { "pb-4": u.value }])
115
119
  }, [
@@ -117,15 +121,15 @@ const U = {
117
121
  items: Object.values(e.categories)
118
122
  }, null, 8, ["items"])
119
123
  ], 2)),
120
- j("div", U, [
124
+ P("div", U, [
121
125
  i(L).tooltip ? g(e.$slots, "tooltip", {
122
126
  key: 0,
123
127
  values: a.value
124
128
  }) : a.value ? g(e.$slots, "fallback", { key: 1 }, () => [
125
- r(w, {
129
+ r(X, {
126
130
  data: a.value,
127
131
  categories: e.categories,
128
- toolTipTitle: i($)(a.value) ?? "",
132
+ toolTipTitle: i(G)(a.value) ?? "",
129
133
  yFormatter: t.yFormatter
130
134
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
131
135
  ]) : l("", !0)
@@ -56,6 +56,14 @@ export interface LineChartProps<T> {
56
56
  * See `CurveType` for available options.
57
57
  */
58
58
  curveType?: CurveType;
59
+ /**
60
+ * The width of the line in pixels. Default is 2px.
61
+ */
62
+ lineWidth?: number;
63
+ /**
64
+ * Line dash array, see SVG's stroke-dasharray. Default: `undefined`
65
+ */
66
+ lineDashArray?: number[];
59
67
  /**
60
68
  * The desired number of ticks on the x-axis.
61
69
  */
package/dist/index.js.css CHANGED
@@ -1 +1 @@
1
- .markers[data-v-b9ab9df3] *[stroke="#156F36"]{marker:url(#circle-marker-desktop)}.markers[data-v-b9ab9df3] *[stroke="#4ade80"]{marker:url(#circle-marker-mobile)}
1
+ .markers[data-v-f08e19f3] *[stroke="#156F36"]{marker:url(#circle-marker-desktop)}.markers[data-v-f08e19f3] *[stroke="#4ade80"]{marker:url(#circle-marker-mobile)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.2.0-test.4",
3
+ "version": "0.2.0-test.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"