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

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: Review comments Created 4 years, 6 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 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 std::string label;
34 PlotStyle style;
35 std::vector<TimeSeriesPoint> points;
36 void swap(TimeSeries& other) {
37 std::swap(label, other.label);
38 std::swap(style, other.style);
39 std::swap(points, other.points);
40 }
41 };
42
43 // This is basically a struct that represents of a general graph, with axes,
44 // title and one or more data series. We make it a class only to document that
45 // it also specifies an interface for the draw()ing objects.
46 class Plot {
47 public:
48 virtual ~Plot() {}
49 virtual void draw() = 0;
50
51 float xaxis_min;
stefan-webrtc 2016/06/29 11:13:05 Can these be protected and only set in the constru
terelius 2016/07/06 15:15:12 No, the axis limits depend on the data points whic
52 float xaxis_max;
53 std::string xaxis_label;
54 float yaxis_min;
55 float yaxis_max;
56 std::string yaxis_label;
57 std::vector<TimeSeries> series;
58 std::string title;
59 };
60
61 class PlotCollection {
62 public:
63 virtual ~PlotCollection() {}
64 virtual void draw() = 0;
65 virtual Plot* append_new_plot() = 0;
66
67 protected:
68 std::vector<std::unique_ptr<Plot> > plots;
69 };
70
71 } // namespace plotting
72 } // namespace webrtc
73
74 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698