| 663 | } |
| 664 | |
| 665 | void StatisticsWindow::plotForColorIntern( |
| 666 | int row, |
| 667 | DataPoint const* values, |
| 668 | int colorIndex, |
| 669 | double const* timePoints, |
| 670 | double const* systemClock, |
| 671 | int count, |
| 672 | double startTime, |
| 673 | double endTime, |
| 674 | int fracPartDecimals) |
| 675 | { |
| 676 | auto constexpr strideBytes = sizeof(DataPointCollection); |
| 677 | auto constexpr strideDouble = sizeof(DataPointCollection) / sizeof(double); |
| 678 | |
| 679 | auto valuesForColor = reinterpret_cast<double const*>(values) + colorIndex; |
| 680 | auto upperBound = getMaxWithDataPointStride(valuesForColor, timePoints, startTime, count); |
| 681 | upperBound = getUpperBound(upperBound); |
| 682 | auto endValue = count > 0 ? valuesForColor[(count - 1) * strideDouble] : 0.0; |
| 683 | |
| 684 | ImGui::PushID(row); |
| 685 | ImPlot::PushStyleColor(ImPlotCol_FrameBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha)); |
| 686 | ImPlot::PushStyleColor(ImPlotCol_PlotBg, (ImU32)ImColor(0.0f, 0.0f, 0.0f, ImGui::GetStyle().Alpha)); |
| 687 | ImPlot::PushStyleColor(ImPlotCol_PlotBorder, (ImU32)ImColor(0.3f, 0.3f, 0.3f, ImGui::GetStyle().Alpha)); |
| 688 | ImPlot::PushStyleVar(ImPlotStyleVar_PlotPadding, ImVec2(0, 0)); |
| 689 | ImPlot::SetNextAxesLimits(startTime, endTime, 0, upperBound, ImGuiCond_Always); |
| 690 | if (ImPlot::BeginPlot("##", ImVec2(-1, scale(calcPlotHeight(row))))) { |
| 691 | ImPlot::SetupAxis(ImAxis_X1, "", ImPlotAxisFlags_NoTickLabels); |
| 692 | ImPlot::SetupAxis(ImAxis_Y1, "", ImPlotAxisFlags_NoTickLabels); |
| 693 | ImPlot::SetupAxisFormat(ImAxis_X1, ""); |
| 694 | ImPlot::SetupAxisFormat(ImAxis_Y1, ""); |
| 695 | setPlotScale(); |
| 696 | |
| 697 | float h, s, v; |
| 698 | AlienImGui::ConvertRGBtoHSV(Const::IndividualCellColors[colorIndex], h, s, v); |
| 699 | auto color = static_cast<ImVec4>(ImColor::HSV(h, s, v)); |
| 700 | if (ImGui::GetStyle().Alpha == 1.0f) { |
| 701 | ImPlot::Annotation( |
| 702 | endTime, |
| 703 | endValue, |
| 704 | ImPlot::GetLastItemColor(), |
| 705 | ImVec2(-10.0f, 10.0f), |
| 706 | true, |
| 707 | "%s", |
| 708 | StringHelper::format(toFloat(endValue), fracPartDecimals).c_str()); |
| 709 | } |
| 710 | if (count > 0) { |
| 711 | ImPlot::PushStyleColor(ImPlotCol_Line, color); |
| 712 | ImPlot::PlotLine("##", timePoints, valuesForColor, count, 0, 0, strideBytes); |
| 713 | ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, 0.5f * ImGui::GetStyle().Alpha); |
| 714 | ImPlot::PlotShaded("##", timePoints, valuesForColor, count, 0, 0, 0, strideBytes); |
| 715 | ImPlot::PopStyleVar(); |
| 716 | ImPlot::PopStyleColor(); |
| 717 | if (ImGui::GetStyle().Alpha == 1.0f && ImPlot::IsPlotHovered()) { |
| 718 | drawValuesAtMouseCursor(valuesForColor, timePoints, systemClock, count, startTime, endTime, upperBound, fracPartDecimals); |
| 719 | } |
| 720 | } |
| 721 | ImPlot::EndPlot(); |
| 722 | } |
nothing calls this directly
no test coverage detected