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

Unified Diff: tracing/tracing/value/ui/scalar_map_table.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
Index: tracing/tracing/value/ui/scalar_map_table.html
diff --git a/tracing/tracing/value/ui/scalar_map_table.html b/tracing/tracing/value/ui/scalar_map_table.html
new file mode 100644
index 0000000000000000000000000000000000000000..f303cb781dc3aaeea66b926b988681d428d4d8bc
--- /dev/null
+++ b/tracing/tracing/value/ui/scalar_map_table.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<!--
+Copyright 2016 The Chromium Authors. All rights reserved.
+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/ui/base/table.html">
+<link rel="import" href="/tracing/value/ui/scalar_span.html">
+
+<dom-module name="tr-v-ui-scalar-map-table">
+ <template>
+ <style>
+ </style>
+ <tr-ui-b-table id="table"></tr-ui-b-table>
+ </template>
+</dom-module>
+
+<script>
+'use strict';
+Polymer({
+ is: 'tr-v-ui-scalar-map-table',
+
+ created: function() {
+ /** @type {!Map.<string, !tr.v.ScalarNumeric>} */
+ this.scalarMap_ = new Map();
+
+ /** @type {!Map.<string, !tr.b.Statistics.Significance>} */
+ this.significance_ = new Map();
+ },
+
+ ready: function() {
+ this.$.table.showHeader = false;
+ this.$.table.tableColumns = [
+ {
+ value: function(row) {
+ return row.name;
+ }
+ },
+ {
+ align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
+ value: function(row) {
+ var span = tr.v.ui.createScalarSpan(row.value);
+ if (row.significance !== undefined) {
+ span.significance = row.significance;
+ } else if (row.anyRowsHaveSignificance) {
+ // Ensure vertical alignment.
+ span.style.marginRight = '14px';
+ }
+ span.style.whiteSpace = 'nowrap';
+ return span;
+ }
+ }
+ ];
+ },
+
+ get scalarMap() {
+ return this.scalarMap_;
+ },
+
+ /**
+ * @param {!Map.<string,!tr.v.ScalarNumeric>} map
+ */
+ set scalarMap(map) {
+ this.scalarMap_ = map;
+ this.updateContents_();
+ },
+
+ /**
+ * @param {string} key
+ * @param {!tr.b.Statistics.Significance} significance
+ */
+ setSignificanceForKey: function(key, significance) {
+ this.significance_.set(key, significance);
+ this.updateContents_();
+ },
+
+ updateContents_: function() {
+ var rows = [];
+ for (var [key, scalar] of this.scalarMap) {
+ rows.push({
+ name: key,
+ value: scalar,
+ significance: this.significance_.get(key),
+ anyRowsHaveSignificance: (this.significance_.size > 0)
+ });
+ }
+ this.$.table.tableRows = rows;
+ this.$.table.rebuild();
+ }
+});
+</script>
« no previous file with comments | « tracing/tracing/value/ui/numeric_stats_span_test.html ('k') | tracing/tracing/value/ui/scalar_map_table_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698