diff --git a/src/Charts/LTMWindow.cpp b/src/Charts/LTMWindow.cpp index aabd6089b..47bd92579 100644 --- a/src/Charts/LTMWindow.cpp +++ b/src/Charts/LTMWindow.cpp @@ -1160,14 +1160,17 @@ LTMWindow::dataTable(bool html) // align the starting X values of all columns using the // lowest xValue and highest xValue as borders - if (lowestFirstXvalue != highestFirstXvalue) { + // for columns which have data at all - and if there is something to adjust + if (!firstXvalue && lowestFirstXvalue != highestFirstXvalue) { for (int i = 0; i< columns.count(); i++) { - double xValue = columns[i].x[0]; - while (columns[i].x[0] > lowestFirstXvalue) { - xValue--; - columns[i].x.prepend(xValue); - columns[i].y.prepend(0.0); - columns[i].n++; + if (columns[i].n > 0) { + double xValue = columns[i].x[0]; + while (columns[i].x[0] > lowestFirstXvalue) { + xValue--; + columns[i].x.prepend(xValue); + columns[i].y.prepend(0.0); + columns[i].n++; + } } } // adjust number of visible rows in table