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_ |
11 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 11 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <string> | 14 #include <string> |
15 #include <utility> | 15 #include <utility> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 namespace plotting { | 19 namespace plotting { |
20 | 20 |
21 enum PlotStyle { | 21 enum PlotStyle { |
22 LINE_GRAPH, | 22 LINE_GRAPH, |
23 LINE_DOT_GRAPH, | 23 LINE_DOT_GRAPH, |
24 BAR_GRAPH, | 24 BAR_GRAPH, |
25 LINE_STEP_GRAPH, | 25 LINE_STEP_GRAPH, |
26 DOT_GRAPH | 26 DOT_GRAPH, |
| 27 VSPAN_GRAPH |
27 }; | 28 }; |
28 | 29 |
29 struct TimeSeriesPoint { | 30 struct TimeSeriesPoint { |
30 TimeSeriesPoint(float x, float y) : x(x), y(y) {} | 31 TimeSeriesPoint(float x, float y) : x(x), y(y) {} |
31 float x; | 32 float x; |
32 float y; | 33 float y; |
33 }; | 34 }; |
34 | 35 |
35 struct TimeSeries { | 36 struct TimeSeries { |
36 TimeSeries() = default; | 37 TimeSeries() = default; |
37 TimeSeries(const char* label, PlotStyle style) : label(label), style(style) {} | 38 TimeSeries(const char* label, PlotStyle style) : label(label), style(style) {} |
38 TimeSeries(const std::string& label, PlotStyle style) | 39 TimeSeries(const std::string& label, PlotStyle style) |
39 : label(label), style(style) {} | 40 : label(label), style(style) {} |
40 TimeSeries(TimeSeries&& other) | 41 TimeSeries(TimeSeries&& other) |
41 : label(std::move(other.label)), | 42 : label(std::move(other.label)), |
42 style(other.style), | 43 style(other.style), |
| 44 color(other.color), |
43 points(std::move(other.points)) {} | 45 points(std::move(other.points)) {} |
44 TimeSeries& operator=(TimeSeries&& other) { | 46 TimeSeries& operator=(TimeSeries&& other) { |
45 label = std::move(other.label); | 47 label = std::move(other.label); |
46 style = other.style; | 48 style = other.style; |
| 49 color = other.color; |
47 points = std::move(other.points); | 50 points = std::move(other.points); |
48 return *this; | 51 return *this; |
49 } | 52 } |
50 | 53 |
51 std::string label; | 54 std::string label; |
52 PlotStyle style; | 55 PlotStyle style; |
| 56 std::string color; |
53 std::vector<TimeSeriesPoint> points; | 57 std::vector<TimeSeriesPoint> points; |
54 }; | 58 }; |
55 | 59 |
56 // A container that represents a general graph, with axes, title and one or | 60 // A container that represents a general graph, with axes, title and one or |
57 // more data series. A subclass should define the output format by overriding | 61 // more data series. A subclass should define the output format by overriding |
58 // the Draw() method. | 62 // the Draw() method. |
59 class Plot { | 63 class Plot { |
60 public: | 64 public: |
61 virtual ~Plot() {} | 65 virtual ~Plot() {} |
62 | 66 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 virtual Plot* AppendNewPlot() = 0; | 131 virtual Plot* AppendNewPlot() = 0; |
128 | 132 |
129 protected: | 133 protected: |
130 std::vector<std::unique_ptr<Plot> > plots_; | 134 std::vector<std::unique_ptr<Plot> > plots_; |
131 }; | 135 }; |
132 | 136 |
133 } // namespace plotting | 137 } // namespace plotting |
134 } // namespace webrtc | 138 } // namespace webrtc |
135 | 139 |
136 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 140 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
OLD | NEW |