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

Side by Side Diff: packages/charted/lib/charts/src/layout_area_impl.dart

Issue 2213693002: Updated charted DEP to 0.4.X (Closed) Base URL: https://github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // 1 //
2 // Copyright 2014 Google Inc. All rights reserved. 2 // Copyright 2014 Google Inc. All rights reserved.
3 // 3 //
4 // Use of this source code is governed by a BSD-style 4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at 5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd 6 // https://developers.google.com/open-source/licenses/bsd
7 // 7 //
8 8
9 part of charted.charts; 9 part of charted.charts;
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 Transition.defaultEasingType = theme.transitionEasingType; 72 Transition.defaultEasingType = theme.transitionEasingType;
73 Transition.defaultEasingMode = theme.transitionEasingMode; 73 Transition.defaultEasingMode = theme.transitionEasingMode;
74 Transition.defaultDurationMilliseconds = 74 Transition.defaultDurationMilliseconds =
75 theme.transitionDurationMilliseconds; 75 theme.transitionDurationMilliseconds;
76 } 76 }
77 77
78 void dispose() { 78 void dispose() {
79 _configEventsDisposer.dispose(); 79 _configEventsDisposer.dispose();
80 _dataEventsDisposer.dispose(); 80 _dataEventsDisposer.dispose();
81 _config.legend.dispose(); 81 _config.legend?.dispose();
82 } 82 }
83 83
84 static bool isNotInline(Element e) => 84 static bool isNotInline(Element e) =>
85 e != null && e.getComputedStyle().display != 'inline'; 85 e != null && e.getComputedStyle().display != 'inline';
86 86
87 /// Set new data for this chart. If [value] is [Observable], subscribes to 87 /// Set new data for this chart. If [value] is [Observable], subscribes to
88 /// changes and updates the chart when data changes. 88 /// changes and updates the chart when data changes.
89 @override 89 @override
90 set data(ChartData value) { 90 set data(ChartData value) {
91 _data = value; 91 _data = value;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 // Create a group for rendering, if it was not already done. 199 // Create a group for rendering, if it was not already done.
200 if (group == null) { 200 if (group == null) {
201 group = Namespace.createChildElement('g', visualization.first) 201 group = Namespace.createChildElement('g', visualization.first)
202 ..classes.add('series-group'); 202 ..classes.add('series-group');
203 visualization.first.append(group); 203 visualization.first.append(group);
204 } 204 }
205 205
206 // If we previously displayed a series, verify that we are 206 // If we previously displayed a series, verify that we are
207 // still using the same renderer. Otherwise, dispose the older one. 207 // still using the same renderer. Otherwise, dispose the older one.
208 if (_renderer != null && series.renderer != _renderer) { 208 if (_renderer != series.renderer) {
209 _rendererDisposer.dispose(); 209 if (_renderer != null) _rendererDisposer.dispose();
210 }
211 210
212 // Save and subscribe to events on the the current renderer. 211 // Save and subscribe to events on the the current renderer.
213 _renderer = series.renderer; 212 _renderer = series.renderer;
214 if (_renderer is ChartRendererBehaviorSource) { 213 if (_renderer is ChartRendererBehaviorSource) {
215 _rendererDisposer.addAll([ 214 _rendererDisposer.addAll([
216 _renderer.onValueClick.listen((ChartEvent e) { 215 _renderer.onValueClick.listen((ChartEvent e) {
217 if (state != null) { 216 if (state != null) {
218 if (state.isSelected(e.row)) { 217 if (state.isSelected(e.row)) {
219 state.unselect(e.row); 218 state.unselect(e.row);
220 } else { 219 } else {
221 state.select(e.row); 220 state.select(e.row);
221 }
222 } 222 }
223 } 223 if (_valueMouseClickController != null) {
224 if (_valueMouseClickController != null) { 224 _valueMouseClickController.add(e);
225 _valueMouseClickController.add(e);
226 }
227 }),
228 _renderer.onValueMouseOver.listen((ChartEvent e) {
229 if (state != null) {
230 state.preview = e.row;
231 }
232 if (_valueMouseOverController != null) {
233 _valueMouseOverController.add(e);
234 }
235 }),
236 _renderer.onValueMouseOut.listen((ChartEvent e) {
237 if (state != null) {
238 if (e.row == state.preview) {
239 state.hovered = null;
240 } 225 }
241 } 226 }),
242 if (_valueMouseOutController != null) { 227 _renderer.onValueMouseOver.listen((ChartEvent e) {
243 _valueMouseOutController.add(e); 228 if (state != null) {
244 } 229 state.preview = e.row;
245 }) 230 }
246 ]); 231 if (_valueMouseOverController != null) {
232 _valueMouseOverController.add(e);
233 }
234 }),
235 _renderer.onValueMouseOut.listen((ChartEvent e) {
236 if (state != null) {
237 if (e.row == state.preview) {
238 state.hovered = null;
239 }
240 }
241 if (_valueMouseOutController != null) {
242 _valueMouseOutController.add(e);
243 }
244 })
245 ]);
246 }
247 } 247 }
248 248
249 Iterable<ChartLegendItem> legend = 249 Iterable<ChartLegendItem> legend =
250 _renderer.layout(group, schedulePostRender: schedulePostRender); 250 _renderer.layout(group, schedulePostRender: schedulePostRender);
251 251
252 // Notify on the stream that the chart has been updated. 252 // Notify on the stream that the chart has been updated.
253 isReady = true; 253 isReady = true;
254 254
255 // Save the list of valid series and initialize axes. 255 // Save the list of valid series and initialize axes.
256 _series = series; 256 _series = series;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 @override 317 @override
318 void removeChartBehavior(ChartBehavior behavior) { 318 void removeChartBehavior(ChartBehavior behavior) {
319 if (behavior == null || !_behaviors.contains(behavior)) return; 319 if (behavior == null || !_behaviors.contains(behavior)) return;
320 if (upperBehaviorPane != null && lowerBehaviorPane != null) { 320 if (upperBehaviorPane != null && lowerBehaviorPane != null) {
321 behavior.dispose(); 321 behavior.dispose();
322 } 322 }
323 _behaviors.remove(behavior); 323 _behaviors.remove(behavior);
324 } 324 }
325 } 325 }
OLDNEW
« no previous file with comments | « packages/charted/lib/charts/src/chart_state_impl.dart ('k') | packages/charted/lib/core/interpolators/easing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698