Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit bbe777c

Browse files
committed
legend dark
1 parent 501fa20 commit bbe777c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

frontend/src/components/ChartCard.vue

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<v-card>
3-
<div id="chart" style="width: 100%; height: 420px;"></div>
3+
<div ref="chart" style="width: 100%; height: 420px;"></div>
44
</v-card>
55
</template>
66
<script>
@@ -44,8 +44,7 @@ export default {
4444
this.ws.close();
4545
},
4646
mounted() {
47-
const el = document.getElementById("chart");
48-
this.chart = new timechart(el, {
47+
this.chart = new timechart(this.$refs.chart, {
4948
baseTime: Date.now() - performance.now(),
5049
series: [],
5150
xRange: { min: 0, max: 20 * 1000 },
@@ -56,12 +55,16 @@ export default {
5655
isDark: function() {
5756
if (this.isDark) {
5857
for (var i in this.chart.options.series) {
59-
this.chart.options.series[i].color = this.lineColors.dark[i];
58+
this.chart.options.series[i].color = this.lineColors.dark[i];
6059
}
60+
this.$refs.chart.querySelector("chart-legend").style.backgroundColor =
61+
"black";
6162
} else {
6263
for (i in this.chart.options.series) {
63-
this.chart.options.series[i].color = this.lineColors.light[i];
64+
this.chart.options.series[i].color = this.lineColors.light[i];
6465
}
66+
this.$refs.chart.querySelector("chart-legend").style.backgroundColor =
67+
"white";
6568
}
6669
this.chart.update();
6770
}

0 commit comments

Comments
 (0)