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 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
11 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
12 | |
13 #include <memory> | |
14 #include <string> | |
15 #include <utility> | |
16 #include <vector> | |
17 | |
18 namespace webrtc { | |
19 namespace plotting { | |
20 | |
21 enum PlotStyle { LINE_GRAPH, BAR_GRAPH }; | |
22 | |
23 struct TimeSeriesPoint { | |
24 TimeSeriesPoint(float x, float y) : x(x), y(y) {} | |
25 TimeSeriesPoint(float x, float y, std::string message) | |
26 : x(x), y(y), message(message) {} | |
27 float x; | |
28 float y; | |
29 std::string message; | |
30 }; | |
31 | |
32 struct TimeSeries { | |
33 TimeSeries() = default; | |
34 TimeSeries(TimeSeries&& other) : label(std::move(other.label)), | |
stefan-webrtc
2016/07/05 08:58:12
Not sure about this one, but should this be explic
terelius
2016/07/06 15:15:12
I don't really think it matters, but the style gui
| |
35 style(other.style), | |
36 points(std::move(other.points)) {} | |
37 TimeSeries& operator=(TimeSeries&& other) { | |
38 label = std::move(other.label); | |
39 style = other.style; | |
40 points = std::move(other.points); | |
41 return *this; | |
42 } | |
43 | |
44 std::string label; | |
45 PlotStyle style; | |
46 std::vector<TimeSeriesPoint> points; | |
47 }; | |
48 | |
49 // This is basically a struct that represents of a general graph, with axes, | |
50 // title and one or more data series. We make it a class only to document that | |
51 // it also specifies an interface for the draw()ing objects. | |
52 class Plot { | |
53 public: | |
54 virtual ~Plot() {} | |
55 virtual void draw() = 0; | |
56 | |
57 float xaxis_min; | |
58 float xaxis_max; | |
59 std::string xaxis_label; | |
60 float yaxis_min; | |
61 float yaxis_max; | |
62 std::string yaxis_label; | |
63 std::vector<TimeSeries> series; | |
64 std::string title; | |
65 }; | |
66 | |
67 class PlotCollection { | |
68 public: | |
69 virtual ~PlotCollection() {} | |
70 virtual void draw() = 0; | |
71 virtual Plot* append_new_plot() = 0; | |
72 | |
73 protected: | |
74 std::vector<std::unique_ptr<Plot> > plots; | |
75 }; | |
76 | |
77 } // namespace plotting | |
78 } // namespace webrtc | |
79 | |
80 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_ | |
OLD | NEW |