MCPcopy Create free account
hub / github.com/chrxh/alien / plotSumColorsIntern

Method plotSumColorsIntern

source/Gui/StatisticsWindow.cpp:560–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558}
559
560void StatisticsWindow::plotSumColorsIntern(
561 int row,
562 DataPoint const* dataPoints,
563 double const* timePoints,
564 double const* systemClock,
565 int count,
566 double startTime,
567 double endTime,
568 int fracPartDecimals)
569{
570 auto constexpr strideBytes = sizeof(DataPointCollection);
571 auto constexpr strideDouble = sizeof(DataPointCollection) / sizeof(double);
572
573 double const* plotDataY = reinterpret_cast<double const*>(dataPoints) + MAX_COLORS;
574 double upperBound = getMaxWithDataPointStride(plotDataY, timePoints, startTime, count);
575 double endValue = count > 0 ? plotDataY[(count - 1) * strideDouble] : 0.0;
576 upperBound = getUpperBound(upperBound);
577
578 ImGui::PushID(row);
579 ImPlot::PushStyleColor(ImPlotCol_FrameBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha));
580 ImPlot::PushStyleColor(ImPlotCol_PlotBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha));
581 ImPlot::PushStyleColor(ImPlotCol_PlotBorder, (ImU32)ImColor(0.3f, 0.3f, 0.3f, ImGui::GetStyle().Alpha));
582 ImPlot::PushStyleVar(ImPlotStyleVar_PlotPadding, ImVec2(0, 0));
583 ImPlot::SetNextAxesLimits(startTime, endTime, 0, upperBound, ImGuiCond_Always);
584
585 if (ImPlot::BeginPlot("##", ImVec2(-1, scale(calcPlotHeight(row))), ImPlotFlags_NoMouseText)) {
586 ImPlot::SetupAxis(ImAxis_X1, "", ImPlotAxisFlags_NoTickLabels);
587 ImPlot::SetupAxis(ImAxis_Y1, "", ImPlotAxisFlags_NoTickLabels);
588 ImPlot::SetupAxisFormat(ImAxis_X1, "");
589 ImPlot::SetupAxisFormat(ImAxis_Y1, "");
590 setPlotScale();
591 auto color = ImPlot::GetColormapColor((row % 21) <= 10 ? (row % 21) : 20 - (row % 21));
592 if (ImGui::GetStyle().Alpha == 1.0f) {
593 ImPlot::Annotation(
594 endTime, endValue, ImPlot::GetLastItemColor(), ImVec2(-10.0f, 15.0f), true, "%s", StringHelper::format(toFloat(endValue), fracPartDecimals).c_str());
595 }
596 if (count > 0) {
597 ImPlot::PushStyleColor(ImPlotCol_Line, color);
598 ImPlot::PlotLine("##", timePoints, plotDataY, count, 0, 0, strideBytes);
599 ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, 0.5f * ImGui::GetStyle().Alpha);
600 ImPlot::PlotShaded("##", timePoints, plotDataY, count, 0, 0, 0, strideBytes);
601 ImPlot::PopStyleVar();
602 ImPlot::PopStyleColor();
603 }
604 if (ImGui::GetStyle().Alpha == 1.0f && ImPlot::IsPlotHovered() && count > 0) {
605 drawValuesAtMouseCursor(plotDataY, timePoints, systemClock, count, startTime, endTime, upperBound, fracPartDecimals);
606 }
607 ImPlot::EndPlot();
608 }
609 ImPlot::PopStyleVar();
610 ImPlot::PopStyleColor(3);
611 ImGui::PopID();
612}
613
614void StatisticsWindow::plotByColorIntern(
615 int row,

Callers

nothing calls this directly

Calls 4

ImVec2Class · 0.85
scaleFunction · 0.85
toFloatFunction · 0.85

Tested by

no test coverage detected