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

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

Issue 2341623002: Display Histograms in value-set-table-cells. (Closed)
Patch Set: . Created 4 years, 3 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/chart_base.html ('k') | tracing/tracing/ui/base/column_chart.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/ui/base/chart_base_2d.html
diff --git a/tracing/tracing/ui/base/chart_base_2d.html b/tracing/tracing/ui/base/chart_base_2d.html
index 5f9c29e8c5d7a08b77557cd9734490a2e450883b..6f9021c554395a21acec78fe40ef658969293f02 100644
--- a/tracing/tracing/ui/base/chart_base_2d.html
+++ b/tracing/tracing/ui/base/chart_base_2d.html
@@ -42,6 +42,8 @@ tr.exportTo('tr.ui.b', function() {
this.hideXAxis_ = false;
this.hideYAxis_ = false;
this.data_ = [];
+ this.xAxisLabel_ = '';
+ this.yAxisLabel_ = '';
d3.select(this.chartAreaElement)
.append('g')
@@ -53,6 +55,22 @@ tr.exportTo('tr.ui.b', function() {
this.addEventListener('mousedown', this.onMouseDown_.bind(this));
},
+ get xAxisLabel() {
+ return this.xAxisLabel_;
+ },
+
+ set xAxisLabel(label) {
+ this.xAxisLabel_ = label;
+ },
+
+ get yAxisLabel() {
+ return this.yAxisLabel_;
+ },
+
+ set yAxisLabel(label) {
+ this.yAxisLabel_ = label;
+ },
+
get hideXAxis() {
return this.hideXAxis_;
},
@@ -181,6 +199,13 @@ tr.exportTo('tr.ui.b', function() {
return;
this.drawXAxis_(xAxis);
+
+ var label = xAxis.append('text').attr('class', 'label');
+
+ tr.b.requestAnimationFrame(() => {
+ this.drawXAxisTicks_(xAxis);
+ this.drawXAxisLabel_(label);
+ });
},
drawXAxis_: function(xAxis) {
@@ -188,7 +213,13 @@ tr.exportTo('tr.ui.b', function() {
.call(d3.svg.axis()
.scale(this.xScale_)
.orient('bottom'));
- tr.b.requestAnimationFrame(this.drawXAxisTicks_.bind(this, xAxis));
+ },
+
+ drawXAxisLabel_: function(label) {
+ label
+ .attr('x', this.chartAreaSize.width + 16)
+ .attr('y', 8)
+ .text(this.xAxisLabel);
},
drawXAxisTicks_: function(xAxis) {
@@ -236,6 +267,13 @@ tr.exportTo('tr.ui.b', function() {
return;
this.drawYAxis_(yAxis);
+
+ var label = yAxis.append('text').attr('class', 'label');
+
+ tr.b.requestAnimationFrame(() => {
+ this.drawYAxisTicks_(yAxis);
+ this.drawYAxisLabel_(label);
+ });
},
drawYAxis_: function(yAxis) {
@@ -267,8 +305,15 @@ tr.exportTo('tr.ui.b', function() {
}
yAxis.call(axisModifier);
+ },
- tr.b.requestAnimationFrame(this.drawYAxisTicks_.bind(this, yAxis));
+ drawYAxisLabel_: function(label) {
+ var labelWidthPx = Math.ceil(tr.ui.b.getSVGTextWidth(
+ this.chartAreaElement, this.yAxisLabel));
+ label
+ .attr('x', -labelWidthPx)
+ .attr('y', -8)
+ .text(this.yAxisLabel);
},
drawYAxisTicks_: function(yAxis) {
« no previous file with comments | « tracing/tracing/ui/base/chart_base.html ('k') | tracing/tracing/ui/base/column_chart.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698