Skip to content

Commit 93631da

Browse files
committed
fix for #31
1 parent 3cecd05 commit 93631da

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/headers/LogToGraphBuild.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#define LogToGraph_Prefix "LogToGraph"
4-
#define LogToGraph_BuildNumber 1051
4+
#define LogToGraph_BuildNumber 1053
55
#define LogToGraph_MinorNumber 2
66
#define LogToGraph_MajorNumber 0
7-
#define LogToGraph_BuildId "0.2.1051"
7+
#define LogToGraph_BuildId "0.2.1053"

src/models/graphs/GraphView.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
812812
double last_value = _data_ptr_0->value, current_value;
813813
std::string last_string = _data_ptr_0->string, current_string;
814814
std::string last_status = _data_ptr_0->status, current_status;
815+
std::string last_desc = _data_ptr_0->desc, current_desc;
815816
bool _is_h_hovered = false;
816817

817818
last_value_pos = ImPlot::PlotToPixels(last_time, _data_ptr_0->value);
@@ -822,6 +823,11 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
822823
current_value = _data_ptr_i->value;
823824
current_string = _data_ptr_i->string;
824825
current_status = _data_ptr_i->status;
826+
current_desc = _data_ptr_i->desc;
827+
if (i == 1U && !current_desc.empty() && last_desc.empty()) {
828+
last_desc = current_desc;
829+
}
830+
825831
value_pos = ImPlot::PlotToPixels(current_time, current_value);
826832

827833
ImPlot::FitPoint(ImPlotPoint(current_time, current_value));
@@ -912,12 +918,17 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
912918
if (last_string.empty()) {
913919
// tofix : to refactor
914920
const auto p_min = ImGui::GetCursorScreenPos() - ImVec2(spacing_L, spacing_U);
915-
const auto p_max = ImVec2(p_min.x + ImGui::GetContentRegionAvail().x + spacing_R,
916-
p_min.y + (ImGui::GetFrameHeight() - spacing_D));
921+
const auto p_max = ImVec2( //
922+
p_min.x + ImGui::GetContentRegionAvail().x + spacing_R,
923+
p_min.y + (ImGui::GetFrameHeight() - spacing_D) * 2.0f);
917924
ImGui::GetWindowDrawList()->AddRectFilled(p_min, p_max, _color);
918925
const bool pushed = ImGui::PushStyleColorWithContrast4(
919926
_color, ImGuiCol_Text, ImGui::CustomStyle::puContrastedTextColor, ImGui::CustomStyle::puContrastRatio);
920-
ImGui::Text("%s : %f", name_str.c_str(), last_value);
927+
if (!last_desc.empty()) {
928+
ImGui::Text("%f (%s) %s", last_value, last_desc.c_str(), name_str.c_str());
929+
} else {
930+
ImGui::Text("%f %s", last_value, name_str.c_str());
931+
}
921932
if (pushed)
922933
ImGui::PopStyleColor();
923934
} else {
@@ -963,6 +974,7 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
963974
last_value = current_value;
964975
last_string = current_string;
965976
last_status = current_status;
977+
last_desc = current_desc;
966978
}
967979
}
968980

0 commit comments

Comments
 (0)