| 558 | } |
| 559 | |
| 560 | void 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 | |
| 614 | void StatisticsWindow::plotByColorIntern( |
| 615 | int row, |
nothing calls this directly
no test coverage detected