Handle situations where there is no reference
This commit is contained in:
parent
dd0847a6ae
commit
fe40eda28f
1 changed files with 2 additions and 3 deletions
|
@ -107,13 +107,12 @@ class LineChart extends Component {
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
const shapes = references.split(' ').map((spec, idx) => {
|
const shapes = references.split(' ').filter(spec => !isNaN(parseFloat(spec))).map((spec, idx) => {
|
||||||
let colorIdx = data.length + idx;
|
let colorIdx = data.length + idx;
|
||||||
if (colorIdx > colors.length) {
|
if (colorIdx > colors.length) {
|
||||||
// Start cycle again
|
// Start cycle again
|
||||||
colorIdx = idx;
|
colorIdx = idx;
|
||||||
}
|
}
|
||||||
let color = colors[colorIdx];
|
|
||||||
const res = {
|
const res = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
xref: 'paper', // x relative to [0,1] "paper" axis
|
xref: 'paper', // x relative to [0,1] "paper" axis
|
||||||
|
@ -123,7 +122,7 @@ class LineChart extends Component {
|
||||||
y0: parseFloat(spec),
|
y0: parseFloat(spec),
|
||||||
y1: parseFloat(spec),
|
y1: parseFloat(spec),
|
||||||
line: {
|
line: {
|
||||||
color,
|
color: colors[colorIdx],
|
||||||
width: 1,
|
width: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue