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

Side by Side Diff: webrtc/tools/event_log_visualizer/plot_protobuf.cc

Issue 2965593002: Move webrtc/{tools => rtc_tools} (Closed)
Patch Set: Adding back root changes Created 3 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
11 #include "webrtc/tools/event_log_visualizer/plot_protobuf.h"
12
13 #include <memory>
14
15 namespace webrtc {
16 namespace plotting {
17
18 ProtobufPlot::ProtobufPlot() {}
19
20 ProtobufPlot::~ProtobufPlot() {}
21
22 void ProtobufPlot::Draw() {}
23
24 void ProtobufPlot::ExportProtobuf(webrtc::analytics::Chart* chart) {
25 for (size_t i = 0; i < series_list_.size(); i++) {
26 webrtc::analytics::DataSet* data_set = chart->add_data_sets();
27 for (const auto& point : series_list_[i].points) {
28 data_set->add_x_values(point.x);
29 }
30 for (const auto& point : series_list_[i].points) {
31 data_set->add_y_values(point.y);
32 }
33
34 if (series_list_[i].style == BAR_GRAPH) {
35 data_set->set_style(webrtc::analytics::ChartStyle::BAR_CHART);
36 } else if (series_list_[i].style == LINE_GRAPH) {
37 data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
38 } else if (series_list_[i].style == LINE_DOT_GRAPH) {
39 data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
40 data_set->set_highlight_points(true);
41 } else if (series_list_[i].style == LINE_STEP_GRAPH) {
42 data_set->set_style(webrtc::analytics::ChartStyle::LINE_STEP_CHART);
43 } else if (series_list_[i].style == DOT_GRAPH) {
44 data_set->set_style(webrtc::analytics::ChartStyle::SCATTER_CHART);
45 data_set->set_highlight_points(true);
46 } else {
47 data_set->set_style(webrtc::analytics::ChartStyle::UNDEFINED);
48 }
49
50 data_set->set_label(series_list_[i].label);
51 }
52
53 chart->set_xaxis_min(xaxis_min_);
54 chart->set_xaxis_max(xaxis_max_);
55 chart->set_yaxis_min(yaxis_min_);
56 chart->set_yaxis_max(yaxis_max_);
57 chart->set_xaxis_label(xaxis_label_);
58 chart->set_yaxis_label(yaxis_label_);
59 chart->set_title(title_);
60 }
61
62 ProtobufPlotCollection::ProtobufPlotCollection() {}
63
64 ProtobufPlotCollection::~ProtobufPlotCollection() {}
65
66 void ProtobufPlotCollection::Draw() {}
67
68 void ProtobufPlotCollection::ExportProtobuf(
69 webrtc::analytics::ChartCollection* collection) {
70 for (const auto& plot : plots_) {
71 // TODO(terelius): Ensure that there is no way to insert plots other than
72 // ProtobufPlots in a ProtobufPlotCollection. Needed to safely static_cast
73 // here.
74 webrtc::analytics::Chart* protobuf_representation
75 = collection->add_charts();
76 static_cast<ProtobufPlot*>(plot.get())
77 ->ExportProtobuf(protobuf_representation);
78 }
79 }
80
81 Plot* ProtobufPlotCollection::AppendNewPlot() {
82 Plot* plot = new ProtobufPlot();
83 plots_.push_back(std::unique_ptr<Plot>(plot));
84 return plot;
85 }
86
87 } // namespace plotting
88 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/tools/event_log_visualizer/plot_protobuf.h ('k') | webrtc/tools/event_log_visualizer/plot_python.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698