Commit 871354df authored by Gezer's avatar Gezer
Browse files

added Chart component to frontend, but didnt test

parent 94121baa
Showing with 72 additions and 0 deletions
+72 -0
<template>
<Line :date="charData" :options="chartOptions"/>
</template>
<script setup>
import { Line } from 'vue-chartjs'
import {
Chart as ChartJS,
Title,
Tooltip,
Legend,
LineElement,
PointElement,
LinearScale,
CategoryScale
} from 'chart.js'
import { ref, reactive } from 'vue'
const chartRef = ref()
ChartJS.register(Title,Tooltip,Legend,LineElement,PointElement,LinearScale,CategoryScale)
const MAX_POINTS = 100
const charData = reactive({
labels: [],
datasets:[
{
label: 'co2',
data: [],
borderColor: 'rgb(255,99,132)',
tension: 0.1
},
{
label: 'humidity',
data: [],
borderColor: 'rgb(255,99,132)',
tension: 0.1
},
{
label: 'temperature',
data: [],
borderColor: 'rgb(255,99,132)',
tension: 0.1
}
]
})
const chartOptions = {
responsive: true,
animation: false,
scales:{
y:{
beginAtZero: true
}
}
}
defineExpose({ chartData,
updateChart: () => chartRef.value?.chart?.update()
})defineProps({
msg: String,
})
const count = ref(0)
</script>
<style scoped>
</style>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment