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

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.
Files changed (34) hide show
  1. package/dist/components/AreaChart/AreaChart.vue.d.ts +4 -2
  2. package/dist/components/AreaChart/types.d.ts +20 -2
  3. package/dist/components/AreaStackedChart/types.d.ts +18 -0
  4. package/dist/components/BarChart/BarChart.vue.d.ts +5 -3
  5. package/dist/components/BarChart/stackedGroupedUtils.d.ts +19 -0
  6. package/dist/components/BarChart/types.d.ts +41 -22
  7. package/dist/components/DonutChart/DonutChart.vue.d.ts +4 -2
  8. package/dist/components/DonutChart/types.d.ts +7 -3
  9. package/dist/components/LineChart/LineChart.vue.d.ts +4 -2
  10. package/dist/components/LineChart/types.d.ts +24 -5
  11. package/dist/components/Tooltip.vue.d.ts +3 -2
  12. package/dist/index.d.ts +2 -3
  13. package/dist/index.js.js +753 -0
  14. package/dist/types.d.ts +6 -43
  15. package/dist/utils.d.ts +4 -1
  16. package/package.json +14 -15
  17. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  18. package/dist/components/AreaChart/AreaChart.js +0 -6
  19. package/dist/components/AreaChart/AreaChart2.js +0 -163
  20. package/dist/components/AreaStackedChart/AreaStackedChart.js +0 -80
  21. package/dist/components/AreaStackedChart/AreaStackedChart2.js +0 -4
  22. package/dist/components/BarChart/BarChart.js +0 -192
  23. package/dist/components/BarChart/BarChart2.js +0 -4
  24. package/dist/components/DonutChart/DonutChart.js +0 -77
  25. package/dist/components/DonutChart/DonutChart2.js +0 -4
  26. package/dist/components/DonutChart/types.js +0 -4
  27. package/dist/components/LineChart/LineChart.js +0 -142
  28. package/dist/components/LineChart/LineChart2.js +0 -4
  29. package/dist/components/Tooltip.js +0 -48
  30. package/dist/components/Tooltip2.js +0 -4
  31. package/dist/index.js +0 -16
  32. package/dist/index.js.css +0 -1
  33. package/dist/types.js +0 -6
  34. package/dist/utils.js +0 -34
@@ -1,142 +0,0 @@
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
- import { LegendPosition as H } from "../../types.js";
7
- const U = {
8
- ref: "slotWrapper",
9
- class: "hidden"
10
- }, _ = /* @__PURE__ */ F({
11
- __name: "LineChart",
12
- props: {
13
- data: {},
14
- height: {},
15
- xLabel: {},
16
- yLabel: {},
17
- padding: { default: () => ({
18
- top: 5,
19
- right: 5,
20
- bottom: 5,
21
- left: 5
22
- }) },
23
- categories: {},
24
- markerConfig: {},
25
- xFormatter: {},
26
- yFormatter: {},
27
- curveType: {},
28
- lineWidth: { default: 2 },
29
- lineDashArray: {},
30
- xNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
31
- xExplicitTicks: {},
32
- minMaxTicksOnly: { type: Boolean },
33
- yNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
34
- hideTooltip: { type: Boolean },
35
- hideLegend: { type: Boolean },
36
- legendPosition: {},
37
- xGridLine: { type: Boolean },
38
- xDomainLine: { type: Boolean },
39
- yGridLine: { type: Boolean },
40
- yDomainLine: { type: Boolean },
41
- xTickLine: { type: Boolean },
42
- yTickLine: { type: Boolean },
43
- hideXAxis: { type: Boolean },
44
- hideYAxis: { type: Boolean }
45
- },
46
- setup(o) {
47
- const t = o, T = f(() => t.markerConfig ? E(t.markerConfig) : ""), L = x(), m = N("slotWrapper"), a = O();
48
- function b(e) {
49
- return typeof window > "u" ? "" : m.value ? m.value.innerHTML : "";
50
- }
51
- function B(e) {
52
- return a.value = e, b();
53
- }
54
- const u = f(
55
- () => t.legendPosition === H.Top
56
- ), C = Object.values(t.categories).map(
57
- (e, c) => `var(--vis-color${c})`
58
- ), D = (e) => Object.values(t.categories)[e].color ?? C[e];
59
- return (e, c) => (n(), d("div", {
60
- class: k(["flex flex-col space-y-4", {
61
- "flex-col-reverse": u.value,
62
- markers: !!t.markerConfig
63
- }])
64
- }, [
65
- r(i($), {
66
- data: e.data,
67
- padding: e.padding,
68
- height: e.height,
69
- svgDefs: T.value
70
- }, {
71
- default: j(() => [
72
- r(i(z), {
73
- "horizontal-placement": i(h).Right,
74
- "vertical-placement": i(h).Top
75
- }, null, 8, ["horizontal-placement", "vertical-placement"]),
76
- (n(!0), d(w, null, M(Object.keys(t.categories), (V, p) => (n(), s(i(R), {
77
- key: p,
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), {
86
- key: 0,
87
- type: "x",
88
- "tick-format": e.xFormatter,
89
- label: e.xLabel,
90
- "label-margin": 8,
91
- "domain-line": e.xDomainLine,
92
- "grid-line": e.xGridLine,
93
- "tick-line": e.xTickLine,
94
- "num-ticks": e.xNumTicks,
95
- "tick-values": e.xExplicitTicks,
96
- "min-max-ticks-only": e.minMaxTicksOnly
97
- }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
98
- e.hideYAxis ? l("", !0) : (n(), s(i(v), {
99
- key: 1,
100
- type: "y",
101
- "tick-format": e.yFormatter,
102
- label: e.yLabel,
103
- "num-ticks": e.yNumTicks,
104
- "domain-line": e.yDomainLine,
105
- "grid-line": e.yGridLine,
106
- "tick-line": e.yTickLine
107
- }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
108
- e.hideTooltip ? l("", !0) : (n(), s(i(Y), {
109
- key: 2,
110
- color: "#666",
111
- template: B
112
- }))
113
- ]),
114
- _: 1
115
- }, 8, ["data", "padding", "height", "svgDefs"]),
116
- e.hideLegend ? l("", !0) : (n(), d("div", {
117
- key: 0,
118
- class: k(["flex items center justify-end", { "pb-4": u.value }])
119
- }, [
120
- r(i(S), {
121
- items: Object.values(e.categories)
122
- }, null, 8, ["items"])
123
- ], 2)),
124
- P("div", U, [
125
- i(L).tooltip ? g(e.$slots, "tooltip", {
126
- key: 0,
127
- values: a.value
128
- }) : a.value ? g(e.$slots, "fallback", { key: 1 }, () => [
129
- r(X, {
130
- data: a.value,
131
- categories: e.categories,
132
- toolTipTitle: i(G)(a.value) ?? "",
133
- yFormatter: t.yFormatter
134
- }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
135
- ]) : l("", !0)
136
- ], 512)
137
- ], 2));
138
- }
139
- });
140
- export {
141
- _ as default
142
- };
@@ -1,4 +0,0 @@
1
- import f from "./LineChart.js";
2
- export {
3
- f as default
4
- };
@@ -1,48 +0,0 @@
1
- import { defineComponent as b, computed as v, createElementBlock as r, openBlock as l, createElementVNode as o, toDisplayString as i, Fragment as h, renderList as y, normalizeStyle as a } from "vue";
2
- const f = {
3
- class: "capitalize border-b mb-1 pb-1",
4
- style: {
5
- color: "var(--tooltip-value-color)",
6
- borderColor: "rgba(255, 255, 255, 0.05)"
7
- }
8
- }, T = /* @__PURE__ */ b({
9
- __name: "Tooltip",
10
- props: {
11
- data: {},
12
- categories: {},
13
- toolTipTitle: {},
14
- yFormatter: {}
15
- },
16
- setup(p) {
17
- const n = p, d = ["_index", "_stacked", "_ending"], m = v(() => Object.entries(n.data ?? []).filter(
18
- ([e, g]) => !d.includes(e) && Object.keys(n.categories).includes(e)
19
- ));
20
- return (e, g) => (l(), r("div", null, [
21
- o("div", f, i(e.toolTipTitle), 1),
22
- (l(!0), r(h, null, y(m.value, ([t, s], u) => {
23
- var c;
24
- return l(), r("div", {
25
- key: t,
26
- style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
27
- }, [
28
- o("span", {
29
- style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
- backgroundColor: (c = e.categories[t]) != null && c.color ? e.categories[t].color : `var(--vis-color${u})`
31
- }])
32
- }, null, 4),
33
- o("div", null, [
34
- o("span", {
35
- style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
- }, i(e.categories[t].name) + ":", 1),
37
- o("span", {
38
- style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
- }, i(e.yFormatter ? e.yFormatter(s) : s), 1)
40
- ])
41
- ]);
42
- }), 128))
43
- ]));
44
- }
45
- });
46
- export {
47
- T as default
48
- };
@@ -1,4 +0,0 @@
1
- import f from "./Tooltip.js";
2
- export {
3
- f as default
4
- };
package/dist/index.js DELETED
@@ -1,16 +0,0 @@
1
- import { default as a } from "./components/AreaChart/AreaChart.js";
2
- import { default as o } from "./components/AreaStackedChart/AreaStackedChart.js";
3
- import { default as d } from "./components/LineChart/LineChart.js";
4
- import { default as u } from "./components/BarChart/BarChart.js";
5
- import { default as n } from "./components/DonutChart/DonutChart.js";
6
- import { CurveType as x, LegendPosition as C, Orientation as h } from "./types.js";
7
- export {
8
- a as AreaChart,
9
- o as AreaStackedChart,
10
- u as BarChart,
11
- x as CurveType,
12
- n as DonutChart,
13
- C as LegendPosition,
14
- d as LineChart,
15
- h as Orientation
16
- };
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)}
package/dist/types.js DELETED
@@ -1,6 +0,0 @@
1
- var l = /* @__PURE__ */ ((a) => (a.Top = "top", a.Bottom = "bottom", a))(l || {}), o = /* @__PURE__ */ ((a) => (a.Basis = "basis", a.BasisClosed = "basisClosed", a.BasisOpen = "basisOpen", a.Bundle = "bundle", a.Cardinal = "cardinal", a.CardinalClosed = "cardinalClosed", a.CardinalOpen = "cardinalOpen", a.CatmullRom = "catmullRom", a.CatmullRomClosed = "catmullRomClosed", a.CatmullRomOpen = "catmullRomOpen", a.Linear = "linear", a.LinearClosed = "linearClosed", a.MonotoneX = "monotoneX", a.MonotoneY = "monotoneY", a.Natural = "natural", a.Step = "step", a.StepAfter = "stepAfter", a.StepBefore = "stepBefore", a))(o || {}), t = /* @__PURE__ */ ((a) => (a.Horizontal = "horizontal", a.Vertical = "vertical", a))(t || {});
2
- export {
3
- o as CurveType,
4
- l as LegendPosition,
5
- t as Orientation
6
- };
package/dist/utils.js DELETED
@@ -1,34 +0,0 @@
1
- function u($) {
2
- if ($ && Object.keys($).length > 0) {
3
- const n = Object.keys($)[0];
4
- return $[n];
5
- }
6
- }
7
- const l = ($, n, r, c) => {
8
- switch ($) {
9
- case "circle":
10
- return `<circle cx="${n / 2}" cy="${n / 2}" r="${(n - r) / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
11
- case "square":
12
- return `<rect x="${r / 2}" y="${r / 2}" width="${n - r}" height="${n - r}" stroke-width="${r}" stroke="${c}" fill="none" />`;
13
- case "triangle":
14
- return `<polygon points="${n / 2},${r / 2} ${n - r / 2},${n - r / 2} ${r / 2},${n - r / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
15
- case "diamond":
16
- return `<polygon points="${n / 2},${r / 2} ${n - r / 2},${n / 2} ${n / 2},${n - r / 2} ${r / 2},${n / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
17
- default:
18
- return "";
19
- }
20
- };
21
- function o($) {
22
- return Object.entries($).map(([n, r]) => {
23
- const c = r.type || "circle", e = r.size || 10, t = r.strokeWidth || 2, a = r.color || "#000";
24
- return `<marker id="circle-marker-${n}" viewBox="0 0 ${e} ${e}" refX="${e / 2}" refY="${e / 2}" markerWidth="${e / 2}" markerHeight="${e / 2}">
25
- ${l(c, e, t, a)}
26
- </marker>`;
27
- }).join(`
28
- `);
29
- }
30
- export {
31
- o as createMarkers,
32
- u as getFirstPropertyValue,
33
- l as markerShape
34
- };