Commit 6bcfafa6 authored by Michael Checo's avatar Michael Checo Committed by Chromium LUCI CQ

Diagnostics: Fix CPU chart overflow issue

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: I78c14f59c1df348c5a9cf246346122877c7aeb7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2604976Reviewed-by: default avatarJoon Ahn <joonbug@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Commit-Queue: Michael Checo <michaelcheco@google.com>
Cr-Commit-Position: refs/heads/master@{#842747}
parent d5503f7b
...@@ -152,7 +152,7 @@ Polymer({ ...@@ -152,7 +152,7 @@ Polymer({
ready() { ready() {
this.setScaling_(); this.setScaling_();
this.initializeChart_(); this.initializeChart_();
window.addEventListener('resize', (e) => this.updateChartWidth_()); window.addEventListener('resize', () => this.updateChartWidth_());
// Set the initial chart width. // Set the initial chart width.
this.updateChartWidth_(); this.updateChartWidth_();
...@@ -208,19 +208,10 @@ Polymer({ ...@@ -208,19 +208,10 @@ Polymer({
d3.scaleLinear().domain([0, this.numDataPoints_ - 2]).range([ d3.scaleLinear().domain([0, this.numDataPoints_ - 2]).range([
0, this.graphWidth_ 0, this.graphWidth_
]); ]);
},
/** @private */
initializeChart_() {
const chartGroup = d3.select(this.$$('#chartGroup'));
// Position chartGroup inside the margin.
chartGroup.attr(
'transform',
'translate(' + this.padding_.left + ',' + this.padding_.top + ')');
// Draw the y-axis legend and also draw the horizontal gridlines by // Draw the y-axis legend and also draw the horizontal gridlines by
// reversing the ticks back into the chart body. // reversing the ticks back into the chart body.
const chartGroup = d3.select(this.$$('#chartGroup'));
chartGroup.select('#gridLines') chartGroup.select('#gridLines')
.call( .call(
d3.axisLeft(/** @type {!d3.LinearScale} */ (this.yAxisScaleFn_)) d3.axisLeft(/** @type {!d3.LinearScale} */ (this.yAxisScaleFn_))
...@@ -230,6 +221,16 @@ Polymer({ ...@@ -230,6 +221,16 @@ Polymer({
.tickSize(-this.graphWidth_) // Extend the ticks into the .tickSize(-this.graphWidth_) // Extend the ticks into the
// entire graph as gridlines. // entire graph as gridlines.
); );
},
/** @private */
initializeChart_() {
const chartGroup = d3.select(this.$$('#chartGroup'));
// Position chartGroup inside the margin.
chartGroup.attr(
'transform',
'translate(' + this.padding_.left + ',' + this.padding_.top + ')');
const plotGroup = d3.select(this.$$('#plotGroup')); const plotGroup = d3.select(this.$$('#plotGroup'));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment