| 612 | } |
| 613 | |
| 614 | void StatisticsWindow::plotByColorIntern( |
| 615 | int row, |
| 616 | DataPoint const* values, |
| 617 | double const* timePoints, |
| 618 | int count, |
| 619 | double startTime, |
| 620 | double endTime, |
| 621 | int fracPartDecimals) |
| 622 | { |
| 623 | auto upperBound = 0.0; |
| 624 | for (int i = 0; i < MAX_COLORS; ++i) { |
| 625 | upperBound = std::max(upperBound, getMaxWithDataPointStride(reinterpret_cast<double const*>(values) + i, timePoints, startTime, count)); |
| 626 | } |
| 627 | upperBound = getUpperBound(upperBound); |
| 628 | |
| 629 | ImGui::PushID(row); |
| 630 | ImPlot::PushStyleColor(ImPlotCol_FrameBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha)); |
| 631 | ImPlot::PushStyleColor(ImPlotCol_PlotBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha)); |
| 632 | ImPlot::PushStyleColor(ImPlotCol_PlotBorder, (ImU32)ImColor(0.3f, 0.3f, 0.3f, ImGui::GetStyle().Alpha)); |
| 633 | ImPlot::PushStyleVar(ImPlotStyleVar_PlotPadding, ImVec2(0, 0)); |
| 634 | ImPlot::PushStyleVar(ImPlotStyleVar_LineWeight, 1.5f); |
| 635 | ImPlot::SetNextAxesLimits(startTime, endTime, 0, upperBound, ImGuiCond_Always); |
| 636 | |
| 637 | auto isCollapsed = _collapsedPlotIndices.contains(row); |
| 638 | auto flags = _plotHeight > 159.0f && !isCollapsed ? ImPlotFlags_None : ImPlotFlags_NoLegend; |
| 639 | if (ImPlot::BeginPlot("##", ImVec2(-1, scale(calcPlotHeight(row))), flags)) { |
| 640 | ImPlot::SetupAxis(ImAxis_X1, "", ImPlotAxisFlags_NoTickLabels); |
| 641 | ImPlot::SetupAxis(ImAxis_Y1, "", ImPlotAxisFlags_NoTickLabels); |
| 642 | ImPlot::SetupAxisFormat(ImAxis_X1, ""); |
| 643 | ImPlot::SetupAxisFormat(ImAxis_Y1, ""); |
| 644 | setPlotScale(); |
| 645 | for (int i = 0; i < MAX_COLORS; ++i) { |
| 646 | ImGui::PushID(i); |
| 647 | auto colorRaw = Const::IndividualCellColors[i]; |
| 648 | ImColor color(toInt((colorRaw >> 16) & 0xff), toInt((colorRaw >> 8) & 0xff), toInt(colorRaw & 0xff)); |
| 649 | |
| 650 | ImPlot::PushStyleColor(ImPlotCol_Line, (ImU32)color); |
| 651 | auto endValue = count > 0 ? *(reinterpret_cast<double const*>(reinterpret_cast<DataPointCollection const*>(values) + (count - 1)) + i) : 0.0f; |
| 652 | auto labelId = StringHelper::format(toFloat(endValue), fracPartDecimals); |
| 653 | ImPlot::PlotLine(labelId.c_str(), timePoints, reinterpret_cast<double const*>(values) + i, count, 0, 0, sizeof(DataPointCollection)); |
| 654 | ImPlot::PopStyleColor(); |
| 655 | ImGui::PopID(); |
| 656 | } |
| 657 | |
| 658 | ImPlot::EndPlot(); |
| 659 | } |
| 660 | ImPlot::PopStyleVar(2); |
| 661 | ImPlot::PopStyleColor(3); |
| 662 | ImGui::PopID(); |
| 663 | } |
| 664 | |
| 665 | void StatisticsWindow::plotForColorIntern( |
| 666 | int row, |
nothing calls this directly
no test coverage detected