Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: webrtc/tools/event_log_visualizer/plot_base.h

Issue 1995523002: Visualization tool for WebrtcEventLogs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use include_tests==1 to avoid compiling if gflags isn't available. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 float x;
26 float y;
27 };
28
29 struct TimeSeries {
30 TimeSeries() = default;
31 TimeSeries(TimeSeries&& other)
32 : label(std::move(other.label)),
33 style(other.style),
34 points(std::move(other.points)) {}
35 TimeSeries& operator=(TimeSeries&& other) {
36 label = std::move(other.label);
37 style = other.style;
38 points = std::move(other.points);
39 return *this;
40 }
41
42 std::string label;
43 PlotStyle style;
44 std::vector<TimeSeriesPoint> points;
45 };
46
47 // This is basically a struct that represents of a general graph, with axes,
48 // title and one or more data series. We make it a class only to document that
49 // it also specifies an interface for the draw()ing objects.
50 class Plot {
51 public:
52 virtual ~Plot() {}
53 virtual void draw() = 0;
54
55 float xaxis_min;
56 float xaxis_max;
57 std::string xaxis_label;
58 float yaxis_min;
59 float yaxis_max;
60 std::string yaxis_label;
61 std::vector<TimeSeries> series;
62 std::string title;
63 };
64
65 class PlotCollection {
66 public:
67 virtual ~PlotCollection() {}
68 virtual void draw() = 0;
69 virtual Plot* append_new_plot() = 0;
70
71 protected:
72 std::vector<std::unique_ptr<Plot> > plots;
73 };
74
75 } // namespace plotting
76 } // namespace webrtc
77
78 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
OLDNEW
« no previous file with comments | « webrtc/tools/event_log_visualizer/generate_timeseries.cc ('k') | webrtc/tools/event_log_visualizer/plot_python.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698