Skip to content

Commit

Permalink
fix for #31
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Nov 30, 2024
1 parent 3cecd05 commit 93631da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/headers/LogToGraphBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define LogToGraph_Prefix "LogToGraph"
#define LogToGraph_BuildNumber 1051
#define LogToGraph_BuildNumber 1053
#define LogToGraph_MinorNumber 2
#define LogToGraph_MajorNumber 0
#define LogToGraph_BuildId "0.2.1051"
#define LogToGraph_BuildId "0.2.1053"
18 changes: 15 additions & 3 deletions src/models/graphs/GraphView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
double last_value = _data_ptr_0->value, current_value;
std::string last_string = _data_ptr_0->string, current_string;
std::string last_status = _data_ptr_0->status, current_status;
std::string last_desc = _data_ptr_0->desc, current_desc;
bool _is_h_hovered = false;

last_value_pos = ImPlot::PlotToPixels(last_time, _data_ptr_0->value);
Expand All @@ -822,6 +823,11 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
current_value = _data_ptr_i->value;
current_string = _data_ptr_i->string;
current_status = _data_ptr_i->status;
current_desc = _data_ptr_i->desc;
if (i == 1U && !current_desc.empty() && last_desc.empty()) {
last_desc = current_desc;
}

value_pos = ImPlot::PlotToPixels(current_time, current_value);

ImPlot::FitPoint(ImPlotPoint(current_time, current_value));
Expand Down Expand Up @@ -912,12 +918,17 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
if (last_string.empty()) {
// tofix : to refactor
const auto p_min = ImGui::GetCursorScreenPos() - ImVec2(spacing_L, spacing_U);
const auto p_max = ImVec2(p_min.x + ImGui::GetContentRegionAvail().x + spacing_R,
p_min.y + (ImGui::GetFrameHeight() - spacing_D));
const auto p_max = ImVec2( //
p_min.x + ImGui::GetContentRegionAvail().x + spacing_R,
p_min.y + (ImGui::GetFrameHeight() - spacing_D) * 2.0f);
ImGui::GetWindowDrawList()->AddRectFilled(p_min, p_max, _color);
const bool pushed = ImGui::PushStyleColorWithContrast4(
_color, ImGuiCol_Text, ImGui::CustomStyle::puContrastedTextColor, ImGui::CustomStyle::puContrastRatio);
ImGui::Text("%s : %f", name_str.c_str(), last_value);
if (!last_desc.empty()) {
ImGui::Text("%f (%s) %s", last_value, last_desc.c_str(), name_str.c_str());
} else {
ImGui::Text("%f %s", last_value, name_str.c_str());
}
if (pushed)
ImGui::PopStyleColor();
} else {
Expand Down Expand Up @@ -963,6 +974,7 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
last_value = current_value;
last_string = current_string;
last_status = current_status;
last_desc = current_desc;
}
}

Expand Down

0 comments on commit 93631da

Please sign in to comment.