##// END OF EJS Templates
Uses the same time spec (UTC) as axis for tooltips on graph
Alexandre Leroux -
r490:431d583ca834
parent child
Show More
@@ -25,6 +25,7 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
25 25 if (isTimeAxis) {
26 26 auto dateTicker = QSharedPointer<QCPAxisTickerDateTime>::create();
27 27 dateTicker->setDateTimeFormat(DATETIME_TICKER_FORMAT);
28 dateTicker->setDateTimeSpec(Qt::UTC);
28 29
29 30 return dateTicker;
30 31 }
@@ -1,6 +1,8
1 1 #include "Visualization/VisualizationGraphRenderingDelegate.h"
2 2 #include "Visualization/qcustomplot.h"
3 3
4 #include <Common/DateUtils.h>
5
4 6 namespace {
5 7
6 8 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz");
@@ -14,9 +16,12 const auto TRACER_TIMEOUT = 500;
14 16 QString formatValue(double value, const QCPAxis &axis)
15 17 {
16 18 // If the axis is a time axis, formats the value as a date
17 return qSharedPointerDynamicCast<QCPAxisTickerDateTime>(axis.ticker())
18 ? QCPAxisTickerDateTime::keyToDateTime(value).toString(DATETIME_FORMAT)
19 : QString::number(value);
19 if (auto axisTicker = qSharedPointerDynamicCast<QCPAxisTickerDateTime>(axis.ticker())) {
20 return DateUtils::dateTime(value, axisTicker->dateTimeSpec()).toString(DATETIME_FORMAT);
21 }
22 else {
23 return QString::number(value);
24 }
20 25 }
21 26
22 27 void initPointTracerStyle(QCPItemTracer &tracer) noexcept
General Comments 0
You need to be logged in to leave comments. Login now