[Plot] Use reverse filter for plot ticks

...to remove CSS-related reversal from scripts
This commit is contained in:
Victor Woeltjen 2016-01-15 13:09:05 -08:00
parent 96dc055f02
commit a94e99af70
2 changed files with 2 additions and 9 deletions

View File

@ -153,7 +153,7 @@
class="gl-plot-tick gl-plot-x-tick-label"
ng-show="$index > 0 && $index < (subplot.getDomainTicks().length - 1)"
ng-style="{ left: (100 * $index / (subplot.getDomainTicks().length - 1)) + '%' }">
{{tick.label}}
{{tick.label | reverse}}
</div>
<div class="gl-plot-label gl-plot-x-label">

View File

@ -57,19 +57,12 @@ define(
PlotTickGenerator.prototype.generateTicks = function (start, span, count, format) {
var step = span / (count - 1),
result = [],
tickVal = '',
i;
for (i = 0; i < count; i += 1) {
tickVal = format(i * step + start);
if (tickVal !== undefined) {
// Make the tick value have its ellipsis on the least significant left side by reversing it here,
// and then reversing it again via CSS.
tickVal = tickVal.toString().split('').reverse().join('');
}
result.push({
//If data to show, display label for each tick line, otherwise show lines but suppress labels.
label: span > 0 ? tickVal : ''
label: span > 0 ? format(i * step + start) : ''
});
}