Skip to content

Commit

Permalink
this time real fixed the UAChart
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Dec 19, 2023
1 parent d79eefe commit 02cee6e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions dashboard/src/components/UAChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ const getChartData = () => {
const labels = data.value.map(({ua}) => ua)
const counts = data.value.map(({count}) => count)
watch(data, (data) => {
labels.length = 0
counts.length = 0
data.forEach(({ ua, count }) => {
labels.push(ua)
counts.push(count)
})
const length = data.length
labels.length = length
counts.length = length
for(let i = 0; i < length; i++){
({
ua: labels[i],
count: counts[i],
} = data[i])
}
chartObj.value.refresh()
})
Expand Down Expand Up @@ -71,6 +74,7 @@ const getChartOptions = () => {
axis: 'y',
intersect: false,
},
animation: {},
plugins: {
tooltip: {
callbacks: {
Expand Down Expand Up @@ -123,6 +127,7 @@ onMounted(() => {

<template>
<Chart
ref="chartObj"
type="bar"
:data="chartData"
:options="chartOptions"
Expand Down

0 comments on commit 02cee6e

Please sign in to comment.