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

Unified Diff: tracing/tracing/ui/base/name_bar_chart.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/ui/base/line_chart.html ('k') | tracing/tracing/ui/base/overlay.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/ui/base/name_bar_chart.html
diff --git a/tracing/tracing/ui/base/name_bar_chart.html b/tracing/tracing/ui/base/name_bar_chart.html
index 8d594fb5c1202a4209f5cc8243e715a77ee08d14..b142f257bd5654e0afd6eee8663790b13e2fe551 100644
--- a/tracing/tracing/ui/base/name_bar_chart.html
+++ b/tracing/tracing/ui/base/name_bar_chart.html
@@ -5,7 +5,7 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
-<link rel="import" href="/tracing/base/range.html">
+<link rel="import" href="/tracing/base/raf.html">
<link rel="import" href="/tracing/ui/base/bar_chart.html">
<link rel="import" href="/tracing/ui/base/d3.html">
@@ -25,7 +25,6 @@ tr.exportTo('tr.ui.b', function() {
BarChart.prototype.decorate.call(this);
Polymer.dom(this).classList.remove('bar-chart');
Polymer.dom(this).classList.add('name-bar-chart');
- this.bottomMargin_ = 40;
},
isDatumFieldSeries_: function(fieldName) {
@@ -36,12 +35,6 @@ tr.exportTo('tr.ui.b', function() {
return index;
},
- getMargin_: function() {
- var margin = BarChart.prototype.getMargin_.call(this);
- margin.bottom = this.bottomMargin_;
- return margin;
- },
-
updateXAxis_: function(xAxis) {
xAxis.selectAll('*').remove();
var y = this.chartAreaSize.height + 10;
@@ -68,8 +61,10 @@ tr.exportTo('tr.ui.b', function() {
// If the nameTexts extend past the bottom of the chart, then increase
// this.bottomMargin_ and re-render.
- var bottomMargin = this.bottomMargin_;
- window.requestAnimationFrame(function() {
+ // TODO(benjhayden): Refactor with the code that is very similar to this
+ // in chart_base_2d.
+ var bottomMargin = this.margin.bottom;
+ tr.b.requestAnimationFrame(function() {
nameTexts[0].forEach(function(t) {
var box = t.getBBox();
// When the text is rotated, its height is the hypotenuse
@@ -77,14 +72,15 @@ tr.exportTo('tr.ui.b', function() {
// triangle W. The bottomMargin must be equal to a side of H plus a
// side of W.
var h = Math.cos(Math.PI / 4) * (box.height + box.width);
- bottomMargin = Math.max(this.bottomMargin_, h);
+ bottomMargin = Math.max(bottomMargin, h);
}, this);
- if (Math.round(bottomMargin) !== Math.round(this.bottomMargin_)) {
- this.bottomMargin_ = bottomMargin;
+ bottomMargin = parseInt(Math.ceil(bottomMargin));
+ if (bottomMargin > this.margin.bottom) {
+ this.margin.bottom = bottomMargin;
this.updateContents_();
}
- }.bind(this));
+ }, this);
}
};
« no previous file with comments | « tracing/tracing/ui/base/line_chart.html ('k') | tracing/tracing/ui/base/overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698