| 2565 | |
| 2566 | template <typename _GetterPos, typename _GetterNeg> |
| 2567 | void PlotErrorBarsHEx(const char* label_id, const _GetterPos& getter_pos, const _GetterNeg& getter_neg, const ImPlotSpec& spec) { |
| 2568 | if (BeginItemEx(label_id, Fitter2<_GetterPos,_GetterNeg>(getter_pos, getter_neg), spec, IMPLOT_AUTO_COL)) { |
| 2569 | if (getter_pos.Count <= 0 || getter_neg.Count <= 0) { |
| 2570 | EndItem(); |
| 2571 | return; |
| 2572 | } |
| 2573 | const ImPlotNextItemData& s = GetItemData(); |
| 2574 | ImDrawList& draw_list = *GetPlotDrawList(); |
| 2575 | const ImU32 col = ImGui::GetColorU32( IsColorAuto(spec.LineColor) ? ImGui::GetStyleColorVec4(ImGuiCol_Text) : s.Spec.LineColor ); |
| 2576 | const bool rend_whisker = s.Spec.Size > 0; |
| 2577 | const float half_whisker = s.Spec.Size * 0.5f; |
| 2578 | for (int i = 0; i < getter_pos.Count; ++i) { |
| 2579 | ImVec2 p1 = PlotToPixels(getter_neg[i],IMPLOT_AUTO,IMPLOT_AUTO); |
| 2580 | ImVec2 p2 = PlotToPixels(getter_pos[i],IMPLOT_AUTO,IMPLOT_AUTO); |
| 2581 | draw_list.AddLine(p1, p2, col, s.Spec.LineWeight); |
| 2582 | if (rend_whisker) { |
| 2583 | draw_list.AddLine(p1 - ImVec2(0, half_whisker), p1 + ImVec2(0, half_whisker), col, s.Spec.LineWeight); |
| 2584 | draw_list.AddLine(p2 - ImVec2(0, half_whisker), p2 + ImVec2(0, half_whisker), col, s.Spec.LineWeight); |
| 2585 | } |
| 2586 | } |
| 2587 | EndItem(); |
| 2588 | } |
| 2589 | } |
| 2590 | |
| 2591 | template <typename T> |
| 2592 | void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, const ImPlotSpec& spec) { |
no test coverage detected