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_RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 10 #ifndef WEBRTC_RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
(...skipping 22 matching lines...) Expand all Loading... | |
33 }; | 33 }; |
34 | 34 |
35 struct TimeSeries { | 35 struct TimeSeries { |
36 TimeSeries() = default; | 36 TimeSeries() = default; |
37 TimeSeries(const char* label, PlotStyle style) : label(label), style(style) {} | 37 TimeSeries(const char* label, PlotStyle style) : label(label), style(style) {} |
38 TimeSeries(const std::string& label, PlotStyle style) | 38 TimeSeries(const std::string& label, PlotStyle style) |
39 : label(label), style(style) {} | 39 : label(label), style(style) {} |
40 TimeSeries(TimeSeries&& other) | 40 TimeSeries(TimeSeries&& other) |
41 : label(std::move(other.label)), | 41 : label(std::move(other.label)), |
42 style(other.style), | 42 style(other.style), |
43 color(other.color), | |
43 points(std::move(other.points)) {} | 44 points(std::move(other.points)) {} |
44 TimeSeries& operator=(TimeSeries&& other) { | 45 TimeSeries& operator=(TimeSeries&& other) { |
45 label = std::move(other.label); | 46 label = std::move(other.label); |
46 style = other.style; | 47 style = other.style; |
48 color = other.color; | |
47 points = std::move(other.points); | 49 points = std::move(other.points); |
48 return *this; | 50 return *this; |
49 } | 51 } |
50 | 52 |
51 std::string label; | 53 std::string label; |
52 PlotStyle style; | 54 PlotStyle style; |
55 std::string color; | |
terelius
2017/07/04 12:22:01
This is not used as far as I can tell. Furthermore
philipel
2017/07/04 12:55:10
Removed.
Not sure I understand what you mean by s
terelius
2017/07/07 13:42:01
What I mean is that "connect these point with a li
philipel
2017/07/11 14:12:35
To represent some data using a LINE_GRAPH, LINE_DO
| |
53 std::vector<TimeSeriesPoint> points; | 56 std::vector<TimeSeriesPoint> points; |
54 }; | 57 }; |
55 | 58 |
59 struct Interval { | |
60 Interval() = default; | |
61 Interval(double begin, double end) : begin(begin), end(end) {} | |
62 | |
63 double begin; | |
64 double end; | |
65 }; | |
66 | |
67 struct IntervalSeries { | |
68 enum Orientation { kHorizontal, kVertical }; | |
69 | |
70 IntervalSeries() = default; | |
71 IntervalSeries(const std::string& label, | |
72 const std::string& color, | |
73 IntervalSeries::Orientation orientation) | |
74 : label(label), color(color), orientation(orientation) {} | |
75 | |
76 std::string label; | |
77 std::string color; | |
78 Orientation orientation; | |
79 std::vector<Interval> intervals; | |
80 }; | |
81 | |
56 // A container that represents a general graph, with axes, title and one or | 82 // 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 | 83 // more data series. A subclass should define the output format by overriding |
58 // the Draw() method. | 84 // the Draw() method. |
59 class Plot { | 85 class Plot { |
60 public: | 86 public: |
61 virtual ~Plot() {} | 87 virtual ~Plot() {} |
62 | 88 |
63 // Overloaded to draw the plot. | 89 // Overloaded to draw the plot. |
64 virtual void Draw() = 0; | 90 virtual void Draw() = 0; |
65 | 91 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 std::string label, | 128 std::string label, |
103 float bottom_margin = 0, | 129 float bottom_margin = 0, |
104 float top_margin = 0); | 130 float top_margin = 0); |
105 | 131 |
106 // Sets the title of the plot. | 132 // Sets the title of the plot. |
107 void SetTitle(std::string title); | 133 void SetTitle(std::string title); |
108 | 134 |
109 // Add a new TimeSeries to the plot. | 135 // Add a new TimeSeries to the plot. |
110 void AppendTimeSeries(TimeSeries&& time_series); | 136 void AppendTimeSeries(TimeSeries&& time_series); |
111 | 137 |
138 // Add a new IntervalSeries to the plot. | |
139 void AppendIntervalSeries(IntervalSeries&& interval_series); | |
140 | |
112 // Add a new TimeSeries to the plot if the series contains contains data. | 141 // Add a new TimeSeries to the plot if the series contains contains data. |
113 // Otherwise, the call has no effect and the timeseries is destroyed. | 142 // Otherwise, the call has no effect and the timeseries is destroyed. |
114 void AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series); | 143 void AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series); |
115 | 144 |
116 protected: | 145 protected: |
117 float xaxis_min_; | 146 float xaxis_min_; |
118 float xaxis_max_; | 147 float xaxis_max_; |
119 std::string xaxis_label_; | 148 std::string xaxis_label_; |
120 float yaxis_min_; | 149 float yaxis_min_; |
121 float yaxis_max_; | 150 float yaxis_max_; |
122 std::string yaxis_label_; | 151 std::string yaxis_label_; |
123 std::string title_; | 152 std::string title_; |
124 std::vector<TimeSeries> series_list_; | 153 std::vector<TimeSeries> series_list_; |
154 std::vector<IntervalSeries> interval_list_; | |
125 }; | 155 }; |
126 | 156 |
127 class PlotCollection { | 157 class PlotCollection { |
128 public: | 158 public: |
129 virtual ~PlotCollection() {} | 159 virtual ~PlotCollection() {} |
130 virtual void Draw() = 0; | 160 virtual void Draw() = 0; |
131 virtual Plot* AppendNewPlot() = 0; | 161 virtual Plot* AppendNewPlot() = 0; |
132 | 162 |
133 protected: | 163 protected: |
134 std::vector<std::unique_ptr<Plot> > plots_; | 164 std::vector<std::unique_ptr<Plot> > plots_; |
135 }; | 165 }; |
136 | 166 |
137 } // namespace plotting | 167 } // namespace plotting |
138 } // namespace webrtc | 168 } // namespace webrtc |
139 | 169 |
140 #endif // WEBRTC_RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | 170 #endif // WEBRTC_RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ |
OLD | NEW |