13 , _data_name(QString::fromStdString(
data.plotName()))
14 , _colormap_name(colormap_name)
20 const QRectF& canvasRect)
const
31 auto colormap = it->second;
33 double prev_Y =
_data[0].y;
34 double min_interval =
_data[0].x;
35 QColor prev_color = colormap->mapColor(prev_Y);
37 auto isEqual = [](
double a,
double b) {
38 return abs(a - b) < std::numeric_limits<float>::epsilon();
44 for (
size_t i = 1; i < N; i++)
46 const auto& point =
_data[i];
47 if (isEqual(prev_Y, point.y) && (i + 1) < N)
51 QColor
color = colormap->mapColor(point.y);
52 if (prev_color !=
color || (i + 1) == N)
54 double max_interval = point.x;
55 double x1 = xMap.
transform(min_interval - time_offset);
56 double x2 = xMap.
transform(max_interval - time_offset);
58 QRectF r(x1, canvasRect.top(), x2 - x1, canvasRect.height());
61 if (x1 < x2 && prev_color != Qt::transparent)
66 min_interval = max_interval;