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 16 matching lines...) Expand all Loading... |
27 }; | 27 }; |
28 | 28 |
29 struct TimeSeriesPoint { | 29 struct TimeSeriesPoint { |
30 TimeSeriesPoint(float x, float y) : x(x), y(y) {} | 30 TimeSeriesPoint(float x, float y) : x(x), y(y) {} |
31 float x; | 31 float x; |
32 float y; | 32 float y; |
33 }; | 33 }; |
34 | 34 |
35 struct TimeSeries { | 35 struct TimeSeries { |
36 TimeSeries() = default; | 36 TimeSeries() = default; |
37 TimeSeries(const char* label, PlotStyle style) | 37 TimeSeries(const char* label, PlotStyle style) : label(label), style(style) {} |
38 : label(label), style(style), points() {} | |
39 TimeSeries(const std::string& label, PlotStyle style) | 38 TimeSeries(const std::string& label, PlotStyle style) |
40 : label(label), style(style), points() {} | 39 : label(label), style(style) {} |
41 TimeSeries(TimeSeries&& other) | 40 TimeSeries(TimeSeries&& other) |
42 : label(std::move(other.label)), | 41 : label(std::move(other.label)), |
43 style(other.style), | 42 style(other.style), |
44 points(std::move(other.points)) {} | 43 points(std::move(other.points)) {} |
45 TimeSeries& operator=(TimeSeries&& other) { | 44 TimeSeries& operator=(TimeSeries&& other) { |
46 label = std::move(other.label); | 45 label = std::move(other.label); |
47 style = other.style; | 46 style = other.style; |
48 points = std::move(other.points); | 47 points = std::move(other.points); |
49 return *this; | 48 return *this; |
50 } | 49 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void SetSuggestedYAxis(float min_value, | 100 void SetSuggestedYAxis(float min_value, |
102 float max_value, | 101 float max_value, |
103 std::string label, | 102 std::string label, |
104 float bottom_margin = 0, | 103 float bottom_margin = 0, |
105 float top_margin = 0); | 104 float top_margin = 0); |
106 | 105 |
107 // Sets the title of the plot. | 106 // Sets the title of the plot. |
108 void SetTitle(std::string title); | 107 void SetTitle(std::string title); |
109 | 108 |
110 // Add a new TimeSeries to the plot. | 109 // Add a new TimeSeries to the plot. |
111 TimeSeries* AddTimeSeries(const char* label, PlotStyle style); | 110 void AppendTimeSeries(TimeSeries&& time_series); |
112 TimeSeries* AddTimeSeries(const std::string& label, PlotStyle style); | |
113 | |
114 std::vector<TimeSeries> series_list_; | |
115 | 111 |
116 protected: | 112 protected: |
117 float xaxis_min_; | 113 float xaxis_min_; |
118 float xaxis_max_; | 114 float xaxis_max_; |
119 std::string xaxis_label_; | 115 std::string xaxis_label_; |
120 float yaxis_min_; | 116 float yaxis_min_; |
121 float yaxis_max_; | 117 float yaxis_max_; |
122 std::string yaxis_label_; | 118 std::string yaxis_label_; |
123 std::string title_; | 119 std::string title_; |
| 120 std::vector<TimeSeries> series_list_; |
124 }; | 121 }; |
125 | 122 |
126 class PlotCollection { | 123 class PlotCollection { |
127 public: | 124 public: |
128 virtual ~PlotCollection() {} | 125 virtual ~PlotCollection() {} |
129 virtual void Draw() = 0; | 126 virtual void Draw() = 0; |
130 virtual Plot* AppendNewPlot() = 0; | 127 virtual Plot* AppendNewPlot() = 0; |
131 | 128 |
132 protected: | 129 protected: |
133 std::vector<std::unique_ptr<Plot> > plots_; | 130 std::vector<std::unique_ptr<Plot> > plots_; |
134 }; | 131 }; |
135 | 132 |
136 } // namespace plotting | 133 } // namespace plotting |
137 } // namespace webrtc | 134 } // namespace webrtc |
138 | 135 |
139 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 136 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
OLD | NEW |