Add new step graph type to event log visualization tool. Currently used for bitrate estimate and accumulated packet count, but could in general be used for any metric that is piecewise constant.

BUG=None

Review-Url: https://codereview.webrtc.org/2653343004
Cr-Commit-Position: refs/heads/master@{#16399}
This commit is contained in:
terelius
2017-02-01 06:34:53 -08:00
committed by Commit bot
parent a565f92e87
commit 77f0580f83
5 changed files with 17 additions and 6 deletions

View File

@ -65,6 +65,16 @@ void PythonPlot::Draw() {
"plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
"marker='.')\n",
i, i, i, series_list_[i].label.c_str());
} else if (series_list_[i].style == LINE_STEP_GRAPH) {
// Draw lines from (x[0],y[0]) to (x[1],y[0]) to (x[1],y[1]) and so on
// to illustrate the "steps". This can be expressed by duplicating all
// elements except the first in x and the last in y.
printf("x%zu = [v for dup in x%zu for v in [dup, dup]]\n", i, i);
printf("y%zu = [v for dup in y%zu for v in [dup, dup]]\n", i, i);
printf(
"plt.plot(x%zu[1:], y%zu[:-1], color=rgb_colors[%zu], "
"label=\'%s\')\n",
i, i, i, series_list_[i].label.c_str());
} else {
printf("raise Exception(\"Unknown graph type\")\n");
}