skunkforce / OmniView

This Repository contains the OmniView Software, which is used in the AW4null Research Projects
https://www.autowerkstatt40.org/
MIT License
3 stars 4 forks source link

added legend changes - colour should be replaced #125

Closed DanielNowak98 closed 2 weeks ago

DanielNowak98 commented 1 month ago

I have added style changes for the legend. However, due to the color alteration, the labels of the individual scopes are hardly readable. Therefore, I have temporarily made them white. The color can still be changed. Furthermore, I have changed the location of the legend. It is now positioned in the top right corner, reducing the risk of covering parts of the plot.

added to Style.cpp:

void SetImPlotLegendProperties() {
  // Legenden-Hintergrundfarbe ändern
  ImPlotStyle &plotStyle = ImPlot::GetStyle();
  plotStyle.Colors[ImPlotCol_LegendBg] =
      ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // Dunkelgrau
}

and to Style.hpp: void SetImPlotLegendProperties();

and this to main:

    SetImPlotLegendProperties();

    addPlots("Recording the data", captureData,
             [&sampler, &xmax_paused](auto /*x_min*/, auto x_max) {
               if (!flagPaused) {
                 ImPlot::SetupAxes("x [Data points]", "y [ADC Value]",
                                   ImPlotAxisFlags_AutoFit,
                                   ImPlotAxisFlags_AutoFit);
                 ImPlot::SetupAxisLimits(ImAxis_X1, x_max - 7500, x_max + 7500,
                                         ImGuiCond_Always);
               } else {
                 xmax_paused = x_max;
                 ImPlot::SetupAxes("x [Seconds]", "y [Volts]");
                 // x and y axes ranges: [0, 10], [-10, 200]
                 ImPlot::SetupAxesLimits(0, 10, -10, 200);
                 // make specific values/ticks on Y-axis
                 ImPlot::SetupAxisTicks(ImAxis_Y1, -10, 200, 22, nullptr, true);
                 ImPlot::SetupLegend(ImPlotLocation_NorthEast);
               }
             });

    ImGui::EndChild();
DanielNowak98 commented 2 weeks ago

152