Fix a bug with the interval label for TSVB (#13440)

* Fix a bug with the interval label for TSVB

* Ensure reduce returns something
This commit is contained in:
Chris Cowan 2017-08-10 19:23:00 +02:00
parent 511ffa22a5
commit f89f89f0e6

View file

@ -80,8 +80,11 @@ function TimeseriesVisualization(props) {
});
const interval = series.reduce((currentInterval, item) => {
const seriesInterval = item.data[1][0] - item.data[0][0];
if (!currentInterval || seriesInterval < currentInterval) return seriesInterval;
if (item.data.length > 1) {
const seriesInterval = item.data[1][0] - item.data[0][0];
if (!currentInterval || seriesInterval < currentInterval) return seriesInterval;
}
return currentInterval;
}, 0);
let axisCount = 1;