OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/color_scheme.html"> | 8 <link rel="import" href="/tracing/base/color_scheme.html"> |
9 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> | 9 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> |
10 <link rel="import" href="/tracing/ui/base/d3.html"> | 10 <link rel="import" href="/tracing/ui/base/d3.html"> |
(...skipping 16 matching lines...) Expand all Loading... |
27 </style> | 27 </style> |
28 | 28 |
29 <input type=checkbox id="checkbox" checked> | 29 <input type=checkbox id="checkbox" checked> |
30 <tr-ui-a-analysis-link id="link"></tr-ui-a-analysis-link> | 30 <tr-ui-a-analysis-link id="link"></tr-ui-a-analysis-link> |
31 <label id="label"></label> | 31 <label id="label"></label> |
32 </template> | 32 </template> |
33 </dom-module> | 33 </dom-module> |
34 | 34 |
35 <script> | 35 <script> |
36 'use strict'; | 36 'use strict'; |
| 37 |
| 38 tr.exportTo('tr.ui.b', function() { |
| 39 function getSVGTextWidth(parentNode, text) { |
| 40 var textNode = document.createElementNS( |
| 41 'http://www.w3.org/2000/svg', 'text'); |
| 42 textNode.setAttributeNS(null, 'x', 0); |
| 43 textNode.setAttributeNS(null, 'y', 0); |
| 44 textNode.setAttributeNS(null, 'fill', 'black'); |
| 45 textNode.appendChild(document.createTextNode(text)); |
| 46 parentNode.appendChild(textNode); |
| 47 var widthPx = textNode.getComputedTextLength(); |
| 48 parentNode.removeChild(textNode); |
| 49 return widthPx; |
| 50 } |
| 51 |
| 52 return { |
| 53 getSVGTextWidth: getSVGTextWidth |
| 54 }; |
| 55 }); |
| 56 |
37 Polymer({ | 57 Polymer({ |
38 is: 'tr-ui-b-chart-legend-key', | 58 is: 'tr-ui-b-chart-legend-key', |
39 | 59 |
40 ready: function() { | 60 ready: function() { |
41 this.$.checkbox.addEventListener( | 61 this.$.checkbox.addEventListener( |
42 'change', this.onCheckboxChange_.bind(this)); | 62 'change', this.onCheckboxChange_.bind(this)); |
43 }, | 63 }, |
44 | 64 |
45 /** | 65 /** |
46 * Dispatch an event when the checkbox is toggled. | 66 * Dispatch an event when the checkbox is toggled. |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 479 } |
460 }; | 480 }; |
461 | 481 |
462 return { | 482 return { |
463 DataSeriesEnableChangeEventType: DataSeriesEnableChangeEventType, | 483 DataSeriesEnableChangeEventType: DataSeriesEnableChangeEventType, |
464 getColorOfKey: getColorOfKey, | 484 getColorOfKey: getColorOfKey, |
465 ChartBase: ChartBase | 485 ChartBase: ChartBase |
466 }; | 486 }; |
467 }); | 487 }); |
468 </script> | 488 </script> |
OLD | NEW |