From 4d48c485191cbbf5aa252ec25b12d67f36eb4e26 Mon Sep 17 00:00:00 2001 From: "David Millan (Damiles)" Date: Thu, 8 Jun 2017 08:56:27 +0200 Subject: [PATCH] Add plot bar labels --- src/OpenCVGUI/OGUIPlotArea.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenCVGUI/OGUIPlotArea.cpp b/src/OpenCVGUI/OGUIPlotArea.cpp index ccee1e6..91cca5e 100644 --- a/src/OpenCVGUI/OGUIPlotArea.cpp +++ b/src/OpenCVGUI/OGUIPlotArea.cpp @@ -615,12 +615,12 @@ namespace OpenCVGUI { NVGcolor color= nvgRGBA(color_scheme.at(c), color_scheme.at(c+1), color_scheme.at(c+2), 255); // Dots for (int i = 0; i < data.cols; i++) { - float dot_x=start_x + i * dx; + float dot_x=start_x + i * dx + bar_width * p; float dot_y=start_y - dy * ((data.at(p,i)) / m); // Draw hover label if(isMouseIn()) { - if( dot_y-4<= window->mouse_y && window->mouse_y <= dot_y+4 && - dot_x-4<= window->mouse_x && window->mouse_x <= dot_x+4 ){ + if( dot_y<= window->mouse_y && window->mouse_y <= start_y && + dot_x<= window->mouse_x && window->mouse_x <= dot_x+bar_width ){ // Calculate text width for box nvgFontSize(vg, 16.0f);