Skip to content

Commit 8e96332

Browse files
author
Jim Hague
committed
If data is not a timeseries, don't attempt a time range zoom on select or lasso.
You will most end up treating non-time data as timestamps, with hilarious results.
1 parent d318986 commit 8e96332

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/module.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl {
144144
series: SeriesWrapper[];
145145
seriesByKey: Map<string, SeriesWrapper> = new Map();
146146
seriesHash = '?';
147+
seriesIsTimeseries = true;
147148

148149
traces: any[]; // The data sent directly to Plotly -- with a special __copy element
149150
layout: any; // The layout used by Plotly
@@ -514,6 +515,11 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl {
514515
return;
515516
}
516517

518+
if (!this.seriesIsTimeseries) {
519+
console.log('Not timeseries data, time zoom disabled');
520+
return;
521+
}
522+
517523
if (data.points.length === 0) {
518524
console.log('Nothing Selected', data);
519525
return;
@@ -600,6 +606,7 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl {
600606
}
601607

602608
const useRefID = dataList.length === this.panel.targets.length;
609+
this.seriesIsTimeseries = true;
603610
dataList.forEach((series, sidx) => {
604611
let refId = '';
605612
if (autotrace) {
@@ -624,6 +631,8 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl {
624631
} else {
625632
console.error('Unsupported Series response', sidx, series);
626633
}
634+
if (series.type === 'table')
635+
this.seriesIsTimeseries = false;
627636
});
628637
}
629638
this.seriesByKey.clear();

0 commit comments

Comments
 (0)