| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library isolate_summary_element; | 5 library isolate_summary_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
| 10 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 _chart.draw(_table); | 83 _chart.draw(_table); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 @CustomTag('isolate-counter-chart') | 87 @CustomTag('isolate-counter-chart') |
| 88 class IsolateCounterChartElement extends ObservatoryElement { | 88 class IsolateCounterChartElement extends ObservatoryElement { |
| 89 IsolateCounterChartElement.created() : super.created(); | 89 IsolateCounterChartElement.created() : super.created(); |
| 90 | 90 |
| 91 @published ObservableMap counters; | 91 @published ObservableMap counters; |
| 92 CounterChart chart = new CounterChart(); | 92 CounterChart chart; |
| 93 | 93 |
| 94 void countersChanged(oldValue) { | 94 void countersChanged(oldValue) { |
| 95 if (counters == null) { | 95 if (counters == null) { |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 // Lazily create the chart. |
| 99 if (GoogleChart.ready && chart == null) { |
| 100 chart = new CounterChart(); |
| 101 } |
| 102 if (chart == null) { |
| 103 return; |
| 104 } |
| 98 chart.update(counters); | 105 chart.update(counters); |
| 99 var element = shadowRoot.querySelector('#counterPieChart'); | 106 var element = shadowRoot.querySelector('#counterPieChart'); |
| 100 if (element != null) { | 107 if (element != null) { |
| 101 chart.draw(element); | 108 chart.draw(element); |
| 102 } | 109 } |
| 103 } | 110 } |
| 104 } | 111 } |
| 105 | 112 |
| 106 | 113 |
| 107 | 114 |
| OLD | NEW |