Renamed and restructured the protobuf definitions for the rtc_event_log graphs.

BUG=

Review-Url: https://codereview.webrtc.org/2310403002
Cr-Commit-Position: refs/heads/master@{#14112}
This commit is contained in:
skvlad
2016-09-07 11:15:37 -07:00
committed by Commit bot
parent a4d40cb502
commit f581eb76f4
6 changed files with 65 additions and 59 deletions

View File

@ -21,36 +21,37 @@ ProtobufPlot::~ProtobufPlot() {}
void ProtobufPlot::Draw() {}
void ProtobufPlot::ExportProtobuf(protobuf_plot::Plot* plot) {
void ProtobufPlot::ExportProtobuf(webrtc::analytics::Chart* chart) {
for (size_t i = 0; i < series_list_.size(); i++) {
protobuf_plot::DataSet* data_set = plot->add_data_sets();
webrtc::analytics::DataSet* data_set = chart->add_data_sets();
for (const auto& point : series_list_[i].points) {
data_set->add_xvalues(point.x);
data_set->add_x_values(point.x);
}
for (const auto& point : series_list_[i].points) {
data_set->add_yvalues(point.y);
data_set->add_y_values(point.y);
}
if (series_list_[i].style == BAR_GRAPH) {
data_set->set_style(protobuf_plot::BAR_GRAPH);
data_set->set_style(webrtc::analytics::ChartStyle::BAR_CHART);
} else if (series_list_[i].style == LINE_GRAPH) {
data_set->set_style(protobuf_plot::LINE_GRAPH);
data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
} else if (series_list_[i].style == LINE_DOT_GRAPH) {
data_set->set_style(protobuf_plot::LINE_DOT_GRAPH);
data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
data_set->set_highlight_points(true);
} else {
data_set->set_style(protobuf_plot::UNDEFINED);
data_set->set_style(webrtc::analytics::ChartStyle::UNDEFINED);
}
data_set->set_label(series_list_[i].label);
}
plot->set_xaxis_min(xaxis_min_);
plot->set_xaxis_max(xaxis_max_);
plot->set_yaxis_min(yaxis_min_);
plot->set_yaxis_max(yaxis_max_);
plot->set_xaxis_label(xaxis_label_);
plot->set_yaxis_label(yaxis_label_);
plot->set_title(title_);
chart->set_xaxis_min(xaxis_min_);
chart->set_xaxis_max(xaxis_max_);
chart->set_yaxis_min(yaxis_min_);
chart->set_yaxis_max(yaxis_max_);
chart->set_xaxis_label(xaxis_label_);
chart->set_yaxis_label(yaxis_label_);
chart->set_title(title_);
}
ProtobufPlotCollection::ProtobufPlotCollection() {}
@ -60,12 +61,13 @@ ProtobufPlotCollection::~ProtobufPlotCollection() {}
void ProtobufPlotCollection::Draw() {}
void ProtobufPlotCollection::ExportProtobuf(
protobuf_plot::PlotCollection* collection) {
webrtc::analytics::ChartCollection* collection) {
for (const auto& plot : plots_) {
// TODO(terelius): Ensure that there is no way to insert plots other than
// ProtobufPlots in a ProtobufPlotCollection. Needed to safely static_cast
// here.
protobuf_plot::Plot* protobuf_representation = collection->add_plots();
webrtc::analytics::Chart* protobuf_representation
= collection->add_charts();
static_cast<ProtobufPlot*>(plot.get())
->ExportProtobuf(protobuf_representation);
}