Show all lines in legend

This commit is contained in:
Matthias 2020-06-23 21:18:43 +02:00
parent e41b23e02f
commit 6e497f1214
2 changed files with 8 additions and 3 deletions

View File

@ -9,6 +9,7 @@
<script>
import { timestampms } from '@/shared/formatters';
import ECharts from 'vue-echarts';
import randomColor from '../../shared/randomColor';
import 'echarts';
const MARGINLEFT = '5%';
@ -103,7 +104,6 @@ export default {
if ('subplots' in this.plotConfig) {
let plotIndex = 2;
Object.entries(this.plotConfig.subplots).forEach(([key, value]) => {
subPlots.legend.push(key);
// define yaxis
subPlots.yaxis.push({
scale: true,
@ -134,16 +134,17 @@ export default {
height: '8%',
});
Object.entries(value).forEach(([sk, sv]) => {
subPlots.legend.push(sk);
// entries per subplot
const col = this.dataset.columns.findIndex((el) => el === sk);
if (col) {
const sp = {
name: key,
name: sk,
type: 'line',
xAxisIndex: plotIndex,
yAxisIndex: plotIndex,
itemStyle: {
color: sv.color,
color: sv.color || randomColor(),
},
encode: {
x: colDate,

View File

@ -0,0 +1,4 @@
export default function () {
// eslint-disable-next-line no-bitwise
return `#${((Math.random() * 0xffffff) << 0).toString(16)}`;
}