vue-chrts 0.0.141 → 0.0.142
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.
- package/dist/_virtual/_plugin-vue_export-helper.cjs +2 -0
- package/dist/_virtual/_plugin-vue_export-helper.cjs.map +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/_plugin-vue_export-helper.js.map +1 -0
- package/dist/components/Area/AreaChart.cjs +2 -2
- package/dist/components/Area/AreaChart.cjs.map +1 -1
- package/dist/components/Area/AreaChart.js +8 -8
- package/dist/components/Area/AreaChart.js.map +1 -1
- package/dist/components/Area/AreaChart.vue.d.ts +2 -21
- package/dist/components/Area/index.d.ts +1 -0
- package/dist/components/Area/types.d.ts +84 -0
- package/dist/components/AreaStacked/AreaStackedChart.cjs +1 -1
- package/dist/components/AreaStacked/AreaStackedChart.js +6 -6
- package/dist/components/Bar/BarChart.cjs +1 -1
- package/dist/components/Bar/BarChart.js +11 -11
- package/dist/components/Line/LineChart.js +2 -2
- package/dist/components/Tooltip.cjs +1 -1
- package/dist/components/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip.js +5 -31
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Tooltip2.cjs +1 -1
- package/dist/components/Tooltip2.cjs.map +1 -1
- package/dist/components/Tooltip2.js +38 -2
- package/dist/components/Tooltip2.js.map +1 -1
- package/dist/index.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_plugin-vue_export-helper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_plugin-vue_export-helper.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
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"),
|
|
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"),g=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),m=e.computed(()=>t=>{const o=e.createApp(g.default,{data:t,categories:l.categories}),i=document.createElement("div");o.mount(i);const a=i.innerHTML;return o.unmount(),a});function p(t){var o;return{y:i=>Number(i[t]),color:((o=l.categories[t])==null?void 0:o.color)??"#3b82f6"}}const f=s.map((t,o)=>`
|
|
2
2
|
<linearGradient id="gradient${o}-${t}" gradientTransform="rotate(90)">
|
|
3
3
|
<stop offset="0%" stop-color="${t}" stop-opacity="1" />
|
|
4
4
|
<stop offset="100%" stop-color="${t}" stop-opacity="0" />
|
|
5
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(
|
|
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(f)},{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},p(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:m.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
7
|
//# sourceMappingURL=AreaChart.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { 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 { AreaChartProps } from \"./types\";\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":"osBAiBA,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,6 +1,6 @@
|
|
|
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
|
|
2
|
-
import { Position as
|
|
3
|
-
import { VisXYContainer as
|
|
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 y, renderList as N, mergeProps as Y } from "vue";
|
|
2
|
+
import { Position as f, CurveType as h } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as $, VisTooltip as j, VisArea as F, VisLine as A, VisAxis as k, VisCrosshair as P, VisBulletLegend as z } from "@unovis/vue";
|
|
4
4
|
import M from "../Tooltip.js";
|
|
5
5
|
const O = {
|
|
6
6
|
key: 0,
|
|
@@ -56,7 +56,7 @@ const O = {
|
|
|
56
56
|
"flex-col-reverse": s.paginationPoisition === "top"
|
|
57
57
|
}])
|
|
58
58
|
}, [
|
|
59
|
-
l(t(
|
|
59
|
+
l(t($), {
|
|
60
60
|
data: e.data,
|
|
61
61
|
height: e.height,
|
|
62
62
|
"svg-defs": t(T)
|
|
@@ -64,11 +64,11 @@ const O = {
|
|
|
64
64
|
default: X(() => [
|
|
65
65
|
e.hideTooltip ? u("", !0) : (r(), g(t(j), {
|
|
66
66
|
key: 0,
|
|
67
|
-
"horizontal-placement": t(
|
|
68
|
-
"vertical-placement": t(
|
|
67
|
+
"horizontal-placement": t(f).Right,
|
|
68
|
+
"vertical-placement": t(f).Top
|
|
69
69
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
70
|
-
(r(!0), c(
|
|
71
|
-
l(t(F),
|
|
70
|
+
(r(!0), c(y, null, N(Object.keys(s.categories), (n, a) => (r(), c(y, { key: a }, [
|
|
71
|
+
l(t(F), Y({
|
|
72
72
|
x: (d, p) => p,
|
|
73
73
|
ref_for: !0
|
|
74
74
|
}, L(n), {
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { 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 { AreaChartProps } from \"./types\";\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,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,26 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PaginationPosition } from '../../types';
|
|
1
|
+
import { AreaChartProps } from './types';
|
|
3
2
|
|
|
4
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<{
|
|
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);
|
|
4
|
+
props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & AreaChartProps<T>, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
24
5
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
25
6
|
attrs: any;
|
|
26
7
|
slots: ReturnType<() => {}>;
|
|
@@ -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"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("@unovis/vue"),d=require("@unovis/ts"),p=require("../Tooltip.cjs"),m={class:"flex flex-col space-y-4"},f={class:"flex items center justify-end"},v=e.defineComponent({__name:"AreaStackedChart",props:{data:{},categories:{},hideTooltip:{type:Boolean}},setup(s){const a=s,c=e.computed(()=>t=>{const n=e.createApp(p.default,{data:t,categories:a.categories}),r=document.createElement("div");n.mount(r);const l=r.innerHTML;return n.unmount(),l}),i=t=>Number.parseInt(t.time),u=[t=>t.firstTime,t=>t.returning];return(t,n)=>(e.openBlock(),e.createElementBlock("div",m,[e.createVNode(e.unref(o.VisXYContainer),{data:t.data,height:200},{default:e.withCtx(()=>[e.createVNode(e.unref(o.VisArea),{x:i,y:u,color:Object.values(a.categories).map(r=>r.color),"curve-type":e.unref(d.CurveType).Linear},null,8,["color","curve-type"]),e.createVNode(e.unref(o.VisAxis),{type:"x",label:"Time","num-ticks":12}),e.createVNode(e.unref(o.VisAxis),{type:"y",label:"Number of visitors","num-ticks":3}),t.hideTooltip?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(o.VisCrosshair),{key:0,color:"#666",template:c.value},null,8,["template"]))]),_:1},8,["data"]),e.createElementVNode("div",f,[e.createVNode(e.unref(o.VisBulletLegend),{items:Object.values(t.categories)},null,8,["items"])])]))}});exports.default=v;
|
|
2
2
|
//# sourceMappingURL=AreaStackedChart.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as d, computed as f, createApp as h, createElementBlock as y, openBlock as i, createVNode as o, createElementVNode as v, unref as t, withCtx as
|
|
2
|
-
import { VisXYContainer as
|
|
1
|
+
import { defineComponent as d, computed as f, createApp as h, createElementBlock as y, openBlock as i, createVNode as o, createElementVNode as v, unref as t, withCtx as g, createBlock as T, createCommentVNode as V } from "vue";
|
|
2
|
+
import { VisXYContainer as _, VisArea as k, VisAxis as s, VisCrosshair as C, VisBulletLegend as b } from "@unovis/vue";
|
|
3
3
|
import { CurveType as x } from "@unovis/ts";
|
|
4
4
|
import B from "../Tooltip.js";
|
|
5
5
|
const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center justify-end" }, w = /* @__PURE__ */ d({
|
|
@@ -20,12 +20,12 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
|
|
|
20
20
|
return a.unmount(), u;
|
|
21
21
|
}), m = (e) => Number.parseInt(e.time), p = [(e) => e.firstTime, (e) => e.returning];
|
|
22
22
|
return (e, a) => (i(), y("div", N, [
|
|
23
|
-
o(t(
|
|
23
|
+
o(t(_), {
|
|
24
24
|
data: e.data,
|
|
25
25
|
height: 200
|
|
26
26
|
}, {
|
|
27
|
-
default:
|
|
28
|
-
o(t(
|
|
27
|
+
default: g(() => [
|
|
28
|
+
o(t(k), {
|
|
29
29
|
x: m,
|
|
30
30
|
y: p,
|
|
31
31
|
color: Object.values(n.categories).map((r) => r.color),
|
|
@@ -41,7 +41,7 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
|
|
|
41
41
|
label: "Number of visitors",
|
|
42
42
|
"num-ticks": 3
|
|
43
43
|
}),
|
|
44
|
-
e.hideTooltip ? V("", !0) : (i(),
|
|
44
|
+
e.hideTooltip ? V("", !0) : (i(), T(t(C), {
|
|
45
45
|
key: 0,
|
|
46
46
|
color: "#666",
|
|
47
47
|
template: l.value
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@unovis/ts"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@unovis/ts"),i=require("@unovis/vue"),m=require("../Tooltip.cjs"),g=require("../../types.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:r.Orientation.Vertical},paginationPosition:{default:g.PaginationPosition.Bottom}},setup(p){const t=p,d=e.computed(()=>t.yAxis.map(a=>n=>n[a])),s=(a,n)=>Object.values(t.categories)[n].color,u=e.computed(()=>a=>{const n=e.createApp(m.default,{data:a,categories:t.categories}),l=document.createElement("div");n.mount(l);const o=l.innerHTML;return n.unmount(),o}),c=e.computed(()=>t.paginationPosition===g.PaginationPosition.Top);return(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col space-y-4",{"flex-col-reverse":c.value}])},[e.createVNode(e.unref(i.VisXYContainer),{height:a.height},{default:e.withCtx(()=>[e.createVNode(e.unref(i.VisTooltip),{triggers:{[e.unref(r.GroupedBar).selectors.bar]:u.value,[e.unref(r.StackedBar).selectors.bar]:u.value}},null,8,["triggers"]),a.stacked?(e.openBlock(),e.createBlock(e.unref(i.VisStackedBar),{key:1,data:a.data,x:(l,o)=>o,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(r.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,o)=>o,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(r.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(r.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":c.value}])},[e.createVNode(e.unref(i.VisBulletLegend),{items:Object.values(a.categories)},null,8,["items"])],2))],2))}});exports.default=f;
|
|
2
2
|
//# sourceMappingURL=BarChart.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as v, computed as s, createApp as B, createElementBlock as c, openBlock as l, normalizeClass as f, createVNode as r, createCommentVNode as P, unref as a, withCtx as V, createBlock as y } from "vue";
|
|
2
|
-
import { Orientation as d, StackedBar as
|
|
2
|
+
import { Orientation as d, StackedBar as T, GroupedBar as L } from "@unovis/ts";
|
|
3
3
|
import { VisXYContainer as C, VisTooltip as A, VisGroupedBar as N, VisStackedBar as F, VisAxis as b, VisBulletLegend as j } from "@unovis/vue";
|
|
4
4
|
import O from "../Tooltip.js";
|
|
5
5
|
import { PaginationPosition as k } from "../../types.js";
|
|
@@ -25,16 +25,16 @@ const S = /* @__PURE__ */ v({
|
|
|
25
25
|
paginationPosition: { default: k.Bottom }
|
|
26
26
|
},
|
|
27
27
|
setup(h) {
|
|
28
|
-
const
|
|
28
|
+
const t = h, u = s(() => t.yAxis.map((e) => (i) => i[e])), p = (e, i) => Object.values(t.categories)[i].color, g = s(() => (e) => {
|
|
29
29
|
const i = B(O, {
|
|
30
30
|
data: e,
|
|
31
|
-
categories:
|
|
32
|
-
}),
|
|
33
|
-
i.mount(
|
|
34
|
-
const o =
|
|
31
|
+
categories: t.categories
|
|
32
|
+
}), n = document.createElement("div");
|
|
33
|
+
i.mount(n);
|
|
34
|
+
const o = n.innerHTML;
|
|
35
35
|
return i.unmount(), o;
|
|
36
36
|
}), m = s(
|
|
37
|
-
() =>
|
|
37
|
+
() => t.paginationPosition === k.Top
|
|
38
38
|
);
|
|
39
39
|
return (e, i) => (l(), c("div", {
|
|
40
40
|
class: f(["flex flex-col space-y-4", { "flex-col-reverse": m.value }])
|
|
@@ -43,14 +43,14 @@ const S = /* @__PURE__ */ v({
|
|
|
43
43
|
default: V(() => [
|
|
44
44
|
r(a(A), {
|
|
45
45
|
triggers: {
|
|
46
|
-
[a(
|
|
47
|
-
[a(
|
|
46
|
+
[a(L).selectors.bar]: g.value,
|
|
47
|
+
[a(T).selectors.bar]: g.value
|
|
48
48
|
}
|
|
49
49
|
}, null, 8, ["triggers"]),
|
|
50
50
|
e.stacked ? (l(), y(a(F), {
|
|
51
51
|
key: 1,
|
|
52
52
|
data: e.data,
|
|
53
|
-
x: (
|
|
53
|
+
x: (n, o) => o,
|
|
54
54
|
y: u.value,
|
|
55
55
|
"grid-line": !1,
|
|
56
56
|
"domain-line": !1,
|
|
@@ -62,7 +62,7 @@ const S = /* @__PURE__ */ v({
|
|
|
62
62
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), y(a(N), {
|
|
63
63
|
key: 0,
|
|
64
64
|
data: e.data,
|
|
65
|
-
x: (
|
|
65
|
+
x: (n, o) => o,
|
|
66
66
|
y: u.value,
|
|
67
67
|
"grid-line": !1,
|
|
68
68
|
"domain-line": !1,
|
|
@@ -2,7 +2,7 @@ import { defineComponent as g, computed as h, createApp as k, createElementBlock
|
|
|
2
2
|
import { Position as m, CurveType as C } from "@unovis/ts";
|
|
3
3
|
import { VisXYContainer as F, VisTooltip as N, VisLine as j, VisAxis as u, VisCrosshair as B, VisBulletLegend as z } from "@unovis/vue";
|
|
4
4
|
import E from "../Tooltip.js";
|
|
5
|
-
const O = { class: "flex items center justify-end" },
|
|
5
|
+
const O = { class: "flex items center justify-end" }, w = /* @__PURE__ */ g({
|
|
6
6
|
__name: "LineChart",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -80,6 +80,6 @@ const O = { class: "flex items center justify-end" }, _ = /* @__PURE__ */ g({
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
export {
|
|
83
|
-
|
|
83
|
+
w as default
|
|
84
84
|
};
|
|
85
85
|
//# sourceMappingURL=LineChart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip2.cjs");;/* empty css */const t=require("../_virtual/_plugin-vue_export-helper.cjs"),u=t.default(e.default,[["__scopeId","data-v-cce34be2"]]);exports.default=u;
|
|
2
2
|
//# sourceMappingURL=Tooltip.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"Tooltip.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
data: {},
|
|
6
|
-
categories: {}
|
|
7
|
-
},
|
|
8
|
-
setup(x) {
|
|
9
|
-
const i = ["_index", "_stacked", "_ending"];
|
|
10
|
-
return (s, b) => (o(), t("div", f, [
|
|
11
|
-
(o(!0), t(_, null, p(Object.entries(s.data), ([e, d]) => {
|
|
12
|
-
var n, r;
|
|
13
|
-
return o(), t("div", {
|
|
14
|
-
key: e,
|
|
15
|
-
class: "flex items-center mr-2 mt-2"
|
|
16
|
-
}, [
|
|
17
|
-
(n = s.categories[e]) != null && n.color ? (o(), t("span", {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "w-3 h-3 rounded-full mr-2",
|
|
20
|
-
style: u({ backgroundColor: (r = s.categories[e]) == null ? void 0 : r.color })
|
|
21
|
-
}, null, 4)) : l("", !0),
|
|
22
|
-
i.includes(e) ? l("", !0) : (o(), t("div", g, [
|
|
23
|
-
a("span", h, c(e) + ":", 1),
|
|
24
|
-
a("span", k, c(d), 1)
|
|
25
|
-
]))
|
|
26
|
-
]);
|
|
27
|
-
}), 128))
|
|
28
|
-
]));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
1
|
+
import o from "./Tooltip2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-cce34be2"]]);
|
|
31
5
|
export {
|
|
32
|
-
|
|
6
|
+
e as default
|
|
33
7
|
};
|
|
34
8
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":[
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i={class:"flex flex-col space-y-1"},d={id:"t-label",class:"font-semibold mr-2"},u={id:"t-value",class:"font-normal"},m=e.defineComponent({__name:"Tooltip",props:{data:{},categories:{}},setup(n){const l=n,s=["_index","_stacked","_ending"],r=e.computed(()=>Object.entries(l.data).filter(([o,c])=>{var t;return!s.includes(o)&&((t=l.categories[o])==null?void 0:t.color)}));return(o,c)=>(e.openBlock(),e.createElementBlock("div",i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,([t,a])=>(e.openBlock(),e.createElementBlock("div",{key:t,class:"flex items-center mr-2"},[e.createElementVNode("span",{class:"w-2 h-2 rounded mr-2",style:e.normalizeStyle({backgroundColor:o.categories[t].color})},null,4),e.createElementVNode("div",null,[e.createElementVNode("span",d,e.toDisplayString(t)+":",1),e.createElementVNode("span",u,e.toDisplayString(a),1)])]))),128))]))}});exports.default=m;
|
|
2
2
|
//# sourceMappingURL=Tooltip2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Tooltip2.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 class=\"flex flex-col space-y-1\">\n <div \n v-for=\"[key, value] in visibleEntries\" \n :key=\"key\"\n class=\"flex items-center mr-2\"\n >\n <span\n class=\"w-2 h-2 rounded mr-2\"\n :style=\"{ backgroundColor: categories[key].color }\"\n ></span>\n <div>\n <span id=\"t-label\" class=\"font-semibold mr-2\">{{ key }}:</span>\n <span id=\"t-value\" class=\"font-normal\">{{ value }}</span>\n </div>\n </div>\n </div>\n</template>\n\n<style scoped>\n#t-label {\n margin-right: 8px;\n color: var(--tooltip-label-color);\n text-transform: capitalize;\n}\n\n#t-value {\n color: var(--tooltip-value-color);\n}\n</style>\n"],"names":["props","__props","keyBlockList","visibleEntries","computed","key","_","_a"],"mappings":"qUAIA,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,5 +1,41 @@
|
|
|
1
|
-
import f from "
|
|
1
|
+
import { defineComponent as p, computed as u, createElementBlock as s, openBlock as n, Fragment as _, renderList as f, createElementVNode as o, normalizeStyle as g, toDisplayString as r } from "vue";
|
|
2
|
+
const v = { class: "flex flex-col space-y-1" }, b = {
|
|
3
|
+
id: "t-label",
|
|
4
|
+
class: "font-semibold mr-2"
|
|
5
|
+
}, h = {
|
|
6
|
+
id: "t-value",
|
|
7
|
+
class: "font-normal"
|
|
8
|
+
}, k = /* @__PURE__ */ p({
|
|
9
|
+
__name: "Tooltip",
|
|
10
|
+
props: {
|
|
11
|
+
data: {},
|
|
12
|
+
categories: {}
|
|
13
|
+
},
|
|
14
|
+
setup(c) {
|
|
15
|
+
const l = c, a = ["_index", "_stacked", "_ending"], i = u(() => Object.entries(l.data).filter(
|
|
16
|
+
([t, d]) => {
|
|
17
|
+
var e;
|
|
18
|
+
return !a.includes(t) && ((e = l.categories[t]) == null ? void 0 : e.color);
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
return (t, d) => (n(), s("div", v, [
|
|
22
|
+
(n(!0), s(_, null, f(i.value, ([e, m]) => (n(), s("div", {
|
|
23
|
+
key: e,
|
|
24
|
+
class: "flex items-center mr-2"
|
|
25
|
+
}, [
|
|
26
|
+
o("span", {
|
|
27
|
+
class: "w-2 h-2 rounded mr-2",
|
|
28
|
+
style: g({ backgroundColor: t.categories[e].color })
|
|
29
|
+
}, null, 4),
|
|
30
|
+
o("div", null, [
|
|
31
|
+
o("span", b, r(e) + ":", 1),
|
|
32
|
+
o("span", h, r(m), 1)
|
|
33
|
+
])
|
|
34
|
+
]))), 128))
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
2
38
|
export {
|
|
3
|
-
|
|
39
|
+
k as default
|
|
4
40
|
};
|
|
5
41
|
//# sourceMappingURL=Tooltip2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Tooltip2.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 class=\"flex flex-col space-y-1\">\n <div \n v-for=\"[key, value] in visibleEntries\" \n :key=\"key\"\n class=\"flex items-center mr-2\"\n >\n <span\n class=\"w-2 h-2 rounded mr-2\"\n :style=\"{ backgroundColor: categories[key].color }\"\n ></span>\n <div>\n <span id=\"t-label\" class=\"font-semibold mr-2\">{{ key }}:</span>\n <span id=\"t-value\" class=\"font-normal\">{{ value }}</span>\n </div>\n </div>\n </div>\n</template>\n\n<style scoped>\n#t-label {\n margin-right: 8px;\n color: var(--tooltip-label-color);\n text-transform: capitalize;\n}\n\n#t-value {\n color: var(--tooltip-value-color);\n}\n</style>\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;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#t-label[data-v-cce34be2]{margin-right:8px;color:var(--tooltip-label-color);text-transform:capitalize}#t-value[data-v-cce34be2]{color:var(--tooltip-value-color)}
|