Haris Razis
4 years ago
5 changed files with 138 additions and 84 deletions
@ -0,0 +1,71 @@ |
|||
<template> |
|||
<canvas id="chart"></canvas> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { Options, Vue } from 'vue-class-component'; |
|||
import { Component, Prop } from 'vue-property-decorator'; |
|||
import Chart from 'chart.js'; |
|||
|
|||
export default class Canva extends Vue { |
|||
@Prop() readonly points!: []; |
|||
|
|||
mounted() { |
|||
const ctx = document.getElementById('chart') as HTMLCanvasElement; |
|||
const myChart = new Chart(ctx, { |
|||
type: 'line', |
|||
data: { |
|||
labels: [ |
|||
'-60m', |
|||
'-55m', |
|||
'-50m', |
|||
'-45m', |
|||
'-40m', |
|||
'-35m', |
|||
'-30m', |
|||
'-25m', |
|||
'-20m', |
|||
'-15m', |
|||
'-10m', |
|||
'-5m', |
|||
], |
|||
datasets: [ |
|||
{ |
|||
// one line graph |
|||
label: 'Number of Moons', |
|||
data: [0, 0, 1, 2, 37, 42, 27, 14, null, 10, 10, 55], |
|||
|
|||
borderColor: [ |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
'#36495d', |
|||
], |
|||
borderWidth: 3, |
|||
}, |
|||
], |
|||
}, |
|||
options: { |
|||
responsive: true, |
|||
scales: { |
|||
yAxes: [ |
|||
{ |
|||
ticks: { |
|||
beginAtZero: true, |
|||
padding: 5, |
|||
max: 60, |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,33 @@ |
|||
<template> |
|||
<table |
|||
class="table |
|||
table is-striped |
|||
table is-hoverable |
|||
has-text-left |
|||
table is-fullwidth" |
|||
> |
|||
<thead> |
|||
<tr> |
|||
<th><abbr title="Device">Device id</abbr></th> |
|||
<th><abbr title="Time">Time</abbr></th> |
|||
<th><abbr title="Temp">Measurement</abbr></th> |
|||
</tr> |
|||
</thead> |
|||
<tr v-for="(point, index) in points" :key="index"> |
|||
<td class="is-family-monospace">{{ point.client }}</td> |
|||
<td>{{ new Date(point.time).toLocaleString() }}</td> |
|||
<td>{{ point.value }}°C</td> |
|||
</tr> |
|||
</table> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { Options, Vue } from 'vue-class-component'; |
|||
import { Component, Prop } from 'vue-property-decorator'; |
|||
|
|||
export default class Table extends Vue { |
|||
@Prop() readonly points!: []; |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
Loading…
Reference in new issue