diff --git a/gui/src/Visualization/AxisRenderingUtils.cpp b/gui/src/Visualization/AxisRenderingUtils.cpp index 03b9811..4e88ca9 100644 --- a/gui/src/Visualization/AxisRenderingUtils.cpp +++ b/gui/src/Visualization/AxisRenderingUtils.cpp @@ -16,6 +16,9 @@ const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz"); /// Format for datetimes on a axis const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); +const auto NUMBER_FORMAT = 'g'; +const auto NUMBER_PRECISION = 9; + /// Generates the appropriate ticker for an axis, depending on whether the axis displays time or /// non-time data QSharedPointer axisTicker(bool isTimeAxis, QCPAxis::ScaleType scaleType) @@ -151,7 +154,7 @@ QString formatValue(double value, const QCPAxis &axis) return DateUtils::dateTime(value, axisTicker->dateTimeSpec()).toString(DATETIME_FORMAT); } else { - return QString::number(value); + return QString::number(value, NUMBER_FORMAT, NUMBER_PRECISION); } } diff --git a/gui/src/Visualization/VisualizationGraphRenderingDelegate.cpp b/gui/src/Visualization/VisualizationGraphRenderingDelegate.cpp index bb7cec4..7d47047 100644 --- a/gui/src/Visualization/VisualizationGraphRenderingDelegate.cpp +++ b/gui/src/Visualization/VisualizationGraphRenderingDelegate.cpp @@ -29,6 +29,8 @@ const auto SHOW_AXIS_ICON_PATH = QStringLiteral(":/icones/up.png"); /// Tooltip format for graphs const auto GRAPH_TOOLTIP_FORMAT = QStringLiteral("key: %1\nvalue: %2"); +/// Tooltip format for colormaps +const auto COLORMAP_TOOLTIP_FORMAT = QStringLiteral("x: %1\ny: %2\nvalue: %3"); /// Offset used to shift the tooltip of the mouse const auto TOOLTIP_OFFSET = QPoint{20, 20}; @@ -274,6 +276,10 @@ void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexce auto yCellIndex = colorMapCellIndex(*colorMap, y, false); auto value = colorMap->data()->cell(xCellIndex, yCellIndex); + // Sets tooltips + tooltip = COLORMAP_TOOLTIP_FORMAT.arg(formatValue(x, *colorMap->keyAxis()), + formatValue(y, *colorMap->valueAxis()), + formatValue(value, *colorMap->colorScale()->axis())); } if (!tooltip.isEmpty()) {