| 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 library charted.svg.axis; | 9 library charted.svg.axis; | 
| 10 | 10 | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92         ellipsized = axisTicksBuilder.shortenedTicks; | 92         ellipsized = axisTicksBuilder.shortenedTicks; | 
| 93 | 93 | 
| 94     var ticks = group.selectAll('.tick').data(values, current.scale), | 94     var ticks = group.selectAll('.tick').data(values, current.scale), | 
| 95         exit = ticks.exit, | 95         exit = ticks.exit, | 
| 96         transform = isVertical ? _yAxisTransform : _xAxisTransform, | 96         transform = isVertical ? _yAxisTransform : _xAxisTransform, | 
| 97         sign = isTop || isLeft ? -1 : 1, | 97         sign = isTop || isLeft ? -1 : 1, | 
| 98         isEllipsized = ellipsized != formatted; | 98         isEllipsized = ellipsized != formatted; | 
| 99 | 99 | 
| 100     var enter = ticks.enter.appendWithCallback((d, i, e) { | 100     var enter = ticks.enter.appendWithCallback((d, i, e) { | 
| 101       var group = Namespace.createChildElement('g', e) | 101       var group = Namespace.createChildElement('g', e) | 
| 102         ..attributes['class'] = 'tick' |  | 
| 103         ..append(Namespace.createChildElement('line', e)) | 102         ..append(Namespace.createChildElement('line', e)) | 
| 104         ..append(Namespace.createChildElement('text', e) | 103         ..append(Namespace.createChildElement('text', e) | 
| 105           ..attributes['dy'] = | 104           ..attributes['dy'] = | 
| 106               isVertical ? '0.32em' : (isBottom ? '0.71em' : '0')); | 105               isVertical ? '0.32em' : (isBottom ? '0.71em' : '0')); | 
| 107       if (!isInitialRender) { | 106       if (!isInitialRender) { | 
| 108         group.style.setProperty('opacity', EPSILON.toString()); | 107         group.style.setProperty('opacity', EPSILON.toString()); | 
| 109       } | 108       } | 
| 110       return group; | 109       return group; | 
| 111     }); | 110     }); | 
| 112 | 111 | 
| 113     // All attributes/styles/classes that may change due to theme and scale. | 112     // All attributes/styles/classes that may change due to theme and scale. | 
| 114     // TODO(prsd): Order elements before updating ticks. | 113     // TODO(prsd): Order elements before updating ticks. | 
| 115     ticks.each((d, i, e) { | 114     ticks.each((d, i, e) { | 
|  | 115       e.attributes['class'] = 'tick tick-$i'; | 
| 116       Element line = e.firstChild; | 116       Element line = e.firstChild; | 
| 117       Element text = e.lastChild; | 117       Element text = e.lastChild; | 
| 118       bool isRTLText = false; // FIXME(prsd) | 118       bool isRTLText = false; // FIXME(prsd) | 
| 119 | 119 | 
| 120       if (isHorizontal) { | 120       if (isHorizontal) { | 
| 121         line.attributes['y2'] = '${sign * innerTickSize}'; | 121         line.attributes['y2'] = '${sign * innerTickSize}'; | 
| 122         text.attributes['y'] = | 122         text.attributes['y'] = | 
| 123             '${sign * (math.max(innerTickSize, 0) + tickPadding)}'; | 123             '${sign * (math.max(innerTickSize, 0) + tickPadding)}'; | 
| 124 | 124 | 
| 125         if (axisTicksBuilder.rotation != 0) { | 125         if (axisTicksBuilder.rotation != 0) { | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 223   /// List of ticks that will be displayed on the axis. | 223   /// List of ticks that will be displayed on the axis. | 
| 224   Iterable get ticks => _ticks; | 224   Iterable get ticks => _ticks; | 
| 225 | 225 | 
| 226   /// List of formatted ticks values. | 226   /// List of formatted ticks values. | 
| 227   Iterable get formattedTicks => _formattedTicks; | 227   Iterable get formattedTicks => _formattedTicks; | 
| 228 | 228 | 
| 229   /// List of clipped tick values, if they had to be clipped. Must be same | 229   /// List of clipped tick values, if they had to be clipped. Must be same | 
| 230   /// as the [formattedTicks] if none of the ticks were ellipsized. | 230   /// as the [formattedTicks] if none of the ticks were ellipsized. | 
| 231   Iterable get shortenedTicks => _formattedTicks; | 231   Iterable get shortenedTicks => _formattedTicks; | 
| 232 } | 232 } | 
| OLD | NEW | 
|---|