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

Side by Side Diff: packages/charted/lib/charts/data_transformers/filter_transformer.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
11 typedef bool FilterFunction(dynamic value); 11 typedef bool FilterFunction(dynamic value);
12 12
13 /// Transforms the ChartData base on the specified FilterDefinitions. Each row 13 /// Transforms the ChartData base on the specified FilterDefinitions. Each row
14 /// of data will be tested by passing the value at target column to the filter 14 /// of data will be tested by passing the value at target column to the filter
15 /// function. If filter function returns false, the row will be filtered out. 15 /// function. If filter function returns false, the row will be filtered out.
16 /// This transformer does not modify the column part of the input ChartData. 16 /// This transformer does not modify the column part of the input ChartData.
17 class FilterTransformer extends ChangeNotifier 17 class FilterTransformer extends ChangeNotifier
18 implements ChartDataTransform, ChartData { 18 implements ChartDataTransform, ChartData {
19 final SubscriptionsDisposer _dataSubscriptions = new SubscriptionsDisposer(); 19 final SubscriptionsDisposer _dataSubscriptions = new SubscriptionsDisposer();
20 Iterable<ChartColumnSpec> columns; 20 List<ChartColumnSpec> columns;
21 ObservableList<Iterable> rows = new ObservableList(); 21 ObservableList<List> rows = new ObservableList();
22 List<FilterDefinition> filterFunctions; 22 List<FilterDefinition> filterFunctions;
23 ChartData _data; 23 ChartData _data;
24 24
25 FilterTransformer(this.filterFunctions); 25 FilterTransformer(this.filterFunctions);
26 26
27 /// Transforms the input data with the list of [FilterDefinition] specified in 27 /// Transforms the input data with the list of [FilterDefinition] specified in
28 /// the constructor. If the rows and columns are ObservableList in the data, 28 /// the constructor. If the rows and columns are ObservableList in the data,
29 /// changes in rows and columns in input data will trigger transform to be 29 /// changes in rows and columns in input data will trigger transform to be
30 /// performed again to update the output rows and columns. 30 /// performed again to update the output rows and columns.
31 ChartData transform(ChartData data) { 31 ChartData transform(ChartData data) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 class FilterDefinition { 71 class FilterDefinition {
72 final FilterFunction filterFunc; 72 final FilterFunction filterFunc;
73 final int targetColumn; 73 final int targetColumn;
74 FilterDefinition(this.targetColumn, this.filterFunc); 74 FilterDefinition(this.targetColumn, this.filterFunc);
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698