| OLD | NEW |
| 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 class DefaultChartDataImpl extends ChangeNotifier implements ChartData { | 11 class DefaultChartDataImpl extends Observable implements ChartData { |
| 12 List<ChartColumnSpec> _columns; | 12 List<ChartColumnSpec> _columns; |
| 13 List<List> _rows; | 13 List<List> _rows; |
| 14 | 14 |
| 15 bool _hasObservableRows = false; | 15 bool _hasObservableRows = false; |
| 16 SubscriptionsDisposer _disposer = new SubscriptionsDisposer(); | 16 SubscriptionsDisposer _disposer = new SubscriptionsDisposer(); |
| 17 | 17 |
| 18 DefaultChartDataImpl( | 18 DefaultChartDataImpl( |
| 19 Iterable<ChartColumnSpec> columns, Iterable<Iterable> rows) { | 19 Iterable<ChartColumnSpec> columns, List<List> rows) { |
| 20 this.columns = new List<ChartColumnSpec>.from(columns); | 20 this.columns = columns; |
| 21 var rowsList = new List.from(rows); | 21 this.rows = rows; |
| 22 this.rows = new List<List>.generate( | |
| 23 rowsList.length, (i) => new List.from(rowsList[i])); | |
| 24 } | 22 } |
| 25 | 23 |
| 26 set columns(Iterable<ChartColumnSpec> value) { | 24 set columns(Iterable<ChartColumnSpec> value) { |
| 27 assert(value != null); | 25 assert(value != null); |
| 28 | 26 |
| 29 // Create a copy of columns. We do not currently support | 27 // Create a copy of columns. We do not currently support |
| 30 // changes to the list of columns. Any changes to the spec | 28 // changes to the list of columns. Any changes to the spec |
| 31 // will be applied at the next ChartBase.draw(); | 29 // will be applied at the next ChartBase.draw(); |
| 32 this._columns = new List<ChartColumnSpec>.from(value); | 30 this._columns = new List<ChartColumnSpec>.from(value); |
| 33 } | 31 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 strBuffer.write(' ' * lengthDiff + ' ${data} |'); | 132 strBuffer.write(' ' * lengthDiff + ' ${data} |'); |
| 135 | 133 |
| 136 if (i == row.length - 1) { | 134 if (i == row.length - 1) { |
| 137 strBuffer.write('\n' + '-' * totalLength + '\n'); | 135 strBuffer.write('\n' + '-' * totalLength + '\n'); |
| 138 } | 136 } |
| 139 } | 137 } |
| 140 } | 138 } |
| 141 return strBuffer.toString(); | 139 return strBuffer.toString(); |
| 142 } | 140 } |
| 143 } | 141 } |
| OLD | NEW |