vue-chrts 0.0.134 → 0.0.137
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/components/Area/AreaChart.cjs +7 -0
- package/dist/components/Area/AreaChart.cjs.map +1 -0
- package/dist/components/Area/AreaChart.js +123 -0
- package/dist/components/Area/AreaChart.js.map +1 -0
- package/dist/components/Area/AreaChart.vue.d.ts +36 -0
- package/dist/components/Area/AreaChart2.cjs +2 -0
- package/dist/components/Area/AreaChart2.cjs.map +1 -0
- package/dist/components/Area/AreaChart2.js +5 -0
- package/dist/components/Area/AreaChart2.js.map +1 -0
- package/dist/components/Area/index.d.ts +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.cjs +2 -0
- package/dist/components/AreaStacked/AreaStackedChart.cjs.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.js +51 -0
- package/dist/components/AreaStacked/AreaStackedChart.js.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.vue.d.ts +18 -0
- package/dist/components/AreaStacked/AreaStackedChart2.cjs +2 -0
- package/dist/components/AreaStacked/AreaStackedChart2.cjs.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart2.js +5 -0
- package/dist/components/AreaStacked/AreaStackedChart2.js.map +1 -0
- package/{src/components/AreaStacked/index.ts → dist/components/AreaStacked/index.d.ts} +1 -1
- package/dist/components/Bar/index.d.ts +1 -0
- package/dist/components/Crosshair/Crosshair.cjs +2 -0
- package/dist/components/Crosshair/Crosshair.cjs.map +1 -0
- package/dist/components/Crosshair/Crosshair.js +40 -0
- package/dist/components/Crosshair/Crosshair.js.map +1 -0
- package/dist/components/Crosshair/Crosshair.vue.d.ts +38 -0
- package/dist/components/Crosshair/Crosshair2.cjs +2 -0
- package/dist/components/Crosshair/Crosshair2.cjs.map +1 -0
- package/dist/components/Crosshair/Crosshair2.js +5 -0
- package/dist/components/Crosshair/Crosshair2.js.map +1 -0
- package/dist/components/Crosshair/index.d.ts +1 -0
- package/dist/components/Donut/DonutChart.cjs +6 -0
- package/dist/components/Donut/DonutChart.cjs.map +1 -0
- package/dist/components/Donut/DonutChart.js +59 -0
- package/dist/components/Donut/DonutChart.js.map +1 -0
- package/dist/components/Donut/DonutChart.vue.d.ts +31 -0
- package/dist/components/Donut/DonutChart2.cjs +2 -0
- package/dist/components/Donut/DonutChart2.cjs.map +1 -0
- package/dist/components/Donut/DonutChart2.js +5 -0
- package/dist/components/Donut/DonutChart2.js.map +1 -0
- package/dist/components/Donut/index.d.ts +1 -0
- package/dist/components/Line/index.d.ts +1 -0
- package/dist/components/Tooltip.cjs +2 -0
- package/dist/components/Tooltip.cjs.map +1 -0
- package/dist/components/Tooltip.js +21 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Tooltip.vue.d.ts +14 -0
- package/dist/components/Tooltip2.cjs +2 -0
- package/dist/components/Tooltip2.cjs.map +1 -0
- package/dist/components/Tooltip2.js +5 -0
- package/dist/components/Tooltip2.js.map +1 -0
- package/dist/components.d.ts +4 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/package.json +13 -10
- package/.vscode/extensions.json +0 -3
- package/auto-imports.d.ts +0 -58
- package/components.d.ts +0 -46
- package/image.png +0 -0
- package/index.html +0 -14
- package/index.js +0 -2
- package/src/components/Area/AreaChart.vue +0 -141
- package/src/components/Area/index.ts +0 -1
- package/src/components/AreaStacked/AreaStackedChart.vue +0 -51
- package/src/components/Bar/BarChart.vue +0 -130
- package/src/components/Bar/index.ts +0 -1
- package/src/components/Crosshair/Crosshair.vue +0 -46
- package/src/components/Crosshair/index.ts +0 -1
- package/src/components/Donut/DonutChart.vue +0 -71
- package/src/components/Donut/index.ts +0 -1
- package/src/components/Line/LineChart.vue +0 -94
- package/src/components/Line/index.ts +0 -1
- package/src/components/Tooltip.vue +0 -17
- package/src/components.ts +0 -6
- package/src/index.ts +0 -6
- package/src/shims-vue.d.ts +0 -1
- package/src-demo/AdminTemplate.vue +0 -5
- package/src-demo/App.vue +0 -37
- package/src-demo/AreaChartPage.vue +0 -125
- package/src-demo/BarChartPage.vue +0 -166
- package/src-demo/DashboardTemplate.vue +0 -687
- package/src-demo/Homepage.vue +0 -325
- package/src-demo/LineChartPage.vue +0 -140
- package/src-demo/assets/main.css +0 -34
- package/src-demo/components/Progress/Progress.vue +0 -42
- package/src-demo/components/Progress/index.ts +0 -1
- package/src-demo/components/Status/Status.vue +0 -95
- package/src-demo/components/Status/index.ts +0 -1
- package/src-demo/components/charts.ts +0 -37
- package/src-demo/components/index.ts +0 -49
- package/src-demo/data/AreaChartData.ts +0 -294
- package/src-demo/data/BarChartData.ts +0 -79
- package/src-demo/data/IncomeExpenseData.ts +0 -189
- package/src-demo/data/InvestmentData.ts +0 -352
- package/src-demo/data/RevenueData.ts +0 -58
- package/src-demo/data/VisitorsData.ts +0 -260
- package/src-demo/elements/Button.vue +0 -13
- package/src-demo/elements/Card.vue +0 -17
- package/src-demo/elements/Dropdown.vue +0 -112
- package/src-demo/elements/Logo.vue +0 -8
- package/src-demo/elements/Table.vue +0 -363
- package/src-demo/elements/TopBar.vue +0 -40
- package/src-demo/index.ts +0 -58
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -63
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { BulletLegendItemInterface } from '@unovis/ts'
|
|
3
|
-
import { omit } from '@unovis/ts'
|
|
4
|
-
import { VisCrosshair, VisTooltip } from '@unovis/vue'
|
|
5
|
-
import { type Component, createApp } from 'vue'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<{
|
|
8
|
-
colors: string[]
|
|
9
|
-
index: string
|
|
10
|
-
items: BulletLegendItemInterface[]
|
|
11
|
-
customTooltip?: Component
|
|
12
|
-
}>(), {
|
|
13
|
-
colors: () => [],
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
// Use weakmap to store reference to each datapoint for Tooltip
|
|
17
|
-
const wm = new WeakMap()
|
|
18
|
-
function template(d: any) {
|
|
19
|
-
if (wm.has(d)) {
|
|
20
|
-
return wm.get(d)
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
if (typeof window !== 'undefined') {
|
|
24
|
-
const componentDiv = document.createElement('div')
|
|
25
|
-
const omittedData = Object.entries(omit(d, [props.index])).map(([key, value]) => {
|
|
26
|
-
const legendReference = props.items.find(i => i.name === key)
|
|
27
|
-
return { ...legendReference, value }
|
|
28
|
-
})
|
|
29
|
-
const TooltipComponent = props.customTooltip ?? VisTooltip
|
|
30
|
-
createApp(TooltipComponent, { title: d[props.index].toString(), data: omittedData }).mount(componentDiv)
|
|
31
|
-
wm.set(d, componentDiv.innerHTML)
|
|
32
|
-
return componentDiv.innerHTML
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function color(_: unknown, i: number) {
|
|
39
|
-
return props.colors[i] ?? 'transparent'
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<template>
|
|
44
|
-
<VisTooltip :horizontal-shift="20" :vertical-shift="20" />
|
|
45
|
-
<VisCrosshair :template="template" :color="color" />
|
|
46
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Crosshair } from './Crosshair.vue';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { Donut } from "@unovis/ts";
|
|
3
|
-
import {
|
|
4
|
-
VisBulletLegend,
|
|
5
|
-
VisDonut,
|
|
6
|
-
VisSingleContainer,
|
|
7
|
-
VisTooltip,
|
|
8
|
-
} from "@unovis/vue";
|
|
9
|
-
|
|
10
|
-
export type DonutChartProps = {
|
|
11
|
-
type?: string;
|
|
12
|
-
data: number[];
|
|
13
|
-
height: number;
|
|
14
|
-
radius: number;
|
|
15
|
-
hidePagination?: boolean
|
|
16
|
-
labels: {
|
|
17
|
-
name: string;
|
|
18
|
-
color: string;
|
|
19
|
-
}[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const props = defineProps<DonutChartProps>();
|
|
23
|
-
|
|
24
|
-
const value = (d: number) => d;
|
|
25
|
-
|
|
26
|
-
const isHalf = props.type === "half";
|
|
27
|
-
|
|
28
|
-
const tooltip = {
|
|
29
|
-
[Donut.selectors.segment]: (d: any) => {
|
|
30
|
-
console.log();
|
|
31
|
-
|
|
32
|
-
return `<div class='flex items-center'><div class='w-2 h-2 rounded-full mr-2' style='background-color: ${
|
|
33
|
-
props.labels[d.index].color
|
|
34
|
-
} ;'></div>
|
|
35
|
-
<div>${d.data}</div>
|
|
36
|
-
</vistooltip>
|
|
37
|
-
</vissinglecontainer>
|
|
38
|
-
</div>`;
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<template>
|
|
44
|
-
<div class="flex items-center justify-center">
|
|
45
|
-
<VisSingleContainer
|
|
46
|
-
:class="isHalf ? 'mt-24' : ''"
|
|
47
|
-
:data="data"
|
|
48
|
-
:height="height"
|
|
49
|
-
:margin="{}"
|
|
50
|
-
>
|
|
51
|
-
<VisTooltip
|
|
52
|
-
:horizontal-shift="20"
|
|
53
|
-
:vertical-shift="20"
|
|
54
|
-
:triggers="tooltip"
|
|
55
|
-
/>
|
|
56
|
-
|
|
57
|
-
<VisDonut
|
|
58
|
-
:value="value"
|
|
59
|
-
:corner-radius="radius"
|
|
60
|
-
:color="props.labels.map((l) => l.color)"
|
|
61
|
-
:angle-range="isHalf ? [-1.5707963267948966, 1.5707963267948966] : []"
|
|
62
|
-
/>
|
|
63
|
-
</VisSingleContainer>
|
|
64
|
-
|
|
65
|
-
<slot />
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div v-if="!hidePagination" class="flex items-center justify-center mt-4">
|
|
69
|
-
<VisBulletLegend :items="labels" />
|
|
70
|
-
</div>
|
|
71
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as DonutChart } from './DonutChart.vue';
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts" generic="T">
|
|
2
|
-
import { computed, createApp } from "vue";
|
|
3
|
-
|
|
4
|
-
import { CurveType, BulletLegendItemInterface, Position } from "@unovis/ts";
|
|
5
|
-
|
|
6
|
-
import Tooltip from "./../Tooltip.vue";
|
|
7
|
-
import { PaginationPosition } from "../..";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
VisAxis,
|
|
11
|
-
VisBulletLegend,
|
|
12
|
-
VisCrosshair,
|
|
13
|
-
VisLine,
|
|
14
|
-
VisXYContainer,
|
|
15
|
-
VisTooltip,
|
|
16
|
-
} from "@unovis/vue";
|
|
17
|
-
|
|
18
|
-
export type LineChartProps<T> = {
|
|
19
|
-
data: T[];
|
|
20
|
-
height: number;
|
|
21
|
-
xLabel?: string;
|
|
22
|
-
yLabel?: string;
|
|
23
|
-
categories: Record<string, BulletLegendItemInterface>;
|
|
24
|
-
xFormatter: (i: number, idx: number) => string;
|
|
25
|
-
yFormatter?: (i: number, idx: number) => string;
|
|
26
|
-
curveType?: CurveType;
|
|
27
|
-
yNumTicks?: number;
|
|
28
|
-
xNumTicks?: number;
|
|
29
|
-
paginationPosition?: PaginationPosition;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const props = defineProps<LineChartProps<T>>();
|
|
33
|
-
|
|
34
|
-
const color = (key: number) => Object.values(props.categories)[key].color;
|
|
35
|
-
|
|
36
|
-
const generateTooltip = computed(() => (d: T) => {
|
|
37
|
-
const app = createApp(Tooltip, {
|
|
38
|
-
data: d,
|
|
39
|
-
categories: props.categories,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const container = document.createElement("div");
|
|
43
|
-
app.mount(container);
|
|
44
|
-
|
|
45
|
-
const html = container.innerHTML;
|
|
46
|
-
app.unmount();
|
|
47
|
-
|
|
48
|
-
return html;
|
|
49
|
-
});
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<template>
|
|
53
|
-
<div
|
|
54
|
-
class="space-y-4 flex flex-col"
|
|
55
|
-
:class="{
|
|
56
|
-
'flex-col-reverse': props.paginationPosition === 'top',
|
|
57
|
-
}"
|
|
58
|
-
>
|
|
59
|
-
<VisXYContainer :data="data" :height="height">
|
|
60
|
-
<VisTooltip
|
|
61
|
-
:horizontal-placement="Position.Right"
|
|
62
|
-
:vertical-placement="Position.Top"
|
|
63
|
-
/>
|
|
64
|
-
<template v-for="(i, iKey) in Object.keys(props.categories)" :key="iKey">
|
|
65
|
-
<VisLine
|
|
66
|
-
:x="(_: any, i: number) => i"
|
|
67
|
-
:y="(d: T) => d[i as keyof typeof d]"
|
|
68
|
-
:color="color(iKey)"
|
|
69
|
-
:curve-type="curveType ?? CurveType.MonotoneX"
|
|
70
|
-
/>
|
|
71
|
-
</template>
|
|
72
|
-
<VisAxis
|
|
73
|
-
type="x"
|
|
74
|
-
:tick-format="xFormatter"
|
|
75
|
-
:num-ticks="xNumTicks ?? 4"
|
|
76
|
-
:label="xLabel"
|
|
77
|
-
:label-margin="8"
|
|
78
|
-
:domain-line="false"
|
|
79
|
-
:grid-line="false"
|
|
80
|
-
/>
|
|
81
|
-
<VisAxis
|
|
82
|
-
type="y"
|
|
83
|
-
:num-ticks="yNumTicks ?? 4"
|
|
84
|
-
:tick-format="yFormatter"
|
|
85
|
-
:label="yLabel"
|
|
86
|
-
:domain-line="false"
|
|
87
|
-
/>
|
|
88
|
-
<VisCrosshair color="#666" :template="generateTooltip" />
|
|
89
|
-
</VisXYContainer>
|
|
90
|
-
<div class="flex items center justify-end">
|
|
91
|
-
<VisBulletLegend :items="Object.values(categories)" />
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as LineChart } from './LineChart.vue';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex flex-col">
|
|
3
|
-
<template v-for="[key, value] in Object.entries(data)" :key="key">
|
|
4
|
-
<div class="flex items-center mr-2 mt-2">
|
|
5
|
-
<!-- <span class="w-3 h-3 rounded-full bg-[#10b981] mr-2"></span> -->
|
|
6
|
-
<span class="font-semibold capitalize text-white/75">{{ key }}:</span>
|
|
7
|
-
</div>
|
|
8
|
-
<span class="font-normal">{{ value }}</span>
|
|
9
|
-
</template>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup generic="T">
|
|
14
|
-
const props = defineProps<{
|
|
15
|
-
data: T;
|
|
16
|
-
}>();
|
|
17
|
-
</script>
|
package/src/components.ts
DELETED
package/src/index.ts
DELETED
package/src/shims-vue.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '*.vue';
|
package/src-demo/App.vue
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
|
|
4
|
-
import { useColorMode } from "@vueuse/core";
|
|
5
|
-
useColorMode();
|
|
6
|
-
|
|
7
|
-
const displayCopyright = computed(() => {
|
|
8
|
-
const currentYear = new Date().getFullYear();
|
|
9
|
-
return `Made with 💚 ~ © ${currentYear} Dennis Adriaansen, Inc. All rights reserved.`;
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<div>
|
|
15
|
-
<RouterView />
|
|
16
|
-
<div class="border-t border-border mt-8">
|
|
17
|
-
<div class="max-w-7xl mx-auto py-8 flex items-center justify-between">
|
|
18
|
-
<div v-html="displayCopyright"></div>
|
|
19
|
-
<div>
|
|
20
|
-
<a href="https://x.com/DennisAdriaans" target="_blank">
|
|
21
|
-
<svg
|
|
22
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
-
viewBox="0 0 30 30"
|
|
24
|
-
width="30px"
|
|
25
|
-
height="30px"
|
|
26
|
-
>
|
|
27
|
-
<path
|
|
28
|
-
fill="currentColor"
|
|
29
|
-
d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
</a>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { AreaChart as BaseArea } from "./../src/components/Area";
|
|
3
|
-
import { AreaStackedChart } from "./../src/components";
|
|
4
|
-
|
|
5
|
-
import Card from "./elements/Card.vue";
|
|
6
|
-
|
|
7
|
-
import { CurveType } from "@unovis/ts";
|
|
8
|
-
import {
|
|
9
|
-
AreaChartData1,
|
|
10
|
-
AreaChartData2,
|
|
11
|
-
AreaChartData3,
|
|
12
|
-
AreaChartData4,
|
|
13
|
-
categories2,
|
|
14
|
-
categories3,
|
|
15
|
-
categories4,
|
|
16
|
-
categories5,
|
|
17
|
-
} from "./data/AreaChartData";
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div class="space-y-8 pb-24 pt-8">
|
|
22
|
-
<div class="max-w-7xl mx-auto space-y-4">
|
|
23
|
-
<div class="mb-8 space-y-4">
|
|
24
|
-
<h1 class="text-4xl font-bold">Area Chart</h1>
|
|
25
|
-
<p class="text-lg font-medium text-gray-500">
|
|
26
|
-
Graph with lines connecting data points and shaded areas between the
|
|
27
|
-
lines and the x-axis.
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div class="grid grid-cols-3 gap-4 max-w-7xl mx-auto py-4">
|
|
33
|
-
<Card>
|
|
34
|
-
<template #header>
|
|
35
|
-
<h2 class="heading-2">Area Chart multiple lines</h2>
|
|
36
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
37
|
-
</template>
|
|
38
|
-
<BaseArea
|
|
39
|
-
:data="AreaChartData1"
|
|
40
|
-
:height="200"
|
|
41
|
-
y-label="Number of visits"
|
|
42
|
-
:categories="categories3"
|
|
43
|
-
:x-formatter="(i: number): string => `${AreaChartData1[i].date}`"
|
|
44
|
-
:curve-type="CurveType.MonotoneX"
|
|
45
|
-
/>
|
|
46
|
-
</Card>
|
|
47
|
-
|
|
48
|
-
<Card>
|
|
49
|
-
<template #header>
|
|
50
|
-
<h2 class="text-xl my-2 font-bold">Area Chart with single line</h2>
|
|
51
|
-
</template>
|
|
52
|
-
<BaseArea
|
|
53
|
-
:data="AreaChartData2"
|
|
54
|
-
:height="200"
|
|
55
|
-
x-label="Time"
|
|
56
|
-
y-label="Temperature"
|
|
57
|
-
:categories="categories2"
|
|
58
|
-
:y-num-ticks="4"
|
|
59
|
-
:x-num-ticks="7"
|
|
60
|
-
:x-formatter="(i: number): string => `${AreaChartData2[i].hour}`"
|
|
61
|
-
:curve-type="CurveType.Basis"
|
|
62
|
-
/>
|
|
63
|
-
</Card>
|
|
64
|
-
|
|
65
|
-
<Card>
|
|
66
|
-
<template #header>
|
|
67
|
-
<h2 class="text-xl my-2 font-bold">Area Chart Stacked</h2>
|
|
68
|
-
</template>
|
|
69
|
-
<AreaStackedChart :data="AreaChartData3" :categories="categories4" />
|
|
70
|
-
</Card>
|
|
71
|
-
|
|
72
|
-
<Card>
|
|
73
|
-
<template #header>
|
|
74
|
-
<h2 class="text-xl my-2 font-bold">Area Chart Natrual</h2>
|
|
75
|
-
</template>
|
|
76
|
-
<BaseArea
|
|
77
|
-
:data="AreaChartData4"
|
|
78
|
-
:height="200"
|
|
79
|
-
x-label="Month"
|
|
80
|
-
y-label="Score"
|
|
81
|
-
:categories="categories5"
|
|
82
|
-
:y-num-ticks="4"
|
|
83
|
-
:x-num-ticks="7"
|
|
84
|
-
:x-formatter="(i: number): string => `${AreaChartData2[i].hour}`"
|
|
85
|
-
:curve-type="CurveType.Natural"
|
|
86
|
-
/>
|
|
87
|
-
</Card>
|
|
88
|
-
|
|
89
|
-
<Card>
|
|
90
|
-
<template #header>
|
|
91
|
-
<h2 class="text-xl my-2 font-bold">Area Chart Step</h2>
|
|
92
|
-
</template>
|
|
93
|
-
<BaseArea
|
|
94
|
-
:data="AreaChartData4"
|
|
95
|
-
:height="200"
|
|
96
|
-
x-label="Month"
|
|
97
|
-
y-label="Score"
|
|
98
|
-
:categories="categories5"
|
|
99
|
-
:y-num-ticks="4"
|
|
100
|
-
:x-num-ticks="7"
|
|
101
|
-
:x-formatter="(i: number): string => `${AreaChartData2[i].hour}`"
|
|
102
|
-
:curve-type="CurveType.Step"
|
|
103
|
-
/>
|
|
104
|
-
</Card>
|
|
105
|
-
|
|
106
|
-
<Card>
|
|
107
|
-
<template #header>
|
|
108
|
-
<h2 class="text-xl my-2 font-bold">Area Chart Default</h2>
|
|
109
|
-
</template>
|
|
110
|
-
<BaseArea
|
|
111
|
-
:data="AreaChartData4"
|
|
112
|
-
:height="200"
|
|
113
|
-
x-label="Month"
|
|
114
|
-
y-label="Score"
|
|
115
|
-
:categories="categories5"
|
|
116
|
-
:y-num-ticks="4"
|
|
117
|
-
:x-num-ticks="7"
|
|
118
|
-
:x-formatter="(i: number): string => {
|
|
119
|
-
return `${AreaChartData2[i].hour}`;
|
|
120
|
-
}"
|
|
121
|
-
/>
|
|
122
|
-
</Card>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</template>
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Orientation } from "@unovis/ts";
|
|
3
|
-
import { BarChart } from "./../src/components";
|
|
4
|
-
|
|
5
|
-
import Card from "./elements/Card.vue";
|
|
6
|
-
|
|
7
|
-
import { VisitorsData, VisitorsCartegories } from "./data/VisitorsData";
|
|
8
|
-
|
|
9
|
-
import { PaginationPosition } from './../src'
|
|
10
|
-
|
|
11
|
-
const RevenueData = [
|
|
12
|
-
{ month: "January", desktop: 186, mobile: 80 },
|
|
13
|
-
{ month: "February", desktop: 305, mobile: 200 },
|
|
14
|
-
{ month: "March", desktop: 237, mobile: 120 },
|
|
15
|
-
{ month: "April", desktop: 73, mobile: 190 },
|
|
16
|
-
{ month: "May", desktop: 209, mobile: 130 },
|
|
17
|
-
{ month: "June", desktop: 214, mobile: 140 },
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const RevenueCategories = {
|
|
21
|
-
desktop: { name: "Desktop", color: "#00dc82" },
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const RevenueCategoriesMultple = {
|
|
25
|
-
desktop: { name: "Desktop", color: "#00dc82" },
|
|
26
|
-
mobile: { name: "Mobile", color: "#156F36" },
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<div class="space-y-8 pb-24 pt-8">
|
|
32
|
-
<div class="max-w-7xl mx-auto space-y-4">
|
|
33
|
-
<div class="mb-8 space-y-4">
|
|
34
|
-
<h1 class="text-4xl font-bold">Bar Chart</h1>
|
|
35
|
-
<p class="text-lg font-medium text-gray-500">
|
|
36
|
-
Bar charts to represent data, with bar lengths proportional to the
|
|
37
|
-
values they represent.
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="grid grid-cols-3 gap-4 max-w-7xl mx-auto py-4">
|
|
43
|
-
<Card>
|
|
44
|
-
<template #header>
|
|
45
|
-
<h2 class="heading-2">Bar Chart Vertical</h2>
|
|
46
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
47
|
-
</template>
|
|
48
|
-
<BarChart
|
|
49
|
-
:data="RevenueData"
|
|
50
|
-
:height="250"
|
|
51
|
-
:categories="RevenueCategories"
|
|
52
|
-
:y-axis="['desktop']"
|
|
53
|
-
:xNumTicks="6"
|
|
54
|
-
:radius="4"
|
|
55
|
-
:y-formatter="(i: number) => i"
|
|
56
|
-
:x-formatter="(i: number): string => `${RevenueData[i].month }`"
|
|
57
|
-
:pagination-position="PaginationPosition.Top"
|
|
58
|
-
/>
|
|
59
|
-
</Card>
|
|
60
|
-
|
|
61
|
-
<Card>
|
|
62
|
-
<template #header>
|
|
63
|
-
<h2 class="heading-2">Bar Chart Horizontal</h2>
|
|
64
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
65
|
-
</template>
|
|
66
|
-
<BarChart
|
|
67
|
-
:data="RevenueData"
|
|
68
|
-
:height="250"
|
|
69
|
-
:categories="RevenueCategories"
|
|
70
|
-
:y-axis="['desktop']"
|
|
71
|
-
:xNumTicks="6"
|
|
72
|
-
:radius="4"
|
|
73
|
-
:bar-padding="0"
|
|
74
|
-
:orientation="Orientation.Horizontal"
|
|
75
|
-
:x-formatter="() => ''"
|
|
76
|
-
:y-formatter="(i: number): string => `${RevenueData[i].month }`"
|
|
77
|
-
:pagination-position="PaginationPosition.Top"
|
|
78
|
-
/>
|
|
79
|
-
</Card>
|
|
80
|
-
|
|
81
|
-
<Card>
|
|
82
|
-
<template #header>
|
|
83
|
-
<h2 class="heading-2">Bar Chart Group</h2>
|
|
84
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
85
|
-
</template>
|
|
86
|
-
<BarChart
|
|
87
|
-
:data="RevenueData"
|
|
88
|
-
:height="250"
|
|
89
|
-
:categories="RevenueCategoriesMultple"
|
|
90
|
-
:y-axis="['desktop', 'mobile']"
|
|
91
|
-
:group-padding="0"
|
|
92
|
-
:bar-padding="0.2"
|
|
93
|
-
:xNumTicks="6"
|
|
94
|
-
:radius="4"
|
|
95
|
-
:y-formatter="(i: number) => i"
|
|
96
|
-
:x-formatter="(i: number): string => `${RevenueData[i].month }`"
|
|
97
|
-
:pagination-position="PaginationPosition.Top"
|
|
98
|
-
/>
|
|
99
|
-
</Card>
|
|
100
|
-
|
|
101
|
-
<Card>
|
|
102
|
-
<template #header>
|
|
103
|
-
<h2 class="heading-2">Bar Chart Stacked</h2>
|
|
104
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
105
|
-
</template>
|
|
106
|
-
<BarChart
|
|
107
|
-
:data="RevenueData"
|
|
108
|
-
:stacked="true"
|
|
109
|
-
:height="250"
|
|
110
|
-
:categories="RevenueCategoriesMultple"
|
|
111
|
-
:y-axis="['desktop', 'mobile']"
|
|
112
|
-
:group-padding="0"
|
|
113
|
-
:bar-padding="0.2"
|
|
114
|
-
:xNumTicks="6"
|
|
115
|
-
:radius="4"
|
|
116
|
-
:y-formatter="(i: number) => i"
|
|
117
|
-
:x-formatter="(i: number): string => `${RevenueData[i].month }`"
|
|
118
|
-
:pagination-position="PaginationPosition.Top"
|
|
119
|
-
/>
|
|
120
|
-
</Card>
|
|
121
|
-
|
|
122
|
-
<Card>
|
|
123
|
-
<template #header>
|
|
124
|
-
<h2 class="heading-2">Bar Chart Vertical</h2>
|
|
125
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
126
|
-
</template>
|
|
127
|
-
<BarChart
|
|
128
|
-
:data="VisitorsData.slice(0, 11)"
|
|
129
|
-
:height="250"
|
|
130
|
-
:categories="VisitorsCartegories"
|
|
131
|
-
:y-axis="['visitors']"
|
|
132
|
-
:xNumTicks="1"
|
|
133
|
-
:radius="4"
|
|
134
|
-
:y-formatter="(i: number) => i"
|
|
135
|
-
:x-formatter="(i: number,): string => {
|
|
136
|
-
const date = new Date(VisitorsData[i].date)
|
|
137
|
-
return date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear();
|
|
138
|
-
}"
|
|
139
|
-
:pagination-position="PaginationPosition.Top"
|
|
140
|
-
/>
|
|
141
|
-
</Card>
|
|
142
|
-
|
|
143
|
-
<Card>
|
|
144
|
-
<template #header>
|
|
145
|
-
<h2 class="heading-2">Bar Chart Stacked Horizontal</h2>
|
|
146
|
-
<!-- <p class="text-gray-500">Website visitors per device</p> -->
|
|
147
|
-
</template>
|
|
148
|
-
<BarChart
|
|
149
|
-
:data="RevenueData"
|
|
150
|
-
:stacked="true"
|
|
151
|
-
:orientation="Orientation.Horizontal"
|
|
152
|
-
:height="250"
|
|
153
|
-
:categories="RevenueCategoriesMultple"
|
|
154
|
-
:y-axis="['desktop', 'mobile']"
|
|
155
|
-
:group-padding="0"
|
|
156
|
-
:bar-padding="0.2"
|
|
157
|
-
:xNumTicks="6"
|
|
158
|
-
:radius="4"
|
|
159
|
-
:x-formatter="(i: number) => i"
|
|
160
|
-
:y-formatter="(i: number): string => `${RevenueData[i].month }`"
|
|
161
|
-
:pagination-position="PaginationPosition.Top"
|
|
162
|
-
/>
|
|
163
|
-
</Card>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
</template>
|