ChartJsHorizontalBarChart.vue
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script setup>
import { useTheme } from 'vuetify'
import { getHorizontalBarChartConfig } from '@core/libs/chartjs/chartjsConfig'
import BarChart from '@core/libs/chartjs/components/BarChart'
const props = defineProps({
colors: {
type: null,
required: true,
},
})
const vuetifyTheme = useTheme()
const chartOptions = computed(() => getHorizontalBarChartConfig(vuetifyTheme.current.value))
const data = {
labels: [
'MON',
'TUE',
'WED ',
'THU',
'FRI',
],
datasets: [
{
maxBarThickness: 15,
label: 'Market Data',
backgroundColor: props.colors.warningShade,
borderColor: 'transparent',
data: [
710,
350,
580,
460,
120,
],
},
{
maxBarThickness: 15,
backgroundColor: props.colors.horizontalBarInfo,
label: 'Personal Data',
borderColor: 'transparent',
data: [
430,
590,
510,
240,
360,
],
},
],
}
</script>
<template>
<BarChart
:height="375"
:chart-data="data"
:chart-options="chartOptions"
/>
</template>