-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathBitstream.vue
84 lines (80 loc) · 3 KB
/
Bitstream.vue
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!--
Copyright 2017-2022 F4PGA Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
-->
<template>
<div class="example">
<h3>Bitstream map:</h3>
<apexcharts width="2400" height="3200" type="heatmap" :options="chartOptions" :series="series" v-on:dataPointSelection="dataPointSelected"></apexcharts>
<modal v-if="showModal" v-on:close="showModal = false" v-bind:frameAddr="frameAddr" v-bind:gridx="gridx" v-bind:gridy="gridy"></modal>
</div>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
import modal from './Popup.vue'
export default {
name: 'Chart',
components: {
apexcharts: VueApexCharts,
modal,
},
methods: {
dataPointSelected: function(e, chart, opts) {
this.frameAddr = opts.w.config.series[opts.seriesIndex].data[opts.dataPointIndex].address;
this.gridx = opts.w.config.series[opts.seriesIndex].data[opts.dataPointIndex].x
this.gridy = opts.w.config.series[opts.seriesIndex].name
this.showModal = true;
}
},
data: function() {
return {
showModal: false,
frameAddr: '',
gridx: -1,
gridy: -1,
chartOptions: {
chart: {
type: 'heatmap',
id: 'heatmap',
animations: { enabled: false },
},
plotOptions: { heatmap: { colorScale: { ranges: [ {from: -1, to: -1, name: 'Unknown', color: '#ff0000'},{from: 0, to: 0, name: 'Empty', color: '#f2f2f2'},{from: 1, to: 1, name: 'Used', color: '#128FD9'} ] } } },
colors: ["#008FFB"],
dataLabels: {
enabled: false,
},
grid: { position: 'front', xaxis: { lines: { show: false } }, yaxis: { lines: { show: false } } },
xaxis: { tickAmount: 'dataPoints', tickPlacement: 'on' },
tooltip: {
enabled: true,
y: {
formatter: function(value, { seriesIndex, dataPointIndex, w }) {
let point = w.config.series[seriesIndex].data[dataPointIndex]
return (
'Grid: ' + point.x + ' @ ' + w.config.series[seriesIndex].name
);
},
title: { formatter: () => '' },
}
}
},
series: [
{ name: 0, data: [{ x: 0, y: 0, address: '0x00000000' }]},
],
}
},
mounted: function() {
const body = () => import('./bitstreamData.json')
body().then(data => this.$children[0].updateSeries(data.data, false))
},
}
</script>