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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ChartArea _area; | 71 ChartArea _area; |
72 ChartState _state; | 72 ChartState _state; |
73 SubscriptionsDisposer _disposer = new SubscriptionsDisposer(); | 73 SubscriptionsDisposer _disposer = new SubscriptionsDisposer(); |
74 | 74 |
75 Element _hovercardRoot; | 75 Element _hovercardRoot; |
76 | 76 |
77 Hovercard( | 77 Hovercard( |
78 {bool isMouseTracking, | 78 {bool isMouseTracking, |
79 bool isMultiValue: false, | 79 bool isMultiValue: false, |
80 bool showDimensionTitle: false, | 80 bool showDimensionTitle: false, |
81 List columnsToShow: const [], | 81 List<int> columnsToShow: const <int>[], |
82 this.builder}) { | 82 this.builder}) { |
83 _isMouseTracking = isMouseTracking; | 83 _isMouseTracking = isMouseTracking; |
84 _isMultiValue = isMultiValue; | 84 _isMultiValue = isMultiValue; |
85 _showDimensionTitle = showDimensionTitle; | 85 _showDimensionTitle = showDimensionTitle; |
86 _columnsToShow = columnsToShow; | 86 _columnsToShow = columnsToShow; |
87 } | 87 } |
88 | 88 |
89 void init(ChartArea area, Selection _, Selection __) { | 89 void init(ChartArea area, Selection _, Selection __) { |
90 _area = area; | 90 _area = area; |
91 _state = area.state; | 91 _state = area.state; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 var dimensionCol = area.config.dimensions.first, | 198 var dimensionCol = area.config.dimensions.first, |
199 dimensionScale = area.dimensionScales.first, | 199 dimensionScale = area.dimensionScales.first, |
200 measureScale = _getScaleForColumn(column), | 200 measureScale = _getScaleForColumn(column), |
201 dimensionOffset = this.offset, | 201 dimensionOffset = this.offset, |
202 dimensionCenterOffset = 0; | 202 dimensionCenterOffset = 0; |
203 | 203 |
204 // If we are using bands on the one axis that is shown | 204 // If we are using bands on the one axis that is shown |
205 // update position and offset accordingly. | 205 // update position and offset accordingly. |
206 if (area.dimensionsUsingBands.contains(dimensionCol)) { | 206 if (area.dimensionsUsingBands.contains(dimensionCol)) { |
207 assert(dimensionScale is OrdinalScale); | 207 assert(dimensionScale is OrdinalScale); |
208 dimensionOffset = (dimensionScale as OrdinalScale).rangeBand / 2; | 208 dimensionOffset = (dimensionScale as OrdinalScale).rangeBand ~/ 2; |
209 dimensionCenterOffset = dimensionOffset; | 209 dimensionCenterOffset = dimensionOffset; |
210 } | 210 } |
211 | 211 |
212 var rowData = area.data.rows.elementAt(row), | 212 var rowData = area.data.rows.elementAt(row), |
213 measurePosition = 0, | 213 measurePosition = 0, |
214 isNegative = false, | 214 isNegative = false, |
215 dimensionPosition = dimensionScale | 215 dimensionPosition = dimensionScale |
216 .scale(rowData.elementAt(dimensionCol)) + | 216 .scale(rowData.elementAt(dimensionCol)) + |
217 dimensionCenterOffset; | 217 dimensionCenterOffset; |
218 | 218 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 406 } |
407 } | 407 } |
408 if (formatter == null) { | 408 if (formatter == null) { |
409 // Formatter function must return String. Default to identity function | 409 // Formatter function must return String. Default to identity function |
410 // but return the toString() instead. | 410 // but return the toString() instead. |
411 formatter = (x) => x.toString(); | 411 formatter = (x) => x.toString(); |
412 } | 412 } |
413 return formatter; | 413 return formatter; |
414 } | 414 } |
415 } | 415 } |
OLD | NEW |