| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 10 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 enum PlotStyle { LINE_GRAPH, LINE_DOT_GRAPH, BAR_GRAPH, LINE_STEP_GRAPH }; | 21 enum PlotStyle { LINE_GRAPH, LINE_DOT_GRAPH, BAR_GRAPH, LINE_STEP_GRAPH }; |
| 22 | 22 |
| 23 struct TimeSeriesPoint { | 23 struct TimeSeriesPoint { |
| 24 TimeSeriesPoint(float x, float y) : x(x), y(y) {} | 24 TimeSeriesPoint(float x, float y) : x(x), y(y) {} |
| 25 float x; | 25 float x; |
| 26 float y; | 26 float y; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 struct TimeSeries { | 29 struct TimeSeries { |
| 30 TimeSeries() = default; | 30 TimeSeries() = default; |
| 31 TimeSeries(const char* label, PlotStyle style) |
| 32 : label(label), style(style), points() {} |
| 33 TimeSeries(const std::string& label, PlotStyle style) |
| 34 : label(label), style(style), points() {} |
| 31 TimeSeries(TimeSeries&& other) | 35 TimeSeries(TimeSeries&& other) |
| 32 : label(std::move(other.label)), | 36 : label(std::move(other.label)), |
| 33 style(other.style), | 37 style(other.style), |
| 34 points(std::move(other.points)) {} | 38 points(std::move(other.points)) {} |
| 35 TimeSeries& operator=(TimeSeries&& other) { | 39 TimeSeries& operator=(TimeSeries&& other) { |
| 36 label = std::move(other.label); | 40 label = std::move(other.label); |
| 37 style = other.style; | 41 style = other.style; |
| 38 points = std::move(other.points); | 42 points = std::move(other.points); |
| 39 return *this; | 43 return *this; |
| 40 } | 44 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // y-values and are added to either side of the plot. | 94 // y-values and are added to either side of the plot. |
| 91 void SetSuggestedYAxis(float min_value, | 95 void SetSuggestedYAxis(float min_value, |
| 92 float max_value, | 96 float max_value, |
| 93 std::string label, | 97 std::string label, |
| 94 float bottom_margin = 0, | 98 float bottom_margin = 0, |
| 95 float top_margin = 0); | 99 float top_margin = 0); |
| 96 | 100 |
| 97 // Sets the title of the plot. | 101 // Sets the title of the plot. |
| 98 void SetTitle(std::string title); | 102 void SetTitle(std::string title); |
| 99 | 103 |
| 104 // Add a new TimeSeries to the plot. |
| 105 TimeSeries* AddTimeSeries(const char* label, PlotStyle style); |
| 106 TimeSeries* AddTimeSeries(const std::string& label, PlotStyle style); |
| 107 |
| 100 std::vector<TimeSeries> series_list_; | 108 std::vector<TimeSeries> series_list_; |
| 101 | 109 |
| 102 protected: | 110 protected: |
| 103 float xaxis_min_; | 111 float xaxis_min_; |
| 104 float xaxis_max_; | 112 float xaxis_max_; |
| 105 std::string xaxis_label_; | 113 std::string xaxis_label_; |
| 106 float yaxis_min_; | 114 float yaxis_min_; |
| 107 float yaxis_max_; | 115 float yaxis_max_; |
| 108 std::string yaxis_label_; | 116 std::string yaxis_label_; |
| 109 std::string title_; | 117 std::string title_; |
| 110 }; | 118 }; |
| 111 | 119 |
| 112 class PlotCollection { | 120 class PlotCollection { |
| 113 public: | 121 public: |
| 114 virtual ~PlotCollection() {} | 122 virtual ~PlotCollection() {} |
| 115 virtual void Draw() = 0; | 123 virtual void Draw() = 0; |
| 116 virtual Plot* AppendNewPlot() = 0; | 124 virtual Plot* AppendNewPlot() = 0; |
| 117 | 125 |
| 118 protected: | 126 protected: |
| 119 std::vector<std::unique_ptr<Plot> > plots_; | 127 std::vector<std::unique_ptr<Plot> > plots_; |
| 120 }; | 128 }; |
| 121 | 129 |
| 122 } // namespace plotting | 130 } // namespace plotting |
| 123 } // namespace webrtc | 131 } // namespace webrtc |
| 124 | 132 |
| 125 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 133 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
| OLD | NEW |