test heightmap with echarts.js

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2021-02-14 12:23:37 +01:00
parent 6aa99bc75f
commit d8dff1affa
5 changed files with 230 additions and 28 deletions

View File

@@ -0,0 +1,53 @@
<template>
<div id="heightmap" style="height: 400px; width: 100%;"></div>
</template>
<script>
import { mapState } from 'vuex'
import * as echarts from 'echarts'
export default {
components: {
},
data: function() {
return {
chart : null,
chartOptions: {
animation: false,
series: []
},
}
},
computed: {
...mapState({
intervalChartUpdate: state => state.gui.tempchart.intervalChartUpdate,
intervalDatasetUpdate: state => state.gui.tempchart.intervalDatasetUpdate,
}),
series: {
get () {
return this.$store.state.printer.tempHistory.series
}
},
},
methods: {
createChart() {
if (document.getElementById("tempchart") && this.chart === null) {
this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'svg'})
this.chart.setOption(this.chartOptions)
} else setTimeout(() => {
this.createChart()
}, 500)
}
},
created() {
window.addEventListener('resize', () => {
if (this.chart) this.chart.resize()
})
},
mounted: function() {
this.createChart()
}
}
</script>

View File

@@ -5,7 +5,7 @@
<script>
import { mapState } from 'vuex'
import * as echarts from 'echarts'
import {convertName} from "@/plugins/helpers";
import { convertName } from "@/plugins/helpers";
export default {
components: {
@@ -186,7 +186,7 @@ export default {
methods: {
createChart() {
if (document.getElementById("tempchart") && this.chart === null) {
this.chart = echarts.init(document.getElementById("tempchart"))
this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'svg'})
this.chart.setOption(this.chartOptions)
} else setTimeout(() => {
this.createChart()