vue-chrts 0.0.156 → 0.0.158

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 (64) hide show
  1. package/dist/components/Area/types.d.ts +84 -0
  2. package/dist/components/Line/LineChart.cjs +1 -1
  3. package/dist/components/Line/LineChart.cjs.map +1 -1
  4. package/dist/components/Line/LineChart.js +28 -22
  5. package/dist/components/Line/LineChart.js.map +1 -1
  6. package/dist/components/Tooltip.cjs +1 -1
  7. package/dist/components/Tooltip.cjs.map +1 -1
  8. package/dist/components/Tooltip.js +29 -12
  9. package/dist/components/Tooltip.js.map +1 -1
  10. package/dist/components/Tooltip.vue.d.ts +3 -0
  11. package/dist/components.d.ts +0 -5
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.js +2 -12
  14. package/dist/index.js.map +1 -1
  15. package/package.json +19 -13
  16. package/dist/components/Area/AreaChart.cjs +0 -7
  17. package/dist/components/Area/AreaChart.cjs.map +0 -1
  18. package/dist/components/Area/AreaChart.js +0 -123
  19. package/dist/components/Area/AreaChart.js.map +0 -1
  20. package/dist/components/Area/AreaChart.vue.d.ts +0 -36
  21. package/dist/components/Area/AreaChart2.cjs +0 -2
  22. package/dist/components/Area/AreaChart2.cjs.map +0 -1
  23. package/dist/components/Area/AreaChart2.js +0 -5
  24. package/dist/components/Area/AreaChart2.js.map +0 -1
  25. package/dist/components/AreaStacked/AreaStackedChart.cjs +0 -2
  26. package/dist/components/AreaStacked/AreaStackedChart.cjs.map +0 -1
  27. package/dist/components/AreaStacked/AreaStackedChart.js +0 -51
  28. package/dist/components/AreaStacked/AreaStackedChart.js.map +0 -1
  29. package/dist/components/AreaStacked/AreaStackedChart.vue.d.ts +0 -18
  30. package/dist/components/AreaStacked/AreaStackedChart2.cjs +0 -2
  31. package/dist/components/AreaStacked/AreaStackedChart2.cjs.map +0 -1
  32. package/dist/components/AreaStacked/AreaStackedChart2.js +0 -5
  33. package/dist/components/AreaStacked/AreaStackedChart2.js.map +0 -1
  34. package/dist/components/Bar/BarChart.cjs +0 -2
  35. package/dist/components/Bar/BarChart.cjs.map +0 -1
  36. package/dist/components/Bar/BarChart.js +0 -107
  37. package/dist/components/Bar/BarChart.js.map +0 -1
  38. package/dist/components/Bar/BarChart.vue.d.ts +0 -36
  39. package/dist/components/Bar/BarChart2.cjs +0 -2
  40. package/dist/components/Bar/BarChart2.cjs.map +0 -1
  41. package/dist/components/Bar/BarChart2.js +0 -5
  42. package/dist/components/Bar/BarChart2.js.map +0 -1
  43. package/dist/components/Crosshair/Crosshair.cjs +0 -2
  44. package/dist/components/Crosshair/Crosshair.cjs.map +0 -1
  45. package/dist/components/Crosshair/Crosshair.js +0 -40
  46. package/dist/components/Crosshair/Crosshair.js.map +0 -1
  47. package/dist/components/Crosshair/Crosshair.vue.d.ts +0 -38
  48. package/dist/components/Crosshair/Crosshair2.cjs +0 -2
  49. package/dist/components/Crosshair/Crosshair2.cjs.map +0 -1
  50. package/dist/components/Crosshair/Crosshair2.js +0 -5
  51. package/dist/components/Crosshair/Crosshair2.js.map +0 -1
  52. package/dist/components/Donut/DonutChart.cjs +0 -6
  53. package/dist/components/Donut/DonutChart.cjs.map +0 -1
  54. package/dist/components/Donut/DonutChart.js +0 -59
  55. package/dist/components/Donut/DonutChart.js.map +0 -1
  56. package/dist/components/Donut/DonutChart.vue.d.ts +0 -31
  57. package/dist/components/Donut/DonutChart2.cjs +0 -2
  58. package/dist/components/Donut/DonutChart2.cjs.map +0 -1
  59. package/dist/components/Donut/DonutChart2.js +0 -5
  60. package/dist/components/Donut/DonutChart2.js.map +0 -1
  61. package/dist/types.cjs +0 -2
  62. package/dist/types.cjs.map +0 -1
  63. package/dist/types.js +0 -5
  64. package/dist/types.js.map +0 -1
@@ -0,0 +1,84 @@
1
+ import { PaginationPosition } from '../../types';
2
+ import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
3
+
4
+ export type AreaChartProps<T> = {
5
+ /**
6
+ * The data to be displayed in the area chart.
7
+ * Each element of the array represents a data point.
8
+ * The structure of 'T' should be compatible with the chart's rendering logic.
9
+ */
10
+ data: T[];
11
+ /**
12
+ * The height of the chart in pixels.
13
+ */
14
+ height: number;
15
+ /**
16
+ * Optional label for the x-axis.
17
+ */
18
+ xLabel?: string;
19
+ /**
20
+ * Optional label for the y-axis.
21
+ */
22
+ yLabel?: string;
23
+ /**
24
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
25
+ * This defines the visual representation and labels for each category in the chart's legend.
26
+ */
27
+ categories: Record<string, BulletLegendItemInterface>;
28
+ /**
29
+ * A function that formats the x-axis tick labels.
30
+ * @param i The value to be formatted.
31
+ * @param idx The index of the data point.
32
+ * @returns The formatted x-axis label.
33
+ */
34
+ xFormatter: (i: number, idx: number) => string;
35
+ /**
36
+ * An optional function that formats the y-axis tick labels.
37
+ * @param i The value to be formatted.
38
+ * @param idx The index of the data point (optional).
39
+ * @returns The formatted y-axis label or value.
40
+ */
41
+ yFormatter?: (i: number, idx?: number) => string | number;
42
+ /**
43
+ * The type of curve to use for the area chart lines.
44
+ * See `CurveType` for available options.
45
+ */
46
+ curveType?: CurveType;
47
+ /**
48
+ * The desired number of ticks on the x-axis.
49
+ */
50
+ xNumTicks?: number;
51
+ /**
52
+ * The desired number of ticks on the y-axis.
53
+ */
54
+ yNumTicks?: number;
55
+ /**
56
+ * If `true`, hides the chart legend.
57
+ */
58
+ hideLegend?: boolean;
59
+ /**
60
+ * If `true`, hides the chart tooltip.
61
+ */
62
+ hideTooltip?: boolean;
63
+ /**
64
+ * If `true`, displays grid lines along the x-axis.
65
+ */
66
+ gridLineX?: boolean;
67
+ /**
68
+ * If `true`, displays a domain line (axis line) along the x-axis.
69
+ */
70
+ domainLineX?: boolean;
71
+ /**
72
+ * If `true`, displays grid lines along the y-axis.
73
+ */
74
+ gridLineY?: boolean;
75
+ /**
76
+ * If `true`, displays a domain line (axis line) along the y-axis.
77
+ */
78
+ domainLineY?: boolean;
79
+ /**
80
+ * Optional position for pagination controls, if applicable.
81
+ * See `PaginationPosition` for available options.
82
+ */
83
+ paginationPoisition?: PaginationPosition;
84
+ };
@@ -1,2 +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;
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=>{if(typeof window>"u"||typeof document>"u")return"";try{const r=e.createApp(d.default,{data:t,categories:n.categories}),a=document.createElement("div");r.mount(a);const i=a.innerHTML;return r.unmount(),i}catch{return""}});return(t,r)=>(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),(a,i)=>(e.openBlock(),e.createBlock(e.unref(o.VisLine),{key:i,x:(c,p)=>p,y:c=>c[a],color:u(i),"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
2
  //# sourceMappingURL=LineChart.cjs.map
@@ -1 +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 \"../../types\";\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"}
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\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 \"../../types\";\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 if (typeof window === 'undefined' || typeof document === 'undefined') {\n return '';\n }\n \n try {\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 } catch (error) {\n return '';\n }\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":"0dA+BA,MAAMA,EAAQC,EAERC,EAASC,GAAgB,OAAO,OAAOH,EAAM,UAAU,EAAEG,CAAG,EAAE,MAE9DC,EAAkBC,EAAAA,SAAS,IAAOC,GAAS,CAC/C,GAAI,OAAO,OAAW,KAAe,OAAO,SAAa,IAChD,MAAA,GAGL,GAAA,CACI,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,OACO,CACP,MAAA,EAAA,CACT,CACD"}
@@ -1,8 +1,8 @@
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";
1
+ import { defineComponent as g, computed as h, createApp as k, createElementBlock as s, openBlock as l, 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
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({
3
+ import { VisXYContainer as F, VisTooltip as N, VisLine as j, VisAxis as u, VisCrosshair as B, VisBulletLegend as w } from "@unovis/vue";
4
+ import z from "../Tooltip.js";
5
+ const E = { class: "flex items center justify-end" }, X = /* @__PURE__ */ g({
6
6
  __name: "LineChart",
7
7
  props: {
8
8
  data: {},
@@ -18,18 +18,24 @@ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
18
18
  paginationPosition: {}
19
19
  },
20
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;
21
+ const n = p, d = (e) => Object.values(n.categories)[e].color, f = h(() => (e) => {
22
+ if (typeof window > "u" || typeof document > "u")
23
+ return "";
24
+ try {
25
+ const r = k(z, {
26
+ data: e,
27
+ categories: n.categories
28
+ }), a = document.createElement("div");
29
+ r.mount(a);
30
+ const i = a.innerHTML;
31
+ return r.unmount(), i;
32
+ } catch {
33
+ return "";
34
+ }
29
35
  });
30
- return (e, l) => (r(), c("div", {
36
+ return (e, r) => (l(), s("div", {
31
37
  class: v(["space-y-4 flex flex-col", {
32
- "flex-col-reverse": a.paginationPosition === "top"
38
+ "flex-col-reverse": n.paginationPosition === "top"
33
39
  }])
34
40
  }, [
35
41
  o(t(F), {
@@ -41,11 +47,11 @@ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
41
47
  "horizontal-placement": t(m).Right,
42
48
  "vertical-placement": t(m).Top
43
49
  }, 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),
50
+ (l(!0), s(L, null, V(Object.keys(n.categories), (a, i) => (l(), x(t(j), {
51
+ key: i,
52
+ x: (c, y) => y,
53
+ y: (c) => c[a],
54
+ color: d(i),
49
55
  "curve-type": e.curveType ?? t(C).MonotoneX
50
56
  }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
51
57
  o(t(u), {
@@ -71,8 +77,8 @@ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
71
77
  ]),
72
78
  _: 1
73
79
  }, 8, ["data", "height"]),
74
- b("div", O, [
75
- o(t(z), {
80
+ b("div", E, [
81
+ o(t(w), {
76
82
  items: Object.values(e.categories)
77
83
  }, null, 8, ["items"])
78
84
  ])
@@ -80,6 +86,6 @@ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
80
86
  }
81
87
  });
82
88
  export {
83
- _ as default
89
+ X as default
84
90
  };
85
91
  //# sourceMappingURL=LineChart.js.map
@@ -1 +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 \"../../types\";\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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\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 \"../../types\";\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 if (typeof window === 'undefined' || typeof document === 'undefined') {\n return '';\n }\n \n try {\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 } catch (error) {\n return '';\n }\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":";;;;;;;;;;;;;;;;;;;;AA+BA,UAAMA,IAAQC,GAERC,IAAQ,CAACC,MAAgB,OAAO,OAAOH,EAAM,UAAU,EAAEG,CAAG,EAAE,OAE9DC,IAAkBC,EAAS,MAAM,CAACC,MAAS;AAC/C,UAAI,OAAO,SAAW,OAAe,OAAO,WAAa;AAChD,eAAA;AAGL,UAAA;AACI,cAAAC,IAAMC,EAAUC,GAAS;AAAA,UAC7B,MAAMH;AAAA,UACN,YAAYN,EAAM;AAAA,QAAA,CACnB,GAEKU,IAAY,SAAS,cAAc,KAAK;AAC9C,QAAAH,EAAI,MAAMG,CAAS;AAEnB,cAAMC,IAAOD,EAAU;AACvB,eAAAH,EAAI,QAAQ,GAELI;AAAA,cACO;AACP,eAAA;AAAA,MAAA;AAAA,IACT,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l={class:"flex flex-col"},s={class:"flex items-center mr-2 mt-2"},r={class:"font-semibold capitalize text-white/75"},c={class:"font-normal"},a=e.defineComponent({__name:"Tooltip",props:{data:{}},setup(i){return(o,d)=>(e.openBlock(),e.createElementBlock("div",l,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.entries(o.data),([t,n])=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t},[e.createElementVNode("div",s,[e.createElementVNode("span",r,e.toDisplayString(t)+":",1)]),e.createElementVNode("span",c,e.toDisplayString(n),1)],64))),128))]))}});exports.default=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=e.defineComponent({__name:"Tooltip",props:{data:{},categories:{}},setup(r){const l=r,n=["_index","_stacked","_ending"],i=e.computed(()=>Object.entries(l.data).filter(([o,a])=>{var t;return!n.includes(o)&&((t=l.categories[o])==null?void 0:t.color)}));return(o,a)=>(e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,([t,c])=>(e.openBlock(),e.createElementBlock("div",{key:t,style:{display:"flex","align-items":"center","margin-bottom":"4px"}},[e.createElementVNode("span",{style:e.normalizeStyle([{width:"8px",height:"8px","border-radius":"4px","margin-right":"8px"},{backgroundColor:o.categories[t].color}])},null,4),e.createElementVNode("div",null,[e.createElementVNode("span",{style:e.normalizeStyle([{"font-weight":"600","margin-right":"8px"},{color:"var(--tooltip-label-color)"}])},e.toDisplayString(t)+":",1),e.createElementVNode("span",{style:e.normalizeStyle([{"font-weight":"400"},{color:"var(--tooltip-value-color)"}])},e.toDisplayString(c),1)])]))),128))]))}});exports.default=s;
2
2
  //# sourceMappingURL=Tooltip.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"Tooltip.cjs","sources":["../../src/components/Tooltip.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T\">\nimport { BulletLegendItemInterface } from \"@unovis/ts\";\nimport { computed } from \"vue\";\n\nconst props = defineProps<{\n data: T;\n categories: Record<string, BulletLegendItemInterface>;\n}>();\n\nconst keyBlockList = [\"_index\", \"_stacked\", \"_ending\"];\n\nconst visibleEntries = computed(() => {\n return Object.entries(props.data).filter(\n ([key, _]) => !keyBlockList.includes(key) && props.categories[key]?.color\n );\n});\n</script>\n\n<template>\n <div>\n <div v-for=\"[key, value] in visibleEntries\" :key=\"key\" style=\"display: flex; align-items: center; margin-bottom: 4px;\">\n <span\n style=\"width: 8px; height: 8px; border-radius: 4px; margin-right: 8px;\"\n :style=\"{ backgroundColor: categories[key].color }\"\n ></span>\n <div>\n <span style=\"font-weight: 600; margin-right: 8px;\" :style=\"{ color: 'var(--tooltip-label-color)' }\">{{ key }}:</span>\n <span style=\"font-weight: 400;\" :style=\"{ color: 'var(--tooltip-value-color)' }\">{{ value }}</span>\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","keyBlockList","visibleEntries","computed","key","_","_a"],"mappings":"gNAIA,MAAMA,EAAQC,EAKRC,EAAe,CAAC,SAAU,WAAY,SAAS,EAE/CC,EAAiBC,EAAAA,SAAS,IACvB,OAAO,QAAQJ,EAAM,IAAI,EAAE,OAChC,CAAC,CAACK,EAAKC,CAAC,IAAM,OAAA,OAACJ,EAAa,SAASG,CAAG,KAAKE,EAAAP,EAAM,WAAWK,CAAG,IAApB,YAAAE,EAAuB,OACtE,CACD"}
@@ -1,21 +1,38 @@
1
- import { defineComponent as l, createElementBlock as e, openBlock as t, Fragment as n, renderList as i, createElementVNode as s, toDisplayString as a } from "vue";
2
- const _ = { class: "flex flex-col" }, p = { class: "flex items-center mr-2 mt-2" }, d = { class: "font-semibold capitalize text-white/75" }, m = { class: "font-normal" }, x = /* @__PURE__ */ l({
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
3
  __name: "Tooltip",
4
4
  props: {
5
- data: {}
5
+ data: {},
6
+ categories: {}
6
7
  },
7
- setup(f) {
8
- return (r, u) => (t(), e("div", _, [
9
- (t(!0), e(n, null, i(Object.entries(r.data), ([o, c]) => (t(), e(n, { key: o }, [
10
- s("div", p, [
11
- s("span", d, a(o) + ":", 1)
12
- ]),
13
- s("span", m, a(c), 1)
14
- ], 64))), 128))
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))
15
32
  ]));
16
33
  }
17
34
  });
18
35
  export {
19
- x as default
36
+ h as default
20
37
  };
21
38
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../src/components/Tooltip.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T\">\nimport { BulletLegendItemInterface } from \"@unovis/ts\";\nimport { computed } from \"vue\";\n\nconst props = defineProps<{\n data: T;\n categories: Record<string, BulletLegendItemInterface>;\n}>();\n\nconst keyBlockList = [\"_index\", \"_stacked\", \"_ending\"];\n\nconst visibleEntries = computed(() => {\n return Object.entries(props.data).filter(\n ([key, _]) => !keyBlockList.includes(key) && props.categories[key]?.color\n );\n});\n</script>\n\n<template>\n <div>\n <div v-for=\"[key, value] in visibleEntries\" :key=\"key\" style=\"display: flex; align-items: center; margin-bottom: 4px;\">\n <span\n style=\"width: 8px; height: 8px; border-radius: 4px; margin-right: 8px;\"\n :style=\"{ backgroundColor: categories[key].color }\"\n ></span>\n <div>\n <span style=\"font-weight: 600; margin-right: 8px;\" :style=\"{ color: 'var(--tooltip-label-color)' }\">{{ key }}:</span>\n <span style=\"font-weight: 400;\" :style=\"{ color: 'var(--tooltip-value-color)' }\">{{ value }}</span>\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","keyBlockList","visibleEntries","computed","key","_","_a"],"mappings":";;;;;;;;AAIA,UAAMA,IAAQC,GAKRC,IAAe,CAAC,UAAU,YAAY,SAAS,GAE/CC,IAAiBC,EAAS,MACvB,OAAO,QAAQJ,EAAM,IAAI,EAAE;AAAA,MAChC,CAAC,CAACK,GAAKC,CAAC,MAAM;;AAAA,gBAACJ,EAAa,SAASG,CAAG,OAAKE,IAAAP,EAAM,WAAWK,CAAG,MAApB,gBAAAE,EAAuB;AAAA;AAAA,IACtE,CACD;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,9 @@
1
+ import { BulletLegendItemInterface } from '@unovis/ts';
2
+
1
3
  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<{
2
4
  props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
3
5
  data: T;
6
+ categories: Record<string, BulletLegendItemInterface>;
4
7
  }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
5
8
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
6
9
  attrs: any;
@@ -1,6 +1 @@
1
- export * from './components/Area';
2
- export * from './components/AreaStacked';
3
1
  export * from './components/Line';
4
- export * from './components/Bar';
5
- export * from './components/Donut';
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 e=require("./components/Area/AreaChart.cjs"),t=require("./components/AreaStacked/AreaStackedChart.cjs"),r=require("./components/Line/LineChart.cjs"),_=require("./components/Bar/BarChart.cjs"),u=require("./components/Donut/DonutChart.cjs"),a=require("./components/Crosshair/Crosshair.cjs");exports.AreaChart=e.default;exports.AreaStackedChart=t.default;exports.LineChart=r.default;exports.BarChart=_.default;exports.DonutChart=u.default;exports.Crosshair=a.default;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./components/Line/LineChart.cjs");exports.LineChart=e.default;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,15 +1,5 @@
1
- import { default as t } from "./components/Area/AreaChart.js";
2
- import { default as o } from "./components/AreaStacked/AreaStackedChart.js";
3
- import { default as s } from "./components/Line/LineChart.js";
4
- import { default as u } from "./components/Bar/BarChart.js";
5
- import { default as l } from "./components/Donut/DonutChart.js";
6
- import { default as p } from "./components/Crosshair/Crosshair.js";
1
+ import { default as r } from "./components/Line/LineChart.js";
7
2
  export {
8
- t as AreaChart,
9
- o as AreaStackedChart,
10
- u as BarChart,
11
- p as Crosshair,
12
- l as DonutChart,
13
- s as LineChart
3
+ r as LineChart
14
4
  };
15
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.0.156",
3
+ "version": "0.0.158",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -30,28 +30,34 @@
30
30
  "deploy": "pnpm build && npm publish"
31
31
  },
32
32
  "dependencies": {
33
- "@tailwindcss/vite": "^4.0.9",
34
- "@tanstack/vue-table": "^8.21.2",
35
- "@unhead/vue": "^1.11.18",
36
- "@vueuse/core": "^12.6.1",
37
- "d3": "^7.8.5",
38
- "tailwindcss": "^4.0.9",
39
- "vue": "^3.5.13",
40
- "vue-router": "^4.5.0"
33
+ "vue": "^3.5.13"
34
+ },
35
+ "peerDependencies": {
36
+ "@unovis/ts": "^1.5.1",
37
+ "@unovis/vue": "^1.5.1",
38
+ "@vueuse/core": "^12.0.0",
39
+ "d3": "^7.0.0",
40
+ "tailwindcss": "^4.0.0",
41
+ "vue": "^3.0.0",
42
+ "vue-router": "^4.0.0"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@rollup/plugin-node-resolve": "^13.0.4",
44
46
  "rollup-plugin-commonjs": "^10.1.0",
45
47
  "rollup-plugin-typescript2": "^0.31.1",
48
+ "@tailwindcss/vite": "^4.0.9",
49
+ "@tanstack/vue-table": "^8.21.2",
50
+ "@unhead/vue": "^1.11.18",
46
51
  "@types/d3": "^7.4.0",
47
- "@unovis/ts": "^1.5.0",
48
- "@unovis/vue": "^1.5.0",
49
52
  "@vitejs/plugin-vue": "^5.2.1",
50
53
  "@vue/tsconfig": "^0.7.0",
54
+ "@vueuse/core": "^12.6.1",
55
+ "d3": "^7.8.5",
56
+ "tailwindcss": "^4.0.9",
51
57
  "typescript": "~5.6.2",
52
58
  "vite": "^6.0.5",
53
59
  "vite-plugin-dts": "^3.9.1",
60
+ "vue-router": "^4.5.0",
54
61
  "vue-tsc": "^2.2.0"
55
- },
56
- "packageManager": "pnpm@9.13.2+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a"
62
+ }
57
63
  }
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("@unovis/ts"),n=require("@unovis/vue"),f=require("../Tooltip.cjs"),y={key:0,class:"flex items center justify-end"},k=e.defineComponent({__name:"AreaChart",props:{data:{},height:{},xLabel:{},yLabel:{},categories:{},xFormatter:{},yFormatter:{},curveType:{},xNumTicks:{default:r=>r.data.length>24?24/4:r.data.length-1},yNumTicks:{default:r=>r.data.length>24?24/4:r.data.length-1},hideLegend:{type:Boolean},hideTooltip:{type:Boolean},gridLineX:{type:Boolean},domainLineX:{type:Boolean},gridLineY:{type:Boolean},domainLineY:{type:Boolean},paginationPoisition:{}},setup(r){const l=r,s=Object.values(l.categories).map(t=>t.color),p=e.computed(()=>t=>{const o=e.createApp(f.default,{data:t,categories:l.categories}),i=document.createElement("div");o.mount(i);const a=i.innerHTML;return o.unmount(),a});function m(t){var o;return{y:i=>Number(i[t]),color:((o=l.categories[t])==null?void 0:o.color)??"#3b82f6"}}const g=s.map((t,o)=>`
2
- <linearGradient id="gradient${o}-${t}" gradientTransform="rotate(90)">
3
- <stop offset="0%" stop-color="${t}" stop-opacity="1" />
4
- <stop offset="100%" stop-color="${t}" stop-opacity="0" />
5
- </linearGradient>
6
- `).join("");return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col space-y-4",{"flex-col-reverse":l.paginationPoisition==="top"}])},[e.createVNode(e.unref(n.VisXYContainer),{data:t.data,height:t.height,"svg-defs":e.unref(g)},{default:e.withCtx(()=>[t.hideTooltip?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.VisTooltip),{key:0,"horizontal-placement":e.unref(c.Position).Right,"vertical-placement":e.unref(c.Position).Top},null,8,["horizontal-placement","vertical-placement"])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(l.categories),(i,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a},[e.createVNode(e.unref(n.VisArea),e.mergeProps({x:(u,d)=>d,ref_for:!0},m(i),{color:`url(#gradient${a}-${e.unref(s)[a]})`,opacity:.5,"curve-type":t.curveType??e.unref(c.CurveType).MonotoneX}),null,16,["x","color","curve-type"]),e.createVNode(e.unref(n.VisLine),{x:(u,d)=>d,y:u=>u[i],color:e.unref(s)[a],"curve-type":t.curveType??e.unref(c.CurveType).MonotoneX},null,8,["x","y","color","curve-type"])],64))),128)),e.createVNode(e.unref(n.VisAxis),{type:"x","tick-format":t.xFormatter,"num-ticks":t.xNumTicks,label:t.xLabel,"grid-line":t.gridLineX,"domain-line":t.domainLineX,"tick-line":!!t.gridLineX},null,8,["tick-format","num-ticks","label","grid-line","domain-line","tick-line"]),e.createVNode(e.unref(n.VisAxis),{type:"y","num-ticks":t.yNumTicks??t.data.length,"tick-format":t.yFormatter,label:t.yLabel,"grid-line":t.gridLineY,"domain-line":t.domainLineY,"tick-line":!!t.gridLineY},null,8,["num-ticks","tick-format","label","grid-line","domain-line","tick-line"]),t.hideTooltip?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.VisCrosshair),{key:1,color:"#666",template:p.value},null,8,["template"]))]),_:1},8,["data","height","svg-defs"]),t.hideLegend?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",y,[e.createVNode(e.unref(n.VisBulletLegend),{items:Object.values(t.categories)},null,8,["items"])]))],2))}});exports.default=k;
7
- //# sourceMappingURL=AreaChart.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AreaChart.cjs","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport type { BulletLegendItemInterface, NumericAccessor } from \"@unovis/ts\";\nimport { CurveType, Position } from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\n\ntype AreaChartProps<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 | number;\n curveType?: CurveType;\n xNumTicks?: number;\n yNumTicks?: number;\n hideLegend?: boolean;\n hideTooltip?: boolean;\n gridLineX?: boolean;\n domainLineX?: boolean;\n gridLineY?: boolean;\n domainLineY?: boolean;\n paginationPoisition?: PaginationPosition;\n};\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.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\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{\n 'flex-col-reverse': props.paginationPoisition === 'top',\n }\"\n >\n <VisXYContainer :data=\"data\" :height=\"height\" :svg-defs=\"svgDefs\">\n <VisTooltip\n v-if=\"!hideTooltip\"\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 <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks ?? data.length\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div v-if=\"!hideLegend\" class=\"flex items center justify-end\">\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index"],"mappings":"osBAqCA,MAAMA,EAAQC,EAORC,EAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAKG,GAAMA,EAAE,KAAK,EAE3DC,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,EAED,SAASC,EAAUC,EAAsD,OAChE,MAAA,CACL,EAAIP,GAAS,OAAOA,EAAEO,CAAoB,CAAC,EAC3C,QAAOC,EAAAd,EAAM,WAAWa,CAAE,IAAnB,YAAAC,EAAsB,QAAS,SACxC,CAAA,CAGF,MAAMC,EAAUb,EACb,IACC,CAACc,EAAOC,IAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA,CAAA,EAIxC,KAAK,EAAE"}
@@ -1,123 +0,0 @@
1
- import { defineComponent as b, computed as B, createApp as V, createElementBlock as c, openBlock as r, normalizeClass as C, createVNode as l, createCommentVNode as u, unref as t, withCtx as X, createBlock as g, Fragment as f, renderList as N, mergeProps as $ } from "vue";
2
- import { Position as y, CurveType as h } from "@unovis/ts";
3
- import { VisXYContainer as Y, VisTooltip as j, VisArea as F, VisLine as A, VisAxis as k, VisCrosshair as P, VisBulletLegend as z } from "@unovis/vue";
4
- import M from "../Tooltip.js";
5
- const O = {
6
- key: 0,
7
- class: "flex items center justify-end"
8
- }, H = /* @__PURE__ */ b({
9
- __name: "AreaChart",
10
- props: {
11
- data: {},
12
- height: {},
13
- xLabel: {},
14
- yLabel: {},
15
- categories: {},
16
- xFormatter: {},
17
- yFormatter: {},
18
- curveType: {},
19
- xNumTicks: { default: (i) => i.data.length > 24 ? 24 / 4 : i.data.length - 1 },
20
- yNumTicks: { default: (i) => i.data.length > 24 ? 24 / 4 : i.data.length - 1 },
21
- hideLegend: { type: Boolean },
22
- hideTooltip: { type: Boolean },
23
- gridLineX: { type: Boolean },
24
- domainLineX: { type: Boolean },
25
- gridLineY: { type: Boolean },
26
- domainLineY: { type: Boolean },
27
- paginationPoisition: {}
28
- },
29
- setup(i) {
30
- const s = i, m = Object.values(s.categories).map((e) => e.color), v = B(() => (e) => {
31
- const o = V(M, {
32
- data: e,
33
- categories: s.categories
34
- }), n = document.createElement("div");
35
- o.mount(n);
36
- const a = n.innerHTML;
37
- return o.unmount(), a;
38
- });
39
- function L(e) {
40
- var o;
41
- return {
42
- y: (n) => Number(n[e]),
43
- color: ((o = s.categories[e]) == null ? void 0 : o.color) ?? "#3b82f6"
44
- };
45
- }
46
- const T = m.map(
47
- (e, o) => `
48
- <linearGradient id="gradient${o}-${e}" gradientTransform="rotate(90)">
49
- <stop offset="0%" stop-color="${e}" stop-opacity="1" />
50
- <stop offset="100%" stop-color="${e}" stop-opacity="0" />
51
- </linearGradient>
52
- `
53
- ).join("");
54
- return (e, o) => (r(), c("div", {
55
- class: C(["flex flex-col space-y-4", {
56
- "flex-col-reverse": s.paginationPoisition === "top"
57
- }])
58
- }, [
59
- l(t(Y), {
60
- data: e.data,
61
- height: e.height,
62
- "svg-defs": t(T)
63
- }, {
64
- default: X(() => [
65
- e.hideTooltip ? u("", !0) : (r(), g(t(j), {
66
- key: 0,
67
- "horizontal-placement": t(y).Right,
68
- "vertical-placement": t(y).Top
69
- }, null, 8, ["horizontal-placement", "vertical-placement"])),
70
- (r(!0), c(f, null, N(Object.keys(s.categories), (n, a) => (r(), c(f, { key: a }, [
71
- l(t(F), $({
72
- x: (d, p) => p,
73
- ref_for: !0
74
- }, L(n), {
75
- color: `url(#gradient${a}-${t(m)[a]})`,
76
- opacity: 0.5,
77
- "curve-type": e.curveType ?? t(h).MonotoneX
78
- }), null, 16, ["x", "color", "curve-type"]),
79
- l(t(A), {
80
- x: (d, p) => p,
81
- y: (d) => d[n],
82
- color: t(m)[a],
83
- "curve-type": e.curveType ?? t(h).MonotoneX
84
- }, null, 8, ["x", "y", "color", "curve-type"])
85
- ], 64))), 128)),
86
- l(t(k), {
87
- type: "x",
88
- "tick-format": e.xFormatter,
89
- "num-ticks": e.xNumTicks,
90
- label: e.xLabel,
91
- "grid-line": e.gridLineX,
92
- "domain-line": e.domainLineX,
93
- "tick-line": !!e.gridLineX
94
- }, null, 8, ["tick-format", "num-ticks", "label", "grid-line", "domain-line", "tick-line"]),
95
- l(t(k), {
96
- type: "y",
97
- "num-ticks": e.yNumTicks ?? e.data.length,
98
- "tick-format": e.yFormatter,
99
- label: e.yLabel,
100
- "grid-line": e.gridLineY,
101
- "domain-line": e.domainLineY,
102
- "tick-line": !!e.gridLineY
103
- }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"]),
104
- e.hideTooltip ? u("", !0) : (r(), g(t(P), {
105
- key: 1,
106
- color: "#666",
107
- template: v.value
108
- }, null, 8, ["template"]))
109
- ]),
110
- _: 1
111
- }, 8, ["data", "height", "svg-defs"]),
112
- e.hideLegend ? u("", !0) : (r(), c("div", O, [
113
- l(t(z), {
114
- items: Object.values(e.categories)
115
- }, null, 8, ["items"])
116
- ]))
117
- ], 2));
118
- }
119
- });
120
- export {
121
- H as default
122
- };
123
- //# sourceMappingURL=AreaChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AreaChart.js","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport type { BulletLegendItemInterface, NumericAccessor } from \"@unovis/ts\";\nimport { CurveType, Position } from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\n\ntype AreaChartProps<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 | number;\n curveType?: CurveType;\n xNumTicks?: number;\n yNumTicks?: number;\n hideLegend?: boolean;\n hideTooltip?: boolean;\n gridLineX?: boolean;\n domainLineX?: boolean;\n gridLineY?: boolean;\n domainLineY?: boolean;\n paginationPoisition?: PaginationPosition;\n};\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.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\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{\n 'flex-col-reverse': props.paginationPoisition === 'top',\n }\"\n >\n <VisXYContainer :data=\"data\" :height=\"height\" :svg-defs=\"svgDefs\">\n <VisTooltip\n v-if=\"!hideTooltip\"\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 <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :tick-format=\"xFormatter\"\n :num-ticks=\"xNumTicks\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks ?? data.length\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div v-if=\"!hideLegend\" class=\"flex items center justify-end\">\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,UAAMA,IAAQC,GAORC,IAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAI,CAACG,MAAMA,EAAE,KAAK,GAE3DC,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;AAED,aAASC,EAAUC,GAAsD;;AAChE,aAAA;AAAA,QACL,GAAG,CAACP,MAAS,OAAOA,EAAEO,CAAoB,CAAC;AAAA,QAC3C,SAAOC,IAAAd,EAAM,WAAWa,CAAE,MAAnB,gBAAAC,EAAsB,UAAS;AAAA,MACxC;AAAA,IAAA;AAGF,UAAMC,IAAUb,EACb;AAAA,MACC,CAACc,GAAOC,MAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA;AAAA,IAAA,EAIxC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,36 +0,0 @@
1
- import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
2
- import { PaginationPosition } from '../../types';
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 | number;
13
- curveType?: CurveType;
14
- xNumTicks?: number;
15
- yNumTicks?: number;
16
- hideLegend?: boolean;
17
- hideTooltip?: boolean;
18
- gridLineX?: boolean;
19
- domainLineX?: boolean;
20
- gridLineY?: boolean;
21
- domainLineY?: boolean;
22
- paginationPoisition?: 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
- } & {};
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./AreaChart.cjs");exports.default=e.default;
2
- //# sourceMappingURL=AreaChart2.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AreaChart2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}