OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 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 The chart-container element represents one chart and all related functionality, | 8 The chart-container element represents one chart and all related functionality, |
9 including a legend listing different traces that can be plotted on the same | 9 including a legend listing different traces that can be plotted on the same |
10 chart, a revision range selecting mini-chart at the bottom, and all of the alert | 10 chart, a revision range selecting mini-chart at the bottom, and all of the alert |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 | 1504 |
1505 const scratchCanvasContext = this.$.text_measurement.getContext('2d'); | 1505 const scratchCanvasContext = this.$.text_measurement.getContext('2d'); |
1506 let maxTickLabelWidth = 0; | 1506 let maxTickLabelWidth = 0; |
1507 for (const tickValue of tickValues) { | 1507 for (const tickValue of tickValues) { |
1508 const formattedValue = opts.tickFormatter(tickValue); | 1508 const formattedValue = opts.tickFormatter(tickValue); |
1509 const valueWidth = Math.ceil(scratchCanvasContext.measureText( | 1509 const valueWidth = Math.ceil(scratchCanvasContext.measureText( |
1510 formattedValue).width); | 1510 formattedValue).width); |
1511 maxTickLabelWidth = Math.max(maxTickLabelWidth, valueWidth); | 1511 maxTickLabelWidth = Math.max(maxTickLabelWidth, valueWidth); |
1512 } | 1512 } |
1513 | 1513 |
1514 const axisLabelWidth = | 1514 const axisLabelWidth = this.$['chart-yaxis-label'].offsetHeight; |
1515 this.querySelector('#chart-yaxis-label').offsetHeight; | |
1516 | 1515 |
1517 const padding = 5; | 1516 const padding = 5; |
1518 | 1517 |
1519 return axisLabelWidth + maxTickLabelWidth + padding; | 1518 return axisLabelWidth + maxTickLabelWidth + padding; |
1520 }, | 1519 }, |
1521 | 1520 |
1522 /** | 1521 /** |
1523 * Updates the currently displayed chart. | 1522 * Updates the currently displayed chart. |
1524 */ | 1523 */ |
1525 updateChart() { | 1524 updateChart() { |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 }, | 2667 }, |
2669 | 2668 |
2670 listeners: { | 2669 listeners: { |
2671 drop: 'onDrop', | 2670 drop: 'onDrop', |
2672 dragover: 'allowDrop' | 2671 dragover: 'allowDrop' |
2673 } | 2672 } |
2674 }); | 2673 }); |
2675 })(); | 2674 })(); |
2676 </script> | 2675 </script> |
2677 </dom-module> | 2676 </dom-module> |
OLD | NEW |