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

Unified Diff: tracing/tracing/value/ui/composition_span.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
Index: tracing/tracing/value/ui/composition_span.html
diff --git a/tracing/tracing/value/ui/composition_span.html b/tracing/tracing/value/ui/composition_span.html
new file mode 100644
index 0000000000000000000000000000000000000000..0a99ece202c94b5482a3f1e02238cdf4f2f2dc00
--- /dev/null
+++ b/tracing/tracing/value/ui/composition_span.html
@@ -0,0 +1,83 @@
+<!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/bar_chart.html">
+<link rel="import" href="/tracing/ui/base/drag_handle.html">
+
+<dom-module id="tr-v-ui-composition-span">
+ <template>
+ <div id="container"></div>
+ <tr-ui-b-drag-handle id="drag_handle"></tr-ui-b-drag-handle>
+ </template>
+</dom-module>
+<script>
+'use strict';
+Polymer({
+ is: 'tr-v-ui-composition-span',
+
+ created: function() {
+ this.diagnostic_ = undefined;
+ this.chart_ = new tr.ui.b.BarChart();
+ this.chart_.width = 190;
+ this.chart_.height = 200;
+ this.chart_.isStacked = true;
+ this.chart_.hideXAxis = true;
+ this.chart_.margin.top = 10;
+ this.chart_.margin.bottom = 10;
+ this.chart_.margin.right = 120;
+ this.minHeightPx_ = 40;
+ },
+
+ ready: function() {
+ Polymer.dom(this.$.container).appendChild(this.chart_);
+ this.$.drag_handle.target = this.$.container;
+ this.$.drag_handle.addEventListener(
+ 'drag-handle-resize', this.onResize_.bind(this));
+ },
+
+ onResize_: function(event) {
+ event.stopPropagation();
+ var heightPx = parseInt(this.$.container.style.height);
+ if (heightPx < this.minHeightPx_) {
+ heightPx = this.minHeightPx_;
+ this.$.container.style.height = this.minHeightPx_ + 'px';
+ }
+ this.chart_.height = heightPx;
+ },
+
+ get diagnostic() {
+ return this.diagnostic_;
+ },
+
+ set diagnostic(d) {
+ this.diagnostic_ = d;
+ this.updateContents_();
+ },
+
+ updateContents_: function() {
+ if (!this.diagnostic_) {
+ this.chart_.data = [];
+ return;
+ }
+ var data = {x: 0};
+ this.minHeightPx_ = 20;
+ this.diagnostic_.iterItems(function(name, value) {
+ this.chart_.getDataSeries(name).target = value;
+ this.chart_.getDataSeries(name).optional = true;
+ this.minHeightPx_ += 20;
+
+ value = value.numeric;
+ if (value instanceof tr.v.ScalarNumeric)
+ data[name] = value.value;
+ else if (value instanceof tr.v.Numeric)
+ data[name] = value.sum;
+
+ }, this);
+ this.chart_.data = [data];
+ }
+});
+</script>
« no previous file with comments | « tracing/tracing/value/ui/all_value_set_views.html ('k') | tracing/tracing/value/ui/composition_span_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698