vue-chrts 0.1.0-beta.2 → 0.1.0-beta.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.
Files changed (32) hide show
  1. package/README.md +84 -3
  2. package/dist/components/AreaChart/AreaChart.js +133 -0
  3. package/dist/components/AreaChart/AreaChart.vue.d.ts +14 -0
  4. package/dist/components/AreaChart/AreaChart2.js +4 -0
  5. package/dist/components/AreaChart/types.d.ts +83 -0
  6. package/dist/components/AreaStackedChart/AreaStackedChart.js +69 -0
  7. package/dist/components/AreaStackedChart/AreaStackedChart.vue.d.ts +20 -0
  8. package/dist/components/AreaStackedChart/AreaStackedChart2.js +4 -0
  9. package/dist/components/AreaStackedChart/types.d.ts +58 -0
  10. package/dist/components/BarChart/BarChart.js +123 -0
  11. package/dist/components/BarChart/BarChart.vue.d.ts +14 -0
  12. package/dist/components/BarChart/BarChart2.js +4 -0
  13. package/dist/components/BarChart/types.d.ts +106 -0
  14. package/dist/components/DonutChart/DonutChart.js +58 -0
  15. package/dist/components/DonutChart/DonutChart.vue.d.ts +18 -0
  16. package/dist/components/DonutChart/DonutChart2.js +4 -0
  17. package/dist/components/DonutChart/types.d.ts +36 -0
  18. package/dist/components/DonutChart/types.js +4 -0
  19. package/dist/components/LineChart/LineChart.js +112 -0
  20. package/dist/components/LineChart/LineChart.vue.d.ts +14 -0
  21. package/dist/components/LineChart/LineChart2.js +4 -0
  22. package/dist/components/LineChart/types.d.ts +90 -0
  23. package/dist/components/Tooltip.js +37 -0
  24. package/dist/components/Tooltip.vue.d.ts +17 -0
  25. package/dist/components/Tooltip2.js +4 -0
  26. package/dist/index.d.ts +8 -0
  27. package/dist/index.js +16 -0
  28. package/dist/types.d.ts +42 -0
  29. package/dist/types.js +6 -0
  30. package/dist/utils.d.ts +1 -0
  31. package/dist/utils.js +18 -0
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,86 @@
1
- # Vue 3 + TypeScript + Vite
1
+ # Vue-Chrts
2
2
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
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
 
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
5
+ ![alt text](https://nuxtcharts.com/og-image.png)
6
+
7
+ [Check the docs and examples](https://nuxtcharts.com/docs)
8
+
9
+ ## Features
10
+
11
+ - 📊 Multiple chart types: Line, Bar, Area, Stacked Area, Donut
12
+ - 🎨 Customizable appearance
13
+ - 📱 Responsive design
14
+ - 💡 Simple, intuitive API
15
+ - 🚀 Built with Vue 3 and TypeScript
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ # npm
21
+ npm install vue-chrts
22
+
23
+ # yarn
24
+ yarn add vue-chrts
25
+
26
+ # pnpm
27
+ pnpm add vue-chrts
28
+ ```
29
+ [Check the docs and examples](https://nuxtcharts.com/docs)
30
+
31
+ ## Usage Example
32
+
33
+ ```vue
34
+ <script setup>
35
+ import { LineChart } from 'vue-chrts';
36
+
37
+ const data = [
38
+ { month: 'Jan', sales: 100, profit: 50 },
39
+ { month: 'Feb', sales: 120, profit: 55 },
40
+ { month: 'Mar', sales: 180, profit: 80 },
41
+ { month: 'Apr', sales: 110, profit: 40 },
42
+ { month: 'May', sales: 90, profit: 30 },
43
+ ];
44
+
45
+ const categories = {
46
+ sales: {
47
+ name: 'Sales',
48
+ color: '#3b82f6'
49
+ },
50
+ profit: {
51
+ name: 'Profit',
52
+ color: '#10b981'
53
+ }
54
+ };
55
+
56
+ const xFormatter = (i) => data[i].month;
57
+ </script>
58
+
59
+ <template>
60
+ <LineChart
61
+ :data="data"
62
+ :categories="categories"
63
+ :height="300"
64
+ :xFormatter="xFormatter"
65
+ xLabel="Month"
66
+ yLabel="Amount"
67
+ />
68
+ </template>
69
+ ```
70
+ [Check the docs and examples](https://nuxtcharts.com/docs)
71
+
72
+ ## Available Charts
73
+
74
+ - `LineChart`
75
+ - `BarChart`
76
+ - `AreaChart`
77
+ - `AreaStackedChart`
78
+ - `DonutChart`
79
+
80
+ ## Credits
81
+
82
+ This library is inspired by [Tremor](https://tremor.so/) and built on top of [Unovis](https://unovis.dev).
83
+
84
+ ## License
85
+
86
+ MIT
@@ -0,0 +1,133 @@
1
+ import { defineComponent as D, computed as c, createApp as N, createElementBlock as d, openBlock as l, normalizeClass as v, createVNode as s, createCommentVNode as g, unref as t, withCtx as $, createBlock as k, Fragment as L, renderList as x, mergeProps as P } from "vue";
2
+ import { Position as T, CurveType as b } from "@unovis/ts";
3
+ import { VisXYContainer as j, VisTooltip as F, VisArea as A, VisLine as w, VisAxis as B, VisCrosshair as z, VisBulletLegend as I } from "@unovis/vue";
4
+ import M from "../Tooltip.js";
5
+ import { LegendPosition as O } from "../../types.js";
6
+ import { getDistributedIndices as X } from "../../utils.js";
7
+ const Q = /* @__PURE__ */ D({
8
+ __name: "AreaChart",
9
+ props: {
10
+ data: {},
11
+ height: {},
12
+ xLabel: {},
13
+ yLabel: {},
14
+ categories: {},
15
+ xFormatter: {},
16
+ yFormatter: {},
17
+ curveType: {},
18
+ xNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
19
+ yNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
20
+ hideLegend: { type: Boolean },
21
+ hideTooltip: { type: Boolean },
22
+ xGridLine: { type: Boolean },
23
+ xDomainLine: { type: Boolean },
24
+ yGridLine: { type: Boolean },
25
+ yDomainLine: { type: Boolean },
26
+ legendPosition: {}
27
+ },
28
+ setup(a) {
29
+ const n = a, u = Object.values(n.categories).map((e) => e.color), V = c(() => (e) => {
30
+ if (typeof window > "u" || typeof document > "u")
31
+ return "";
32
+ try {
33
+ const o = N(M, {
34
+ data: e,
35
+ categories: n.categories
36
+ }), i = document.createElement("div");
37
+ o.mount(i);
38
+ const r = i.innerHTML;
39
+ return o.unmount(), r;
40
+ } catch {
41
+ return "";
42
+ }
43
+ });
44
+ function C(e) {
45
+ var o;
46
+ return {
47
+ y: (i) => Number(i[e]),
48
+ color: ((o = n.categories[e]) == null ? void 0 : o.color) ?? "#3b82f6"
49
+ };
50
+ }
51
+ const G = u.map(
52
+ (e, o) => `
53
+ <linearGradient id="gradient${o}-${e}" gradientTransform="rotate(90)">
54
+ <stop offset="0%" stop-color="${e}" stop-opacity="1" />
55
+ <stop offset="100%" stop-color="${e}" stop-opacity="0" />
56
+ </linearGradient>
57
+ `
58
+ ).join(""), h = c(
59
+ () => n.legendPosition === O.Top
60
+ ), m = c(() => X(n.data.length, n.xNumTicks)), p = c(() => {
61
+ var e;
62
+ return !((e = n.data) != null && e.length) || !m || m.value.length === 0 ? [] : m.value.map((o) => n.data[o]);
63
+ });
64
+ return (e, o) => (l(), d("div", {
65
+ class: v(["flex flex-col space-y-4", { "flex-col-reverse": h.value }])
66
+ }, [
67
+ s(t(j), {
68
+ data: p.value,
69
+ height: e.height,
70
+ "svg-defs": t(G)
71
+ }, {
72
+ default: $(() => [
73
+ e.hideTooltip ? g("", !0) : (l(), k(t(F), {
74
+ key: 0,
75
+ "horizontal-placement": t(T).Right,
76
+ "vertical-placement": t(T).Top
77
+ }, null, 8, ["horizontal-placement", "vertical-placement"])),
78
+ (l(!0), d(L, null, x(Object.keys(n.categories), (i, r) => (l(), d(L, { key: r }, [
79
+ s(t(A), P({
80
+ x: (f, y) => y,
81
+ ref_for: !0
82
+ }, C(i), {
83
+ color: `url(#gradient${r}-${t(u)[r]})`,
84
+ opacity: 0.5,
85
+ "curve-type": e.curveType ?? t(b).MonotoneX
86
+ }), null, 16, ["x", "color", "curve-type"]),
87
+ s(t(w), {
88
+ x: (f, y) => y,
89
+ y: (f) => f[i],
90
+ color: t(u)[r],
91
+ "curve-type": e.curveType ?? t(b).MonotoneX
92
+ }, null, 8, ["x", "y", "color", "curve-type"])
93
+ ], 64))), 128)),
94
+ s(t(B), {
95
+ type: "x",
96
+ "num-ticks": p.value.length,
97
+ "tick-format": (i, r) => e.xFormatter(p.value[i], r),
98
+ label: e.xLabel,
99
+ "grid-line": e.xGridLine,
100
+ "domain-line": e.xDomainLine,
101
+ "tick-line": !!e.xGridLine
102
+ }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"]),
103
+ s(t(B), {
104
+ type: "y",
105
+ "num-ticks": e.yNumTicks,
106
+ "tick-format": e.yFormatter,
107
+ label: e.yLabel,
108
+ "grid-line": e.yGridLine,
109
+ "domain-line": e.yDomainLine,
110
+ "tick-line": !!e.yGridLine
111
+ }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"]),
112
+ e.hideTooltip ? g("", !0) : (l(), k(t(z), {
113
+ key: 1,
114
+ color: "#666",
115
+ template: V.value
116
+ }, null, 8, ["template"]))
117
+ ]),
118
+ _: 1
119
+ }, 8, ["data", "height", "svg-defs"]),
120
+ e.hideLegend ? g("", !0) : (l(), d("div", {
121
+ key: 0,
122
+ class: v(["flex items center justify-end", { "pb-4": h.value }])
123
+ }, [
124
+ s(t(I), {
125
+ items: Object.values(e.categories)
126
+ }, null, 8, ["items"])
127
+ ], 2))
128
+ ], 2));
129
+ }
130
+ });
131
+ export {
132
+ Q as default
133
+ };
@@ -0,0 +1,14 @@
1
+ import { AreaChartProps } 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<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & AreaChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
+ attrs: any;
6
+ slots: {};
7
+ emit: {};
8
+ }>) => import('vue').VNode & {
9
+ __ctx?: Awaited<typeof __VLS_setup>;
10
+ };
11
+ export default _default;
12
+ type __VLS_PrettifyLocal<T> = {
13
+ [K in keyof T]: T[K];
14
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./AreaChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,83 @@
1
+ import { LegendPosition } from '../../types';
2
+ import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
3
+ export interface AreaChartProps<T> {
4
+ /**
5
+ * The data to be displayed in the area chart.
6
+ * Each element of the array represents a data point.
7
+ * The structure of 'T' should be compatible with the chart's rendering logic.
8
+ */
9
+ data: T[];
10
+ /**
11
+ * The height of the chart in pixels.
12
+ */
13
+ height: number;
14
+ /**
15
+ * Optional label for the x-axis.
16
+ */
17
+ xLabel?: string;
18
+ /**
19
+ * Optional label for the y-axis.
20
+ */
21
+ yLabel?: string;
22
+ /**
23
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
24
+ * This defines the visual representation and labels for each category in the chart's legend.
25
+ */
26
+ categories: Record<string, BulletLegendItemInterface>;
27
+ /**
28
+ * A function that formats the x-axis tick labels.
29
+ * @param item The x-axis value to be formatted.
30
+ * @param idx The index of the data point.
31
+ * @returns The formatted x-axis label.
32
+ */
33
+ xFormatter: (item: T, idx: number) => string | number;
34
+ /**
35
+ * An optional function that formats the y-axis tick labels.
36
+ * @param i The value to be formatted.
37
+ * @param idx The index of the data point (optional).
38
+ * @returns The formatted y-axis label or value.
39
+ */
40
+ yFormatter?: (i: number, idx?: number) => string | number;
41
+ /**
42
+ * The type of curve to use for the area chart lines.
43
+ * See `CurveType` for available options.
44
+ */
45
+ curveType?: CurveType;
46
+ /**
47
+ * The desired number of ticks on the x-axis.
48
+ */
49
+ xNumTicks?: number;
50
+ /**
51
+ * The desired number of ticks on the y-axis.
52
+ */
53
+ yNumTicks?: number;
54
+ /**
55
+ * If `true`, hides the chart legend.
56
+ */
57
+ hideLegend?: boolean;
58
+ /**
59
+ * If `true`, hides the chart tooltip.
60
+ */
61
+ hideTooltip?: boolean;
62
+ /**
63
+ * If `true`, displays grid lines along the x-axis.
64
+ */
65
+ xGridLine?: boolean;
66
+ /**
67
+ * If `true`, displays a domain line (axis line) along the x-axis.
68
+ */
69
+ xDomainLine?: boolean;
70
+ /**
71
+ * If `true`, displays grid lines along the y-axis.
72
+ */
73
+ yGridLine?: boolean;
74
+ /**
75
+ * If `true`, displays a domain line (axis line) along the y-axis.
76
+ */
77
+ yDomainLine?: boolean;
78
+ /**
79
+ * Optional position for the legend, if applicable.
80
+ * See `LegendPosition` for available options.
81
+ */
82
+ legendPosition?: LegendPosition;
83
+ }
@@ -0,0 +1,69 @@
1
+ import { defineComponent as d, computed as f, createApp as h, createElementBlock as y, openBlock as a, createVNode as o, createElementVNode as g, unref as t, withCtx as v, createBlock as _, createCommentVNode as V } from "vue";
2
+ import { VisXYContainer as k, VisArea as C, VisAxis as c, VisCrosshair as T, VisBulletLegend as b } from "@unovis/vue";
3
+ import { CurveType as x } from "@unovis/ts";
4
+ import B from "../Tooltip.js";
5
+ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center justify-end" }, O = /* @__PURE__ */ d({
6
+ __name: "AreaStackedChart",
7
+ props: {
8
+ data: {},
9
+ height: {},
10
+ categories: {},
11
+ hideTooltip: { type: Boolean }
12
+ },
13
+ setup(s) {
14
+ const i = s, l = f(() => (e) => {
15
+ if (typeof window > "u" || typeof document > "u")
16
+ return "";
17
+ try {
18
+ const r = h(B, {
19
+ data: e,
20
+ categories: i.categories
21
+ }), n = document.createElement("div");
22
+ r.mount(n);
23
+ const p = n.innerHTML;
24
+ return r.unmount(), p;
25
+ } catch {
26
+ return "";
27
+ }
28
+ }), m = (e) => Number.parseInt(e.time), u = [(e) => e.firstTime, (e) => e.returning];
29
+ return (e, r) => (a(), y("div", N, [
30
+ o(t(k), {
31
+ data: e.data,
32
+ height: e.height
33
+ }, {
34
+ default: v(() => [
35
+ o(t(C), {
36
+ x: m,
37
+ y: u,
38
+ color: Object.values(i.categories).map((n) => n.color),
39
+ "curve-type": t(x).Linear
40
+ }, null, 8, ["color", "curve-type"]),
41
+ o(t(c), {
42
+ type: "x",
43
+ label: "Time",
44
+ "num-ticks": 12
45
+ }),
46
+ o(t(c), {
47
+ type: "y",
48
+ label: "Number of visitors",
49
+ "num-ticks": 3
50
+ }),
51
+ e.hideTooltip ? V("", !0) : (a(), _(t(T), {
52
+ key: 0,
53
+ color: "#666",
54
+ template: l.value
55
+ }, null, 8, ["template"]))
56
+ ]),
57
+ _: 1
58
+ }, 8, ["data", "height"]),
59
+ g("div", A, [
60
+ o(t(b), {
61
+ items: Object.values(e.categories)
62
+ }, null, 8, ["items"])
63
+ ])
64
+ ]));
65
+ }
66
+ });
67
+ export {
68
+ O as default
69
+ };
@@ -0,0 +1,20 @@
1
+ import { BulletLegendItemInterface } from '@unovis/ts';
2
+ export type AreaStackedChartProps<T> = {
3
+ data: T[];
4
+ height: number;
5
+ categories: Record<string, BulletLegendItemInterface>;
6
+ hideTooltip?: boolean;
7
+ };
8
+ 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<{
9
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & AreaStackedChartProps<T> & Partial<{}>> & import('vue').PublicProps;
10
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
11
+ attrs: any;
12
+ slots: {};
13
+ emit: {};
14
+ }>) => import('vue').VNode & {
15
+ __ctx?: Awaited<typeof __VLS_setup>;
16
+ };
17
+ export default _default;
18
+ type __VLS_PrettifyLocal<T> = {
19
+ [K in keyof T]: T[K];
20
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./AreaStackedChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,58 @@
1
+ import { BulletLegendItemInterface } from '@unovis/ts';
2
+ export interface AreaStackedChartProps<T> {
3
+ /**
4
+ * The data to be displayed in the stacked area chart.
5
+ * Each element of the array represents a data point.
6
+ * The structure of 'T' should be compatible with the chart's rendering logic.
7
+ */
8
+ data: T[];
9
+ /**
10
+ * The height of the chart in pixels.
11
+ */
12
+ height: number;
13
+ /**
14
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
15
+ * This defines the visual representation and labels for each category in the chart's legend.
16
+ */
17
+ categories: Record<string, BulletLegendItemInterface>;
18
+ /**
19
+ * If `true`, hides the chart tooltip.
20
+ */
21
+ hideTooltip?: boolean;
22
+ /**
23
+ * Optional label for the x-axis.
24
+ */
25
+ xLabel?: string;
26
+ /**
27
+ * Optional label for the y-axis.
28
+ */
29
+ yLabel?: string;
30
+ /**
31
+ * If `true`, hides the chart legend.
32
+ */
33
+ hideLegend?: boolean;
34
+ /**
35
+ * If `true`, displays grid lines along the x-axis.
36
+ */
37
+ xGridLine?: boolean;
38
+ /**
39
+ * If `true`, displays a domain line (axis line) along the x-axis.
40
+ */
41
+ xDomainLine?: boolean;
42
+ /**
43
+ * If `true`, displays grid lines along the y-axis.
44
+ */
45
+ yGridLine?: boolean;
46
+ /**
47
+ * If `true`, displays a domain line (axis line) along the y-axis.
48
+ */
49
+ yDomainLine?: boolean;
50
+ /**
51
+ * If `true`, displays tick lines on the x-axis.
52
+ */
53
+ xTickLine?: boolean;
54
+ /**
55
+ * If `true`, displays tick lines on the y-axis.
56
+ */
57
+ yTickLine?: boolean;
58
+ }
@@ -0,0 +1,123 @@
1
+ import { defineComponent as v, computed as d, createApp as B, createElementBlock as k, openBlock as c, normalizeClass as h, createVNode as l, createCommentVNode as T, unref as i, withCtx as V, createBlock as L } from "vue";
2
+ import { Orientation as s, StackedBar as P, GroupedBar as C } from "@unovis/ts";
3
+ import { VisXYContainer as D, VisTooltip as G, VisGroupedBar as N, VisStackedBar as A, VisAxis as b, VisBulletLegend as F } from "@unovis/vue";
4
+ import x from "../Tooltip.js";
5
+ import { LegendPosition as j } from "../../types.js";
6
+ import { getDistributedIndices as w } from "../../utils.js";
7
+ const M = /* @__PURE__ */ v({
8
+ __name: "BarChart",
9
+ props: {
10
+ data: {},
11
+ stacked: { type: Boolean },
12
+ height: {},
13
+ xLabel: {},
14
+ yLabel: {},
15
+ categories: {},
16
+ xFormatter: {},
17
+ yFormatter: {},
18
+ yNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
19
+ xNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
20
+ yAxis: {},
21
+ groupPadding: {},
22
+ barPadding: {},
23
+ radius: {},
24
+ hideLegend: { type: Boolean },
25
+ orientation: { default: s.Vertical },
26
+ legendPosition: {},
27
+ xDomainLine: { type: Boolean },
28
+ yDomainLine: { type: Boolean },
29
+ xTickLine: { type: Boolean },
30
+ yTickLine: { type: Boolean },
31
+ xGridLine: { type: Boolean },
32
+ yGridLine: { type: Boolean, default: !0 }
33
+ },
34
+ setup(t) {
35
+ const a = t, g = d(() => a.yAxis.map((e) => (n) => n[e])), p = (e, n) => Object.values(a.categories)[n].color, y = d(
36
+ () => a.legendPosition === j.Top
37
+ ), m = d(
38
+ () => w(a.data.length, a.xNumTicks)
39
+ ), u = d(() => {
40
+ var e;
41
+ return !((e = a.data) != null && e.length) || !m || m.value.length === 0 ? [] : m.value.map((n) => a.data[n]);
42
+ }), f = d(() => (e) => {
43
+ if (typeof window > "u" || typeof document > "u")
44
+ return "";
45
+ try {
46
+ const n = B(x, {
47
+ data: e,
48
+ categories: a.categories
49
+ }), r = document.createElement("div");
50
+ n.mount(r);
51
+ const o = r.innerHTML;
52
+ return n.unmount(), o;
53
+ } catch {
54
+ return "";
55
+ }
56
+ });
57
+ return (e, n) => (c(), k("div", {
58
+ class: h(["flex flex-col space-y-4", { "flex-col-reverse": y.value }])
59
+ }, [
60
+ l(i(D), { height: e.height }, {
61
+ default: V(() => [
62
+ l(i(G), {
63
+ triggers: {
64
+ [i(C).selectors.bar]: f.value,
65
+ [i(P).selectors.bar]: f.value
66
+ }
67
+ }, null, 8, ["triggers"]),
68
+ e.stacked ? (c(), L(i(A), {
69
+ key: 1,
70
+ data: u.value,
71
+ x: (r, o) => o,
72
+ y: g.value,
73
+ color: p,
74
+ "rounded-corners": e.radius ?? 0,
75
+ "group-padding": e.groupPadding ?? 0,
76
+ "bar-padding": e.barPadding ?? 0.2,
77
+ orientation: e.orientation ?? i(s).Vertical
78
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (c(), L(i(N), {
79
+ key: 0,
80
+ data: u.value,
81
+ x: (r, o) => o,
82
+ y: g.value,
83
+ color: p,
84
+ "rounded-corners": e.radius ?? 0,
85
+ "group-padding": e.groupPadding ?? 0,
86
+ "bar-padding": e.barPadding ?? 0.2,
87
+ orientation: e.orientation ?? i(s).Vertical
88
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
89
+ l(i(b), {
90
+ type: "x",
91
+ "num-ticks": u.value.length,
92
+ "tick-format": a.orientation === i(s).Horizontal ? e.xFormatter : (r, o) => e.xFormatter(u.value[r], o),
93
+ label: e.xLabel,
94
+ "grid-line": e.xGridLine,
95
+ "domain-line": e.xDomainLine,
96
+ "tick-line": e.xTickLine
97
+ }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"]),
98
+ l(i(b), {
99
+ type: "y",
100
+ label: e.yLabel,
101
+ "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
102
+ "domain-line": e.yDomainLine,
103
+ "tick-format": e.yFormatter,
104
+ "num-ticks": e.yNumTicks,
105
+ "tick-line": e.yTickLine
106
+ }, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"])
107
+ ]),
108
+ _: 1
109
+ }, 8, ["height"]),
110
+ e.hideLegend ? T("", !0) : (c(), k("div", {
111
+ key: 0,
112
+ class: h(["flex items center justify-end", { "pb-4": y.value }])
113
+ }, [
114
+ l(i(F), {
115
+ items: Object.values(e.categories)
116
+ }, null, 8, ["items"])
117
+ ], 2))
118
+ ], 2));
119
+ }
120
+ });
121
+ export {
122
+ M as default
123
+ };
@@ -0,0 +1,14 @@
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<{
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
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
+ attrs: any;
6
+ slots: {};
7
+ emit: {};
8
+ }>) => import('vue').VNode & {
9
+ __ctx?: Awaited<typeof __VLS_setup>;
10
+ };
11
+ export default _default;
12
+ type __VLS_PrettifyLocal<T> = {
13
+ [K in keyof T]: T[K];
14
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./BarChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,106 @@
1
+ import { BulletLegendItemInterface, Orientation, LegendPosition } from '../../types';
2
+ export interface BarChartProps<T> {
3
+ /**
4
+ * The data to be displayed in the bar chart.
5
+ * Each element of the array represents a data point.
6
+ * The structure of 'T' should be compatible with the chart's rendering logic.
7
+ */
8
+ data: T[];
9
+ /**
10
+ * If `true`, creates a stacked bar chart instead of grouped bars.
11
+ */
12
+ stacked?: boolean;
13
+ /**
14
+ * The height of the chart in pixels.
15
+ */
16
+ height: number;
17
+ /**
18
+ * Optional label for the x-axis.
19
+ */
20
+ xLabel?: string;
21
+ /**
22
+ * Optional label for the y-axis.
23
+ */
24
+ yLabel?: string;
25
+ /**
26
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
27
+ * This defines the visual representation and labels for each category in the chart's legend.
28
+ */
29
+ categories: Record<string, BulletLegendItemInterface>;
30
+ /**
31
+ * A function that formats the x-axis tick labels.
32
+ * @param item The x-axis value to be formatted.
33
+ * @param idx The index of the data point.
34
+ * @returns The formatted x-axis label.
35
+ */
36
+ xFormatter: (item: T, idx: number) => string | number;
37
+ /**
38
+ * An optional function that formats the y-axis tick labels.
39
+ * @param i The value to be formatted.
40
+ * @param idx The index of the data point (optional).
41
+ * @returns The formatted y-axis label or value.
42
+ */
43
+ yFormatter?: (i: number, idx?: number) => string | number;
44
+ /**
45
+ * The desired number of ticks on the y-axis.
46
+ */
47
+ yNumTicks?: number;
48
+ /**
49
+ * The desired number of ticks on the x-axis.
50
+ */
51
+ xNumTicks?: number;
52
+ /**
53
+ * An array of property keys from the data object type 'T' to be used for the y-axis values.
54
+ */
55
+ yAxis: (keyof T)[];
56
+ /**
57
+ * The padding between groups of bars in pixels.
58
+ */
59
+ groupPadding?: number;
60
+ /**
61
+ * The padding between bars within the same group in pixels.
62
+ */
63
+ barPadding?: number;
64
+ /**
65
+ * The corner radius of the bars in pixels.
66
+ */
67
+ radius?: number;
68
+ /**
69
+ * If `true`, hides the chart legend.
70
+ */
71
+ hideLegend?: boolean;
72
+ /**
73
+ * The orientation of the bars (vertical or horizontal).
74
+ * See `Orientation` for available options.
75
+ */
76
+ orientation?: Orientation;
77
+ /**
78
+ * Optional position for the legend, if applicable.
79
+ * See `LegendPosition` for available options.
80
+ */
81
+ legendPosition?: LegendPosition;
82
+ /**
83
+ * If `true`, displays a domain line (axis line) along the x-axis.
84
+ */
85
+ xDomainLine?: boolean;
86
+ /**
87
+ * If `true`, displays a domain line (axis line) along the y-axis.
88
+ */
89
+ yDomainLine?: boolean;
90
+ /**
91
+ * If `true`, displays tick lines on the x-axis.
92
+ */
93
+ xTickLine?: boolean;
94
+ /**
95
+ * If `true`, displays tick lines on the y-axis.
96
+ */
97
+ yTickLine?: boolean;
98
+ /**
99
+ * If `true`, displays grid lines along the x-axis.
100
+ */
101
+ xGridLine?: boolean;
102
+ /**
103
+ * If `true`, displays grid lines along the y-axis.
104
+ */
105
+ yGridLine?: boolean;
106
+ }
@@ -0,0 +1,58 @@
1
+ import { defineComponent as u, createElementBlock as n, openBlock as i, Fragment as m, createElementVNode as f, createCommentVNode as p, createVNode as t, renderSlot as g, unref as o, withCtx as h } from "vue";
2
+ import { Donut as v } from "@unovis/ts";
3
+ import { VisSingleContainer as y, VisTooltip as V, VisDonut as b, VisBulletLegend as C } from "@unovis/vue";
4
+ import { DonutType as _ } from "./types.js";
5
+ const k = { class: "flex items-center justify-center" }, B = {
6
+ key: 0,
7
+ class: "flex items-center justify-center mt-4"
8
+ }, w = /* @__PURE__ */ u({
9
+ __name: "DonutChart",
10
+ props: {
11
+ type: {},
12
+ data: {},
13
+ height: {},
14
+ radius: {},
15
+ hideLegend: { type: Boolean },
16
+ labels: {}
17
+ },
18
+ setup(l) {
19
+ const r = l, s = (e) => e, a = r.type === _.Half, d = {
20
+ [v.selectors.segment]: (e) => `<div class='flex items-center'><div class='w-2 h-2 rounded-full mr-2' style='background-color: ${r.labels[e.index].color} ;'></div>
21
+ <div>${e.data}</div>
22
+ </vistooltip>
23
+ </vissinglecontainer>
24
+ </div>`
25
+ };
26
+ return (e, D) => (i(), n(m, null, [
27
+ f("div", k, [
28
+ t(o(y), {
29
+ data: e.data,
30
+ height: e.height,
31
+ margin: {}
32
+ }, {
33
+ default: h(() => [
34
+ t(o(V), {
35
+ "horizontal-shift": 20,
36
+ "vertical-shift": 20,
37
+ triggers: d
38
+ }),
39
+ t(o(b), {
40
+ value: s,
41
+ "corner-radius": e.radius,
42
+ color: r.labels.map((c) => c.color),
43
+ "angle-range": a ? [-1.5707963267948966, 1.5707963267948966] : []
44
+ }, null, 8, ["corner-radius", "color", "angle-range"])
45
+ ]),
46
+ _: 1
47
+ }, 8, ["data", "height"]),
48
+ g(e.$slots, "default")
49
+ ]),
50
+ e.hideLegend ? p("", !0) : (i(), n("div", B, [
51
+ t(o(C), { items: e.labels }, null, 8, ["items"])
52
+ ]))
53
+ ], 64));
54
+ }
55
+ });
56
+ export {
57
+ w as default
58
+ };
@@ -0,0 +1,18 @@
1
+ import { DonutChartProps } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: any;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import('vue').DefineComponent<DonutChartProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DonutChartProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
13
+ export default _default;
14
+ type __VLS_WithTemplateSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./DonutChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,36 @@
1
+ interface DonutChartProps {
2
+ /**
3
+ * The type of donut chart to render.
4
+ * See `DonutType` for available options.
5
+ */
6
+ type?: string;
7
+ /**
8
+ * The data to be displayed in the donut chart.
9
+ * Each number in the array represents a segment value.
10
+ */
11
+ data: number[];
12
+ /**
13
+ * The height of the chart in pixels.
14
+ */
15
+ height: number;
16
+ /**
17
+ * The radius of the donut in pixels.
18
+ */
19
+ radius: number;
20
+ /**
21
+ * If `true`, hides the chart legend.
22
+ */
23
+ hideLegend?: boolean;
24
+ /**
25
+ * An array of label objects defining the name and color for each segment.
26
+ */
27
+ labels: {
28
+ name: string;
29
+ color: string;
30
+ }[];
31
+ }
32
+ declare enum DonutType {
33
+ Half = "half",
34
+ Full = "full"
35
+ }
36
+ export { type DonutChartProps, DonutType };
@@ -0,0 +1,4 @@
1
+ var r = /* @__PURE__ */ ((l) => (l.Half = "half", l.Full = "full", l))(r || {});
2
+ export {
3
+ r as DonutType
4
+ };
@@ -0,0 +1,112 @@
1
+ import { defineComponent as B, computed as m, createApp as C, createElementBlock as u, openBlock as r, normalizeClass as g, createVNode as c, createCommentVNode as f, unref as t, withCtx as V, createBlock as h, Fragment as x, renderList as D } from "vue";
2
+ import { Position as k, CurveType as N } from "@unovis/ts";
3
+ import { VisXYContainer as F, VisTooltip as P, VisLine as j, VisAxis as L, VisCrosshair as G, VisBulletLegend as w } from "@unovis/vue";
4
+ import z from "../Tooltip.js";
5
+ import { LegendPosition as I } from "../../types.js";
6
+ import { getDistributedIndices as O } from "../../utils.js";
7
+ const Y = /* @__PURE__ */ B({
8
+ __name: "LineChart",
9
+ props: {
10
+ data: {},
11
+ height: {},
12
+ xLabel: {},
13
+ yLabel: {},
14
+ categories: {},
15
+ xFormatter: {},
16
+ yFormatter: {},
17
+ curveType: {},
18
+ hideTooltip: { type: Boolean },
19
+ yNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
20
+ xNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
21
+ hideLegend: { type: Boolean },
22
+ legendPosition: {},
23
+ xGridLine: { type: Boolean },
24
+ xDomainLine: { type: Boolean },
25
+ yGridLine: { type: Boolean },
26
+ yDomainLine: { type: Boolean },
27
+ xTickLine: { type: Boolean },
28
+ yTickLine: { type: Boolean }
29
+ },
30
+ setup(n) {
31
+ const i = n, v = (e) => Object.values(i.categories)[e].color, T = m(() => (e) => {
32
+ if (typeof window > "u" || typeof document > "u")
33
+ return "";
34
+ try {
35
+ const o = C(z, {
36
+ data: e,
37
+ categories: i.categories
38
+ }), a = document.createElement("div");
39
+ o.mount(a);
40
+ const l = a.innerHTML;
41
+ return o.unmount(), l;
42
+ } catch {
43
+ return "";
44
+ }
45
+ }), p = m(
46
+ () => i.legendPosition === I.Top
47
+ ), s = m(
48
+ () => O(i.data.length, i.xNumTicks)
49
+ ), d = m(() => {
50
+ var e;
51
+ return !((e = i.data) != null && e.length) || !s || s.value.length === 0 ? [] : s.value.map((o) => i.data[o]);
52
+ });
53
+ return (e, o) => (r(), u("div", {
54
+ class: g(["flex flex-col space-y-4", { "flex-col-reverse": p.value }])
55
+ }, [
56
+ c(t(F), {
57
+ data: d.value,
58
+ height: e.height
59
+ }, {
60
+ default: V(() => [
61
+ c(t(P), {
62
+ "horizontal-placement": t(k).Right,
63
+ "vertical-placement": t(k).Top
64
+ }, null, 8, ["horizontal-placement", "vertical-placement"]),
65
+ (r(!0), u(x, null, D(Object.keys(i.categories), (a, l) => (r(), h(t(j), {
66
+ key: l,
67
+ x: (y, b) => b,
68
+ y: (y) => y[a],
69
+ color: v(l),
70
+ "curve-type": e.curveType ?? t(N).MonotoneX
71
+ }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
72
+ c(t(L), {
73
+ type: "x",
74
+ "num-ticks": d.value.length,
75
+ "tick-format": (a, l) => e.xFormatter(d.value[a], l),
76
+ label: e.xLabel,
77
+ "label-margin": 8,
78
+ "domain-line": e.xDomainLine,
79
+ "grid-line": e.xGridLine,
80
+ "tick-line": e.xTickLine
81
+ }, null, 8, ["num-ticks", "tick-format", "label", "domain-line", "grid-line", "tick-line"]),
82
+ c(t(L), {
83
+ type: "y",
84
+ "tick-format": e.yFormatter,
85
+ label: e.yLabel,
86
+ "num-ticks": e.yNumTicks,
87
+ "domain-line": e.yDomainLine,
88
+ "grid-line": e.yGridLine,
89
+ "tick-line": e.yTickLine
90
+ }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"]),
91
+ e.hideTooltip ? f("", !0) : (r(), h(t(G), {
92
+ key: 0,
93
+ color: "#666",
94
+ template: T.value
95
+ }, null, 8, ["template"]))
96
+ ]),
97
+ _: 1
98
+ }, 8, ["data", "height"]),
99
+ e.hideLegend ? f("", !0) : (r(), u("div", {
100
+ key: 0,
101
+ class: g(["flex items center justify-end", { "pb-4": p.value }])
102
+ }, [
103
+ c(t(w), {
104
+ items: Object.values(e.categories)
105
+ }, null, 8, ["items"])
106
+ ], 2))
107
+ ], 2));
108
+ }
109
+ });
110
+ export {
111
+ Y as default
112
+ };
@@ -0,0 +1,14 @@
1
+ import { LineChartProps } 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<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
+ attrs: any;
6
+ slots: {};
7
+ emit: {};
8
+ }>) => import('vue').VNode & {
9
+ __ctx?: Awaited<typeof __VLS_setup>;
10
+ };
11
+ export default _default;
12
+ type __VLS_PrettifyLocal<T> = {
13
+ [K in keyof T]: T[K];
14
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./LineChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,90 @@
1
+ import { BulletLegendItemInterface, CurveType, LegendPosition } from '../../types';
2
+ export interface LineChartProps<T> {
3
+ /**
4
+ * The data to be displayed in the line chart.
5
+ * Each element of the array represents a data point.
6
+ * The structure of 'T' should be compatible with the chart's rendering logic.
7
+ */
8
+ data: T[];
9
+ /**
10
+ * The height of the chart in pixels.
11
+ */
12
+ height: number;
13
+ /**
14
+ * Optional label for the x-axis.
15
+ */
16
+ xLabel?: string;
17
+ /**
18
+ * Optional label for the y-axis.
19
+ */
20
+ yLabel?: string;
21
+ /**
22
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
23
+ * This defines the visual representation and labels for each category in the chart's legend.
24
+ */
25
+ categories: Record<string, BulletLegendItemInterface>;
26
+ /**
27
+ * A function that formats the x-axis tick labels.
28
+ * @param item The x-axis value to be formatted.
29
+ * @param idx The index of the data point.
30
+ * @returns The formatted x-axis label.
31
+ */
32
+ xFormatter: (item: T, idx: number) => string | number;
33
+ /**
34
+ * An optional function that formats the y-axis tick labels.
35
+ * @param i The value to be formatted.
36
+ * @param idx The index of the data point.
37
+ * @returns The formatted y-axis label.
38
+ */
39
+ yFormatter?: (i: number, idx: number) => string;
40
+ /**
41
+ * The type of curve to use for the line chart.
42
+ * See `CurveType` for available options.
43
+ */
44
+ curveType?: CurveType;
45
+ /**
46
+ * If `true`, hides the chart tooltip.
47
+ */
48
+ hideTooltip?: boolean;
49
+ /**
50
+ * The desired number of ticks on the y-axis.
51
+ */
52
+ yNumTicks?: number;
53
+ /**
54
+ * The desired number of ticks on the x-axis.
55
+ */
56
+ xNumTicks?: number;
57
+ /**
58
+ * If `true`, hides the chart legend.
59
+ */
60
+ hideLegend?: boolean;
61
+ /**
62
+ * Optional position for the legend, if applicable.
63
+ * See `LegendPosition` for available options.
64
+ */
65
+ legendPosition?: LegendPosition;
66
+ /**
67
+ * If `true`, displays grid lines along the x-axis.
68
+ */
69
+ xGridLine?: boolean;
70
+ /**
71
+ * If `true`, displays a domain line (axis line) along the x-axis.
72
+ */
73
+ xDomainLine?: boolean;
74
+ /**
75
+ * If `true`, displays grid lines along the y-axis.
76
+ */
77
+ yGridLine?: boolean;
78
+ /**
79
+ * If `true`, displays a domain line (axis line) along the y-axis.
80
+ */
81
+ yDomainLine?: boolean;
82
+ /**
83
+ * If `true`, displays tick lines on the x-axis.
84
+ */
85
+ xTickLine?: boolean;
86
+ /**
87
+ * If `true`, displays tick lines on the y-axis.
88
+ */
89
+ yTickLine?: boolean;
90
+ }
@@ -0,0 +1,37 @@
1
+ import { defineComponent as g, computed as m, createElementBlock as r, openBlock as l, Fragment as x, renderList as _, createElementVNode as o, normalizeStyle as n, toDisplayString as a } from "vue";
2
+ const h = /* @__PURE__ */ g({
3
+ __name: "Tooltip",
4
+ props: {
5
+ data: {},
6
+ categories: {}
7
+ },
8
+ setup(s) {
9
+ const i = s, c = ["_index", "_stacked", "_ending"], p = m(() => Object.entries(i.data ?? []).filter(
10
+ ([t, d]) => {
11
+ var e;
12
+ return !c.includes(t) && ((e = i.categories[t]) == null ? void 0 : e.color);
13
+ }
14
+ ));
15
+ return (t, d) => (l(), r("div", null, [
16
+ (l(!0), r(x, null, _(p.value, ([e, u]) => (l(), r("div", {
17
+ key: e,
18
+ style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
19
+ }, [
20
+ o("span", {
21
+ style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, { backgroundColor: t.categories[e].color }])
22
+ }, null, 4),
23
+ o("div", null, [
24
+ o("span", {
25
+ style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
26
+ }, a(e) + ":", 1),
27
+ o("span", {
28
+ style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
29
+ }, a(u), 1)
30
+ ])
31
+ ]))), 128))
32
+ ]));
33
+ }
34
+ });
35
+ export {
36
+ h as default
37
+ };
@@ -0,0 +1,17 @@
1
+ import { BulletLegendItemInterface } from '@unovis/ts';
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<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
4
+ data: T;
5
+ categories: Record<string, BulletLegendItemInterface>;
6
+ } & Partial<{}>> & import('vue').PublicProps;
7
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
8
+ attrs: any;
9
+ slots: {};
10
+ emit: {};
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: Awaited<typeof __VLS_setup>;
13
+ };
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = {
16
+ [K in keyof T]: T[K];
17
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./Tooltip.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,8 @@
1
+ import { default as AreaChart } from './components/AreaChart/AreaChart.vue';
2
+ import { default as AreaStackedChart } from './components/AreaStackedChart/AreaStackedChart.vue';
3
+ import { default as LineChart } from './components/LineChart/LineChart.vue';
4
+ import { default as BarChart } from './components/BarChart/BarChart.vue';
5
+ import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
6
+ import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface } from './types';
7
+ export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, Orientation, CurveType, LegendPosition };
8
+ export type { BulletLegendItemInterface, };
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
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
+ };
@@ -0,0 +1,42 @@
1
+ import { AreaChartProps } from './components/AreaChart/types';
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 {
6
+ Top = "top",
7
+ Bottom = "bottom"
8
+ }
9
+ declare enum CurveType {
10
+ Basis = "basis",
11
+ BasisClosed = "basisClosed",
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, };
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
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
+ };
@@ -0,0 +1 @@
1
+ export declare function getDistributedIndices(length: number, numTicks: number): number[];
package/dist/utils.js ADDED
@@ -0,0 +1,18 @@
1
+ function i(t, r) {
2
+ if (r <= 0) return [];
3
+ if (r >= t)
4
+ return Array.from({ length: t }, (o, e) => e);
5
+ if (r === 1)
6
+ return [Math.floor((t - 1) / 2)];
7
+ if (r === 2)
8
+ return [0, t - 1];
9
+ const f = [];
10
+ for (let o = 0; o < r; o++) {
11
+ const e = Math.round(o * (t - 1) / (r - 1));
12
+ f.push(e);
13
+ }
14
+ return f;
15
+ }
16
+ export {
17
+ i as getDistributedIndices
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"