vue-chrts 0.0.137 → 0.0.139

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.
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("@unovis/ts"),i=require("@unovis/vue"),m=require("../Tooltip.cjs"),c=require("../../index.cjs"),f=e.defineComponent({__name:"BarChart",props:{data:{},stacked:{type:Boolean},height:{},xLabel:{},yLabel:{},categories:{},xFormatter:{},yFormatter:{},yNumTicks:{},xNumTicks:{},yAxis:{},groupPadding:{},barPadding:{},radius:{},hideLegend:{type:Boolean},orientation:{default:o.Orientation.Vertical},paginationPosition:{default:c.PaginationPosition.Bottom}},setup(p){const r=p,d=e.computed(()=>r.yAxis.map(a=>n=>n[a])),s=(a,n)=>Object.values(r.categories)[n].color,g=e.computed(()=>a=>{const n=e.createApp(m.default,{data:a,categories:r.categories}),l=document.createElement("div");n.mount(l);const t=l.innerHTML;return n.unmount(),t}),u=e.computed(()=>r.paginationPosition===c.PaginationPosition.Top);return(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col space-y-4",{"flex-col-reverse":u.value}])},[e.createVNode(e.unref(i.VisXYContainer),{height:a.height},{default:e.withCtx(()=>[e.createVNode(e.unref(i.VisTooltip),{triggers:{[e.unref(o.GroupedBar).selectors.bar]:g.value}},null,8,["triggers"]),a.stacked?(e.openBlock(),e.createBlock(e.unref(i.VisStackedBar),{key:1,data:a.data,x:(l,t)=>t,y:d.value,"grid-line":!1,"domain-line":!1,color:s,"rounded-corners":a.radius??0,"group-padding":a.groupPadding??0,"bar-padding":a.barPadding??.2,orientation:a.orientation??e.unref(o.Orientation).Vertical},null,8,["data","x","y","rounded-corners","group-padding","bar-padding","orientation"])):(e.openBlock(),e.createBlock(e.unref(i.VisGroupedBar),{key:0,data:a.data,x:(l,t)=>t,y:d.value,"grid-line":!1,"domain-line":!1,color:s,"rounded-corners":a.radius??0,"group-padding":a.groupPadding??0,"bar-padding":a.barPadding??.2,orientation:a.orientation??e.unref(o.Orientation).Vertical},null,8,["data","x","y","rounded-corners","group-padding","bar-padding","orientation"])),e.createVNode(e.unref(i.VisAxis),{type:"x",label:a.xLabel,"grid-line":!1,"domain-line":!1,"tick-format":a.xFormatter,"num-ticks":a.xNumTicks,"tick-line":!1},null,8,["label","tick-format","num-ticks"]),e.createVNode(e.unref(i.VisAxis),{type:"y",label:a.yLabel,"grid-line":a.orientation!==e.unref(o.Orientation).Horizontal,"domain-line":!1,"tick-format":a.yFormatter},null,8,["label","grid-line","tick-format"])]),_:1},8,["height"]),a.hideLegend?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items center justify-end",{"pb-4":u.value}])},[e.createVNode(e.unref(i.VisBulletLegend),{items:Object.values(a.categories)},null,8,["items"])],2))],2))}});exports.default=f;
2
+ //# sourceMappingURL=BarChart.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart.cjs","sources":["../../../src/components/Bar/BarChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, ComputedRef, createApp } from \"vue\";\nimport { BulletLegendItemInterface, GroupedBar, Orientation } from \"@unovis/ts\";\n\nimport {\n VisAxis,\n VisBulletLegend,\n VisGroupedBar,\n VisStackedBar,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../..\";\n\ntype BarChartProps<T> = {\n data: T[];\n stacked?: boolean;\n height: number;\n xLabel?: string;\n yLabel?: string;\n categories: Record<string, BulletLegendItemInterface>;\n xFormatter: (i: number, idx?: number) => string | number;\n yFormatter?: (i: number, idx?: number) => string | number;\n yNumTicks?: number;\n xNumTicks?: number;\n yAxis: (keyof T)[];\n groupPadding?: number;\n barPadding?: number;\n radius?: number;\n hideLegend?: boolean;\n orientation?: Orientation;\n paginationPosition?: PaginationPosition;\n};\n\nconst props = withDefaults(defineProps<BarChartProps<T>>(), {\n orientation: Orientation.Vertical,\n paginationPosition: PaginationPosition.Bottom,\n});\n\nconst yAxis: ComputedRef<((d: T) => T[keyof T])[]> = computed(() => {\n return props.yAxis.map((key) => (d: T) => {\n return d[key];\n });\n});\n\nconst color = (_: T, i: number) => Object.values(props.categories)[i].color;\n\nconst generateTooltip = computed(() => (d: T) => {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n});\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer :height=\"height\">\n <VisTooltip\n :triggers=\"{\n [GroupedBar.selectors.bar]: generateTooltip,\n }\"\n />\n\n <VisGroupedBar\n v-if=\"!stacked\"\n :data=\"data\"\n :x=\"(_: T, i: number) => i\"\n :y=\"yAxis\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :color=\"color\"\n :rounded-corners=\"radius ?? 0\"\n :group-padding=\"groupPadding ?? 0\"\n :bar-padding=\"barPadding ?? 0.2\"\n :orientation=\"orientation ?? Orientation.Vertical\"\n />\n <VisStackedBar\n v-else\n :data=\"data\"\n :x=\"(_: T, i: number) => i\"\n :y=\"yAxis\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :color=\"color\"\n :rounded-corners=\"radius ?? 0\"\n :group-padding=\"groupPadding ?? 0\"\n :bar-padding=\"barPadding ?? 0.2\"\n :orientation=\"orientation ?? Orientation.Vertical\"\n />\n <VisAxis\n type=\"x\"\n :label=\"xLabel\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks\"\n :tick-line=\"false\"\n />\n <VisAxis\n type=\"y\"\n :label=\"yLabel\"\n :grid-line=\"orientation !== Orientation.Horizontal\"\n :domain-line=\"false\"\n :tick-format=\"yFormatter\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","yAxis","computed","key","d","color","_","i","generateTooltip","app","createApp","Tooltip","container","html","PaginationPositionTop","PaginationPosition"],"mappings":"ulBAoCA,MAAMA,EAAQC,EAKRC,EAA+CC,EAAAA,SAAS,IACrDH,EAAM,MAAM,IAAKI,GAASC,GACxBA,EAAED,CAAG,CACb,CACF,EAEKE,EAAQ,CAACC,EAAMC,IAAc,OAAO,OAAOR,EAAM,UAAU,EAAEQ,CAAC,EAAE,MAEhEC,EAAkBN,EAAAA,SAAS,IAAOE,GAAS,CACzC,MAAAK,EAAMC,YAAUC,UAAS,CAC7B,KAAMP,EACN,WAAYL,EAAM,UAAA,CACnB,EAEKa,EAAY,SAAS,cAAc,KAAK,EAC9CH,EAAI,MAAMG,CAAS,EAEnB,MAAMC,EAAOD,EAAU,UACvB,OAAAH,EAAI,QAAQ,EAELI,CAAA,CACR,EAEKC,EAAwBZ,EAAA,SAC5B,IAAMH,EAAM,qBAAuBgB,qBAAmB,GACxD"}
@@ -0,0 +1,107 @@
1
+ import { defineComponent as P, computed as s, createApp as v, createElementBlock as m, openBlock as l, normalizeClass as c, createVNode as n, createCommentVNode as B, unref as a, withCtx as V, createBlock as f } from "vue";
2
+ import { Orientation as d, GroupedBar as L } from "@unovis/ts";
3
+ import { VisXYContainer as T, VisTooltip as C, VisGroupedBar as A, VisStackedBar as N, VisAxis as y, VisBulletLegend as F } from "@unovis/vue";
4
+ import j from "../Tooltip.js";
5
+ import { PaginationPosition as b } from "../../index.js";
6
+ const H = /* @__PURE__ */ P({
7
+ __name: "BarChart",
8
+ props: {
9
+ data: {},
10
+ stacked: { type: Boolean },
11
+ height: {},
12
+ xLabel: {},
13
+ yLabel: {},
14
+ categories: {},
15
+ xFormatter: {},
16
+ yFormatter: {},
17
+ yNumTicks: {},
18
+ xNumTicks: {},
19
+ yAxis: {},
20
+ groupPadding: {},
21
+ barPadding: {},
22
+ radius: {},
23
+ hideLegend: { type: Boolean },
24
+ orientation: { default: d.Vertical },
25
+ paginationPosition: { default: b.Bottom }
26
+ },
27
+ setup(k) {
28
+ const r = k, u = s(() => r.yAxis.map((e) => (i) => i[e])), p = (e, i) => Object.values(r.categories)[i].color, h = s(() => (e) => {
29
+ const i = v(j, {
30
+ data: e,
31
+ categories: r.categories
32
+ }), t = document.createElement("div");
33
+ i.mount(t);
34
+ const o = t.innerHTML;
35
+ return i.unmount(), o;
36
+ }), g = s(
37
+ () => r.paginationPosition === b.Top
38
+ );
39
+ return (e, i) => (l(), m("div", {
40
+ class: c(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
41
+ }, [
42
+ n(a(T), { height: e.height }, {
43
+ default: V(() => [
44
+ n(a(C), {
45
+ triggers: {
46
+ [a(L).selectors.bar]: h.value
47
+ }
48
+ }, null, 8, ["triggers"]),
49
+ e.stacked ? (l(), f(a(N), {
50
+ key: 1,
51
+ data: e.data,
52
+ x: (t, o) => o,
53
+ y: u.value,
54
+ "grid-line": !1,
55
+ "domain-line": !1,
56
+ color: p,
57
+ "rounded-corners": e.radius ?? 0,
58
+ "group-padding": e.groupPadding ?? 0,
59
+ "bar-padding": e.barPadding ?? 0.2,
60
+ orientation: e.orientation ?? a(d).Vertical
61
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), f(a(A), {
62
+ key: 0,
63
+ data: e.data,
64
+ x: (t, o) => o,
65
+ y: u.value,
66
+ "grid-line": !1,
67
+ "domain-line": !1,
68
+ color: p,
69
+ "rounded-corners": e.radius ?? 0,
70
+ "group-padding": e.groupPadding ?? 0,
71
+ "bar-padding": e.barPadding ?? 0.2,
72
+ orientation: e.orientation ?? a(d).Vertical
73
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
74
+ n(a(y), {
75
+ type: "x",
76
+ label: e.xLabel,
77
+ "grid-line": !1,
78
+ "domain-line": !1,
79
+ "tick-format": e.xFormatter,
80
+ "num-ticks": e.xNumTicks,
81
+ "tick-line": !1
82
+ }, null, 8, ["label", "tick-format", "num-ticks"]),
83
+ n(a(y), {
84
+ type: "y",
85
+ label: e.yLabel,
86
+ "grid-line": e.orientation !== a(d).Horizontal,
87
+ "domain-line": !1,
88
+ "tick-format": e.yFormatter
89
+ }, null, 8, ["label", "grid-line", "tick-format"])
90
+ ]),
91
+ _: 1
92
+ }, 8, ["height"]),
93
+ e.hideLegend ? B("", !0) : (l(), m("div", {
94
+ key: 0,
95
+ class: c(["flex items center justify-end", { "pb-4": g.value }])
96
+ }, [
97
+ n(a(F), {
98
+ items: Object.values(e.categories)
99
+ }, null, 8, ["items"])
100
+ ], 2))
101
+ ], 2));
102
+ }
103
+ });
104
+ export {
105
+ H as default
106
+ };
107
+ //# sourceMappingURL=BarChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart.js","sources":["../../../src/components/Bar/BarChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, ComputedRef, createApp } from \"vue\";\nimport { BulletLegendItemInterface, GroupedBar, Orientation } from \"@unovis/ts\";\n\nimport {\n VisAxis,\n VisBulletLegend,\n VisGroupedBar,\n VisStackedBar,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../..\";\n\ntype BarChartProps<T> = {\n data: T[];\n stacked?: boolean;\n height: number;\n xLabel?: string;\n yLabel?: string;\n categories: Record<string, BulletLegendItemInterface>;\n xFormatter: (i: number, idx?: number) => string | number;\n yFormatter?: (i: number, idx?: number) => string | number;\n yNumTicks?: number;\n xNumTicks?: number;\n yAxis: (keyof T)[];\n groupPadding?: number;\n barPadding?: number;\n radius?: number;\n hideLegend?: boolean;\n orientation?: Orientation;\n paginationPosition?: PaginationPosition;\n};\n\nconst props = withDefaults(defineProps<BarChartProps<T>>(), {\n orientation: Orientation.Vertical,\n paginationPosition: PaginationPosition.Bottom,\n});\n\nconst yAxis: ComputedRef<((d: T) => T[keyof T])[]> = computed(() => {\n return props.yAxis.map((key) => (d: T) => {\n return d[key];\n });\n});\n\nconst color = (_: T, i: number) => Object.values(props.categories)[i].color;\n\nconst generateTooltip = computed(() => (d: T) => {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n});\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer :height=\"height\">\n <VisTooltip\n :triggers=\"{\n [GroupedBar.selectors.bar]: generateTooltip,\n }\"\n />\n\n <VisGroupedBar\n v-if=\"!stacked\"\n :data=\"data\"\n :x=\"(_: T, i: number) => i\"\n :y=\"yAxis\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :color=\"color\"\n :rounded-corners=\"radius ?? 0\"\n :group-padding=\"groupPadding ?? 0\"\n :bar-padding=\"barPadding ?? 0.2\"\n :orientation=\"orientation ?? Orientation.Vertical\"\n />\n <VisStackedBar\n v-else\n :data=\"data\"\n :x=\"(_: T, i: number) => i\"\n :y=\"yAxis\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :color=\"color\"\n :rounded-corners=\"radius ?? 0\"\n :group-padding=\"groupPadding ?? 0\"\n :bar-padding=\"barPadding ?? 0.2\"\n :orientation=\"orientation ?? Orientation.Vertical\"\n />\n <VisAxis\n type=\"x\"\n :label=\"xLabel\"\n :grid-line=\"false\"\n :domain-line=\"false\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks\"\n :tick-line=\"false\"\n />\n <VisAxis\n type=\"y\"\n :label=\"yLabel\"\n :grid-line=\"orientation !== Orientation.Horizontal\"\n :domain-line=\"false\"\n :tick-format=\"yFormatter\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","yAxis","computed","key","d","color","_","generateTooltip","app","createApp","Tooltip","container","html","PaginationPositionTop","PaginationPosition"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,UAAMA,IAAQC,GAKRC,IAA+CC,EAAS,MACrDH,EAAM,MAAM,IAAI,CAACI,MAAQ,CAACC,MACxBA,EAAED,CAAG,CACb,CACF,GAEKE,IAAQ,CAACC,GAAM,MAAc,OAAO,OAAOP,EAAM,UAAU,EAAE,CAAC,EAAE,OAEhEQ,IAAkBL,EAAS,MAAM,CAACE,MAAS;AACzC,YAAAI,IAAMC,EAAUC,GAAS;AAAA,QAC7B,MAAMN;AAAA,QACN,YAAYL,EAAM;AAAA,MAAA,CACnB,GAEKY,IAAY,SAAS,cAAc,KAAK;AAC9C,MAAAH,EAAI,MAAMG,CAAS;AAEnB,YAAMC,IAAOD,EAAU;AACvB,aAAAH,EAAI,QAAQ,GAELI;AAAA,IAAA,CACR,GAEKC,IAAwBX;AAAA,MAC5B,MAAMH,EAAM,uBAAuBe,EAAmB;AAAA,IACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,36 @@
1
+ import { BulletLegendItemInterface, Orientation } from '@unovis/ts';
2
+ import { PaginationPosition } from '../..';
3
+
4
+ declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
6
+ data: T[];
7
+ stacked?: boolean;
8
+ height: number;
9
+ xLabel?: string;
10
+ yLabel?: string;
11
+ categories: Record<string, BulletLegendItemInterface>;
12
+ xFormatter: (i: number, idx?: number) => string | number;
13
+ yFormatter?: (i: number, idx?: number) => string | number;
14
+ yNumTicks?: number;
15
+ xNumTicks?: number;
16
+ yAxis: (keyof T)[];
17
+ groupPadding?: number;
18
+ barPadding?: number;
19
+ radius?: number;
20
+ hideLegend?: boolean;
21
+ orientation?: Orientation;
22
+ paginationPosition?: PaginationPosition;
23
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
24
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
25
+ attrs: any;
26
+ slots: ReturnType<() => {}>;
27
+ emit: typeof __VLS_emit;
28
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
+ [key: string]: any;
30
+ }> & {
31
+ __ctx?: Awaited<typeof __VLS_setup>;
32
+ };
33
+ export default _default;
34
+ type __VLS_Prettify<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./BarChart.cjs");exports.default=e.default;
2
+ //# sourceMappingURL=BarChart2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import f from "./BarChart.js";
2
+ export {
3
+ f as default
4
+ };
5
+ //# sourceMappingURL=BarChart2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("@unovis/ts"),o=require("@unovis/vue"),d=require("../Tooltip.cjs"),f={class:"flex items center justify-end"},y=e.defineComponent({__name:"LineChart",props:{data:{},height:{},xLabel:{},yLabel:{},categories:{},xFormatter:{type:Function},yFormatter:{type:Function},curveType:{},yNumTicks:{},xNumTicks:{},paginationPosition:{}},setup(s){const n=s,u=t=>Object.values(n.categories)[t].color,m=e.computed(()=>t=>{const i=e.createApp(d.default,{data:t,categories:n.categories}),r=document.createElement("div");i.mount(r);const a=r.innerHTML;return i.unmount(),a});return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["space-y-4 flex flex-col",{"flex-col-reverse":n.paginationPosition==="top"}])},[e.createVNode(e.unref(o.VisXYContainer),{data:t.data,height:t.height},{default:e.withCtx(()=>[e.createVNode(e.unref(o.VisTooltip),{"horizontal-placement":e.unref(l.Position).Right,"vertical-placement":e.unref(l.Position).Top},null,8,["horizontal-placement","vertical-placement"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(n.categories),(r,a)=>(e.openBlock(),e.createBlock(e.unref(o.VisLine),{key:a,x:(c,p)=>p,y:c=>c[r],color:u(a),"curve-type":t.curveType??e.unref(l.CurveType).MonotoneX},null,8,["x","y","color","curve-type"]))),128)),e.createVNode(e.unref(o.VisAxis),{type:"x","tick-format":t.xFormatter,"num-ticks":t.xNumTicks??4,label:t.xLabel,"label-margin":8,"domain-line":!1,"grid-line":!1},null,8,["tick-format","num-ticks","label"]),e.createVNode(e.unref(o.VisAxis),{type:"y","num-ticks":t.yNumTicks??4,"tick-format":t.yFormatter,label:t.yLabel,"domain-line":!1},null,8,["num-ticks","tick-format","label"]),e.createVNode(e.unref(o.VisCrosshair),{color:"#666",template:m.value},null,8,["template"])]),_:1},8,["data","height"]),e.createElementVNode("div",f,[e.createVNode(e.unref(o.VisBulletLegend),{items:Object.values(t.categories)},null,8,["items"])])],2))}});exports.default=y;
2
+ //# sourceMappingURL=LineChart.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChart.cjs","sources":["../../../src/components/Line/LineChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\n\nimport { CurveType, BulletLegendItemInterface, Position } from \"@unovis/ts\";\n\n\n\nimport {\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisXYContainer,\n VisTooltip,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../..\";\n\ntype LineChartProps<T> = {\n data: T[];\n height: number;\n xLabel?: string;\n yLabel?: string;\n categories: Record<string, BulletLegendItemInterface>;\n xFormatter: (i: number, idx: number) => string;\n yFormatter?: (i: number, idx: number) => string;\n curveType?: CurveType;\n yNumTicks?: number;\n xNumTicks?: number;\n paginationPosition?: PaginationPosition;\n};\n\nconst props = defineProps<LineChartProps<T>>();\n\nconst color = (key: number) => Object.values(props.categories)[key].color;\n\nconst generateTooltip = computed(() => (d: T) => {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n});\n</script>\n\n<template>\n <div\n class=\"space-y-4 flex flex-col\"\n :class=\"{\n 'flex-col-reverse': props.paginationPosition === 'top',\n }\"\n >\n <VisXYContainer :data=\"data\" :height=\"height\">\n <VisTooltip\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"color(iKey)\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n <VisAxis\n type=\"x\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks ?? 4\"\n :label=\"xLabel\"\n :label-margin=\"8\"\n :domain-line=\"false\"\n :grid-line=\"false\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks ?? 4\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :domain-line=\"false\"\n />\n <VisCrosshair color=\"#666\" :template=\"generateTooltip\" />\n </VisXYContainer>\n <div class=\"flex items center justify-end\">\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","color","key","generateTooltip","computed","d","app","createApp","Tooltip","container","html"],"mappings":"0dAiCA,MAAMA,EAAQC,EAERC,EAASC,GAAgB,OAAO,OAAOH,EAAM,UAAU,EAAEG,CAAG,EAAE,MAE9DC,EAAkBC,EAAAA,SAAS,IAAOC,GAAS,CACzC,MAAAC,EAAMC,YAAUC,UAAS,CAC7B,KAAMH,EACN,WAAYN,EAAM,UAAA,CACnB,EAEKU,EAAY,SAAS,cAAc,KAAK,EAC9CH,EAAI,MAAMG,CAAS,EAEnB,MAAMC,EAAOD,EAAU,UACvB,OAAAH,EAAI,QAAQ,EAELI,CAAA,CACR"}
@@ -0,0 +1,85 @@
1
+ import { defineComponent as g, computed as h, createApp as k, createElementBlock as c, openBlock as r, normalizeClass as v, createVNode as o, createElementVNode as b, unref as t, withCtx as T, Fragment as L, renderList as V, createBlock as x } from "vue";
2
+ import { Position as m, CurveType as C } from "@unovis/ts";
3
+ import { VisXYContainer as F, VisTooltip as N, VisLine as j, VisAxis as u, VisCrosshair as B, VisBulletLegend as z } from "@unovis/vue";
4
+ import E from "../Tooltip.js";
5
+ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
6
+ __name: "LineChart",
7
+ props: {
8
+ data: {},
9
+ height: {},
10
+ xLabel: {},
11
+ yLabel: {},
12
+ categories: {},
13
+ xFormatter: { type: Function },
14
+ yFormatter: { type: Function },
15
+ curveType: {},
16
+ yNumTicks: {},
17
+ xNumTicks: {},
18
+ paginationPosition: {}
19
+ },
20
+ setup(p) {
21
+ const a = p, d = (e) => Object.values(a.categories)[e].color, f = h(() => (e) => {
22
+ const l = k(E, {
23
+ data: e,
24
+ categories: a.categories
25
+ }), i = document.createElement("div");
26
+ l.mount(i);
27
+ const n = i.innerHTML;
28
+ return l.unmount(), n;
29
+ });
30
+ return (e, l) => (r(), c("div", {
31
+ class: v(["space-y-4 flex flex-col", {
32
+ "flex-col-reverse": a.paginationPosition === "top"
33
+ }])
34
+ }, [
35
+ o(t(F), {
36
+ data: e.data,
37
+ height: e.height
38
+ }, {
39
+ default: T(() => [
40
+ o(t(N), {
41
+ "horizontal-placement": t(m).Right,
42
+ "vertical-placement": t(m).Top
43
+ }, null, 8, ["horizontal-placement", "vertical-placement"]),
44
+ (r(!0), c(L, null, V(Object.keys(a.categories), (i, n) => (r(), x(t(j), {
45
+ key: n,
46
+ x: (s, y) => y,
47
+ y: (s) => s[i],
48
+ color: d(n),
49
+ "curve-type": e.curveType ?? t(C).MonotoneX
50
+ }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
51
+ o(t(u), {
52
+ type: "x",
53
+ "tick-format": e.xFormatter,
54
+ "num-ticks": e.xNumTicks ?? 4,
55
+ label: e.xLabel,
56
+ "label-margin": 8,
57
+ "domain-line": !1,
58
+ "grid-line": !1
59
+ }, null, 8, ["tick-format", "num-ticks", "label"]),
60
+ o(t(u), {
61
+ type: "y",
62
+ "num-ticks": e.yNumTicks ?? 4,
63
+ "tick-format": e.yFormatter,
64
+ label: e.yLabel,
65
+ "domain-line": !1
66
+ }, null, 8, ["num-ticks", "tick-format", "label"]),
67
+ o(t(B), {
68
+ color: "#666",
69
+ template: f.value
70
+ }, null, 8, ["template"])
71
+ ]),
72
+ _: 1
73
+ }, 8, ["data", "height"]),
74
+ b("div", O, [
75
+ o(t(z), {
76
+ items: Object.values(e.categories)
77
+ }, null, 8, ["items"])
78
+ ])
79
+ ], 2));
80
+ }
81
+ });
82
+ export {
83
+ _ as default
84
+ };
85
+ //# sourceMappingURL=LineChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChart.js","sources":["../../../src/components/Line/LineChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\n\nimport { CurveType, BulletLegendItemInterface, Position } from \"@unovis/ts\";\n\n\n\nimport {\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisXYContainer,\n VisTooltip,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../..\";\n\ntype LineChartProps<T> = {\n data: T[];\n height: number;\n xLabel?: string;\n yLabel?: string;\n categories: Record<string, BulletLegendItemInterface>;\n xFormatter: (i: number, idx: number) => string;\n yFormatter?: (i: number, idx: number) => string;\n curveType?: CurveType;\n yNumTicks?: number;\n xNumTicks?: number;\n paginationPosition?: PaginationPosition;\n};\n\nconst props = defineProps<LineChartProps<T>>();\n\nconst color = (key: number) => Object.values(props.categories)[key].color;\n\nconst generateTooltip = computed(() => (d: T) => {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n});\n</script>\n\n<template>\n <div\n class=\"space-y-4 flex flex-col\"\n :class=\"{\n 'flex-col-reverse': props.paginationPosition === 'top',\n }\"\n >\n <VisXYContainer :data=\"data\" :height=\"height\">\n <VisTooltip\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"color(iKey)\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n <VisAxis\n type=\"x\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks ?? 4\"\n :label=\"xLabel\"\n :label-margin=\"8\"\n :domain-line=\"false\"\n :grid-line=\"false\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks ?? 4\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :domain-line=\"false\"\n />\n <VisCrosshair color=\"#666\" :template=\"generateTooltip\" />\n </VisXYContainer>\n <div class=\"flex items center justify-end\">\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","color","key","generateTooltip","computed","d","app","createApp","Tooltip","container","html"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,UAAMA,IAAQC,GAERC,IAAQ,CAACC,MAAgB,OAAO,OAAOH,EAAM,UAAU,EAAEG,CAAG,EAAE,OAE9DC,IAAkBC,EAAS,MAAM,CAACC,MAAS;AACzC,YAAAC,IAAMC,EAAUC,GAAS;AAAA,QAC7B,MAAMH;AAAA,QACN,YAAYN,EAAM;AAAA,MAAA,CACnB,GAEKU,IAAY,SAAS,cAAc,KAAK;AAC9C,MAAAH,EAAI,MAAMG,CAAS;AAEnB,YAAMC,IAAOD,EAAU;AACvB,aAAAH,EAAI,QAAQ,GAELI;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,27 @@
1
+ import { CurveType, BulletLegendItemInterface } from '@unovis/ts';
2
+ import { PaginationPosition } from '../..';
3
+
4
+ declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
6
+ data: T[];
7
+ height: number;
8
+ xLabel?: string;
9
+ yLabel?: string;
10
+ categories: Record<string, BulletLegendItemInterface>;
11
+ xFormatter: (i: number, idx: number) => string;
12
+ yFormatter?: (i: number, idx: number) => string;
13
+ curveType?: CurveType;
14
+ yNumTicks?: number;
15
+ xNumTicks?: number;
16
+ paginationPosition?: PaginationPosition;
17
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
18
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
19
+ attrs: any;
20
+ slots: ReturnType<() => {}>;
21
+ emit: typeof __VLS_emit;
22
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
23
+ [key: string]: any;
24
+ }> & {
25
+ __ctx?: Awaited<typeof __VLS_setup>;
26
+ };
27
+ export default _default;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./LineChart.cjs");exports.default=e.default;
2
+ //# sourceMappingURL=LineChart2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChart2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import f from "./LineChart.js";
2
+ export {
3
+ f as default
4
+ };
5
+ //# sourceMappingURL=LineChart2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChart2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,4 +1,6 @@
1
1
  export * from './components/Area';
2
2
  export * from './components/AreaStacked';
3
+ export * from './components/Line';
4
+ export * from './components/Bar';
3
5
  export * from './components/Donut';
4
6
  export * from './components/Crosshair';
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./components/Area/AreaChart.cjs"),u=require("./components/AreaStacked/AreaStackedChart.cjs"),_=require("./components/Donut/DonutChart.cjs"),a=require("./components/Crosshair/Crosshair.cjs");var t=(e=>(e.Top="top",e.Bottom="bottom",e))(t||{});exports.AreaChart=r.default;exports.AreaStackedChart=u.default;exports.DonutChart=_.default;exports.Crosshair=a.default;exports.PaginationPosition=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./components/Area/AreaChart.cjs"),u=require("./components/AreaStacked/AreaStackedChart.cjs"),_=require("./components/Line/LineChart.cjs"),a=require("./components/Bar/BarChart.cjs"),s=require("./components/Donut/DonutChart.cjs"),p=require("./components/Crosshair/Crosshair.cjs");var t=(e=>(e.Top="top",e.Bottom="bottom",e))(t||{});exports.AreaChart=r.default;exports.AreaStackedChart=u.default;exports.LineChart=_.default;exports.BarChart=a.default;exports.DonutChart=s.default;exports.Crosshair=p.default;exports.PaginationPosition=t;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n}\n"],"names":["PaginationPosition"],"mappings":"+RACY,IAAAA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,OAAS,SAFCA,IAAAA,GAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n}\n"],"names":["PaginationPosition"],"mappings":"uXACY,IAAAA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,OAAS,SAFCA,IAAAA,GAAA,CAAA,CAAA"}
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
- import { default as e } from "./components/Area/AreaChart.js";
1
+ import { default as o } from "./components/Area/AreaChart.js";
2
2
  import { default as p } from "./components/AreaStacked/AreaStackedChart.js";
3
- import { default as u } from "./components/Donut/DonutChart.js";
4
- import { default as s } from "./components/Crosshair/Crosshair.js";
3
+ import { default as u } from "./components/Line/LineChart.js";
4
+ import { default as s } from "./components/Bar/BarChart.js";
5
+ import { default as h } from "./components/Donut/DonutChart.js";
6
+ import { default as C } from "./components/Crosshair/Crosshair.js";
5
7
  var t = /* @__PURE__ */ ((r) => (r.Top = "top", r.Bottom = "bottom", r))(t || {});
6
8
  export {
7
- e as AreaChart,
9
+ o as AreaChart,
8
10
  p as AreaStackedChart,
9
- s as Crosshair,
10
- u as DonutChart,
11
+ s as BarChart,
12
+ C as Crosshair,
13
+ h as DonutChart,
14
+ u as LineChart,
11
15
  t as PaginationPosition
12
16
  };
13
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n}\n"],"names":["PaginationPosition"],"mappings":";;;;AACY,IAAAA,sBAAAA,OACVA,EAAA,MAAM,OACNA,EAAA,SAAS,UAFCA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n}\n"],"names":["PaginationPosition"],"mappings":";;;;;;AACY,IAAAA,sBAAAA,OACVA,EAAA,MAAM,OACNA,EAAA,SAAS,UAFCA,IAAAA,KAAA,CAAA,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.0.137",
3
+ "version": "0.0.139",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"