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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 _valueStateCache[i] = flags; | 116 _valueStateCache[i] = flags; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 Iterable<String> stylesForValue(int row, {bool isTail: false}) { | 120 Iterable<String> stylesForValue(int row, {bool isTail: false}) { |
121 if (isTail == true) return const []; | 121 if (isTail == true) return const []; |
122 if (_valueStylesCache[row] == null) { | 122 if (_valueStylesCache[row] == null) { |
123 if (state == null) { | 123 if (state == null) { |
124 _valueStylesCache[row] = const []; | 124 _valueStylesCache[row] = const []; |
125 } else { | 125 } else { |
126 var styles = [], flags = _valueStateCache[row]; | 126 var styles = <String>[], flags = _valueStateCache[row]; |
127 | 127 |
128 if (flags & ChartState.VAL_HIGHLIGHTED != 0) { | 128 if (flags & ChartState.VAL_HIGHLIGHTED != 0) { |
129 styles.add(ChartState.VAL_HIGHLIGHTED_CLASS); | 129 styles.add(ChartState.VAL_HIGHLIGHTED_CLASS); |
130 } else if (flags & ChartState.VAL_UNHIGHLIGHTED != 0) { | 130 } else if (flags & ChartState.VAL_UNHIGHLIGHTED != 0) { |
131 styles.add(ChartState.VAL_UNHIGHLIGHTED_CLASS); | 131 styles.add(ChartState.VAL_UNHIGHLIGHTED_CLASS); |
132 } | 132 } |
133 if (flags & ChartState.VAL_HOVERED != 0) { | 133 if (flags & ChartState.VAL_HOVERED != 0) { |
134 styles.add(ChartState.VAL_HOVERED_CLASS); | 134 styles.add(ChartState.VAL_HOVERED_CLASS); |
135 } | 135 } |
136 | 136 |
137 _valueStylesCache[row] = styles; | 137 _valueStylesCache[row] = styles; |
138 } | 138 } |
139 } | 139 } |
140 return _valueStylesCache[row]; | 140 return _valueStylesCache[row]; |
141 } | 141 } |
142 | 142 |
143 String colorForValue(int row, {bool isTail: false}) => isTail | 143 String colorForValue(int row, {bool isTail: false}) => isTail |
144 ? theme.getOtherColor() | 144 ? theme.getOtherColor() |
145 : theme.getColorForKey(row, _valueStateCache[row]); | 145 : theme.getColorForKey(row, _valueStateCache[row]); |
146 } | 146 } |
OLD | NEW |