OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
| 12 |
| 13 namespace webrtc { |
| 14 namespace plotting { |
| 15 |
| 16 void Plot::SetXAxis(float min_value, |
| 17 float max_value, |
| 18 std::string label, |
| 19 float left_margin, |
| 20 float right_margin) { |
| 21 RTC_DCHECK_LE(min_value, max_value); |
| 22 xaxis_min_ = min_value - left_margin * (max_value - min_value); |
| 23 xaxis_max_ = max_value + right_margin * (max_value - min_value); |
| 24 xaxis_label_ = label; |
| 25 } |
| 26 |
| 27 void Plot::SetSuggestedXAxis(float min_value, |
| 28 float max_value, |
| 29 std::string label, |
| 30 float left_margin, |
| 31 float right_margin) { |
| 32 for (const auto& series : series_list_) { |
| 33 for (const auto& point : series.points) { |
| 34 min_value = std::min(min_value, point.x); |
| 35 max_value = std::max(max_value, point.x); |
| 36 } |
| 37 } |
| 38 SetXAxis(min_value, max_value, label, left_margin, right_margin); |
| 39 } |
| 40 |
| 41 void Plot::SetYAxis(float min_value, |
| 42 float max_value, |
| 43 std::string label, |
| 44 float bottom_margin, |
| 45 float top_margin) { |
| 46 RTC_DCHECK_LE(min_value, max_value); |
| 47 yaxis_min_ = min_value - bottom_margin * (max_value - min_value); |
| 48 yaxis_max_ = max_value + top_margin * (max_value - min_value); |
| 49 yaxis_label_ = label; |
| 50 } |
| 51 |
| 52 void Plot::SetSuggestedYAxis(float min_value, |
| 53 float max_value, |
| 54 std::string label, |
| 55 float bottom_margin, |
| 56 float top_margin) { |
| 57 for (const auto& series : series_list_) { |
| 58 for (const auto& point : series.points) { |
| 59 min_value = std::min(min_value, point.y); |
| 60 max_value = std::max(max_value, point.y); |
| 61 } |
| 62 } |
| 63 SetYAxis(min_value, max_value, label, bottom_margin, top_margin); |
| 64 } |
| 65 |
| 66 void Plot::SetTitle(std::string title) { |
| 67 title_ = title; |
| 68 } |
| 69 |
| 70 } // namespace plotting |
| 71 } // namespace webrtc |
OLD | NEW |