Skip to content

Commit 483a54d

Browse files
committed
Fixing gnuplot index calculation when no data rows are returned.
1 parent 0a39570 commit 483a54d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/gnuplot.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ void SpGnuplot::multiplot(size_t ln, size_t indent, const std::string& cmdline)
321321
// collect coordinates groups
322322
{
323323
std::vector<std::string> lastgroup;
324+
size_t rows = 0;
324325

325326
while (sql->step())
326327
{
@@ -356,8 +357,13 @@ void SpGnuplot::multiplot(size_t ln, size_t indent, const std::string& cmdline)
356357
// group fields match with last row -> append coordinates.
357358
df << sql->text(colx) << '\t'
358359
<< sql->text(coly) << std::endl;
360+
361+
++rows;
359362
}
360363

364+
if (rows == 0)
365+
df << "- # (no data rows)" << std::endl;
366+
361367
// finish last plot
362368
df << std::endl << std::endl;
363369
++m_dataindex;

0 commit comments

Comments
 (0)