Deprecate inheritance hierachy of plot formats in event_log_visualizer.

Instead add separate printing functions for each plot format in the base class.

Bug: webrtc:11566
Change-Id: I8adfc983b4e8a66c477de4022c2d97b6975d7e5c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176563
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31496}
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc
index 2aa1653..2563338 100644
--- a/rtc_tools/rtc_event_log_visualizer/main.cc
+++ b/rtc_tools/rtc_event_log_visualizer/main.cc
@@ -34,8 +34,6 @@
 #include "rtc_tools/rtc_event_log_visualizer/analyze_audio.h"
 #include "rtc_tools/rtc_event_log_visualizer/analyzer.h"
 #include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
-#include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h"
-#include "rtc_tools/rtc_event_log_visualizer/plot_python.h"
 #include "system_wrappers/include/field_trial.h"
 #include "test/field_trial.h"
 #include "test/testsupport/file_utils.h"
@@ -277,13 +275,7 @@
   }
 
   webrtc::EventLogAnalyzer analyzer(parsed_log, config);
-  std::unique_ptr<webrtc::PlotCollection> collection;
-  if (absl::GetFlag(FLAGS_protobuf_output)) {
-    collection.reset(new webrtc::ProtobufPlotCollection());
-  } else {
-    collection.reset(
-        new webrtc::PythonPlotCollection(absl::GetFlag(FLAGS_shared_xaxis)));
-  }
+  webrtc::PlotCollection collection;
 
   PlotMap plots;
   plots.RegisterPlot("incoming_packet_sizes", [&](Plot* plot) {
@@ -601,7 +593,7 @@
 
   for (const auto& plot : plots) {
     if (plot.enabled) {
-      Plot* output = collection->AppendNewPlot();
+      Plot* output = collection.AppendNewPlot();
       plot.plot_func(output);
       output->SetId(plot.label);
     }
@@ -621,11 +613,17 @@
          it != neteq_stats->cend(); ++it) {
       webrtc::CreateAudioJitterBufferGraph(parsed_log, config, it->first,
                                            it->second.get(),
-                                           collection->AppendNewPlot());
+                                           collection.AppendNewPlot());
     }
   }
 
-  collection->Draw();
+  if (absl::GetFlag(FLAGS_protobuf_output)) {
+    webrtc::analytics::ChartCollection proto_charts;
+    collection.ExportProtobuf(&proto_charts);
+    std::cout << proto_charts.SerializeAsString();
+  } else {
+    collection.PrintPythonCode(absl::GetFlag(FLAGS_shared_xaxis));
+  }
 
   if (absl::GetFlag(FLAGS_print_triage_alerts)) {
     webrtc::TriageHelper triage_alerts(config);