{
const Waterfallplot& m_waterfallPlot;
public:
WaterfallTimeScaleDraw(const Waterfallplot& waterfall) :
m_waterfallPlot(waterfall)
{
}
// When I add data, I need to invalidate y axis cache, so I need to make invalidateCache public !
// and use : static_cast<WaterfallTimeScaleDraw*>(m_plot->axisScaleDraw(QwtPlot::yLeft))->invalidateCache();
// I noticed that for a waterfall having 64 layers (history), v is called with 0, 10, 20, 30, 40, 50 and 60
// Thus, it's clear that we can't have a "fall" effect with such values
virtual QwtText label
(double v
) const {
time_t ret = m_waterfallPlot.getLayerDate(v);
if (ret > 0)
{
m_dateTime.setTime_t(ret);
//return m_dateTime.toString("hh:mm:ss:zzz"); // change time_t => zzz
return m_dateTime.toString("hh:mm:ss");
}
return QwtText();
// this is only executed when the waterfall is not completely filled }
};
class WaterfallTimeScaleDraw: public QwtScaleDraw
{
const Waterfallplot& m_waterfallPlot;
mutable QDateTime m_dateTime;
public:
WaterfallTimeScaleDraw(const Waterfallplot& waterfall) :
m_waterfallPlot(waterfall)
{
}
// When I add data, I need to invalidate y axis cache, so I need to make invalidateCache public !
// and use : static_cast<WaterfallTimeScaleDraw*>(m_plot->axisScaleDraw(QwtPlot::yLeft))->invalidateCache();
using QwtScaleDraw::invalidateCache;
// I noticed that for a waterfall having 64 layers (history), v is called with 0, 10, 20, 30, 40, 50 and 60
// Thus, it's clear that we can't have a "fall" effect with such values
virtual QwtText label(double v) const
{
time_t ret = m_waterfallPlot.getLayerDate(v);
if (ret > 0)
{
m_dateTime.setTime_t(ret);
//return m_dateTime.toString("hh:mm:ss:zzz"); // change time_t => zzz
return m_dateTime.toString("hh:mm:ss");
}
return QwtText(); // this is only executed when the waterfall is not completely filled
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks