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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 : ChartState.VAL_UNHIGHLIGHTED; | 110 : ChartState.VAL_UNHIGHLIGHTED; |
111 } | 111 } |
112 if (state.preview == i) { | 112 if (state.preview == i) { |
113 flags |= ChartState.VAL_HOVERED; | 113 flags |= ChartState.VAL_HOVERED; |
114 } | 114 } |
115 } | 115 } |
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 = [], | 126 var styles = [], flags = _valueStateCache[row]; |
127 flags = _valueStateCache[row]; | |
128 | 127 |
129 if (flags & ChartState.VAL_HIGHLIGHTED != 0) { | 128 if (flags & ChartState.VAL_HIGHLIGHTED != 0) { |
130 styles.add(ChartState.VAL_HIGHLIGHTED_CLASS); | 129 styles.add(ChartState.VAL_HIGHLIGHTED_CLASS); |
131 } else if (flags & ChartState.VAL_UNHIGHLIGHTED != 0) { | 130 } else if (flags & ChartState.VAL_UNHIGHLIGHTED != 0) { |
132 styles.add(ChartState.VAL_UNHIGHLIGHTED_CLASS); | 131 styles.add(ChartState.VAL_UNHIGHLIGHTED_CLASS); |
133 } | 132 } |
134 if (flags & ChartState.VAL_HOVERED != 0) { | 133 if (flags & ChartState.VAL_HOVERED != 0) { |
135 styles.add(ChartState.VAL_HOVERED_CLASS); | 134 styles.add(ChartState.VAL_HOVERED_CLASS); |
136 } | 135 } |
137 | 136 |
138 _valueStylesCache[row] = styles; | 137 _valueStylesCache[row] = styles; |
139 } | 138 } |
140 } | 139 } |
141 return _valueStylesCache[row]; | 140 return _valueStylesCache[row]; |
142 } | 141 } |
143 | 142 |
144 String colorForValue(int row, {bool isTail: false}) => isTail | 143 String colorForValue(int row, {bool isTail: false}) => isTail |
145 ? theme.getOtherColor() | 144 ? theme.getOtherColor() |
146 : theme.getColorForKey(row, _valueStateCache[row]); | 145 : theme.getColorForKey(row, _valueStateCache[row]); |
147 } | 146 } |
OLD | NEW |