X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph-layout.js;h=c32a9e5c4b1c8174a6c150a578ba4423aa8b41c9;hb=bd6ee5dcf9017abcbefa480e79756a6957c5c7ed;hp=3bc91354ec3c9a444b73d5d0bac586ed36003f46;hpb=6eef8c1b9ec7b247ee2b508032bd3ec957d0fb68;p=dygraphs.git diff --git a/src/dygraph-layout.js b/src/dygraph-layout.js index 3bc9135..c32a9e5 100644 --- a/src/dygraph-layout.js +++ b/src/dygraph-layout.js @@ -276,14 +276,16 @@ DygraphLayout.prototype._evaluateLineCharts = function() { }; DygraphLayout.prototype._evaluateLineTicks = function() { - var i, tick, label, pos; + var i, tick, label, pos, v, has_tick; this.xticks = []; for (i = 0; i < this.xTicks_.length; i++) { tick = this.xTicks_[i]; label = tick.label; - pos = this.dygraph_.toPercentXCoord(tick.v); + has_tick = !('label_v' in tick); + v = has_tick ? tick.v : tick.label_v; + pos = this.dygraph_.toPercentXCoord(v); if ((pos >= 0.0) && (pos < 1.0)) { - this.xticks.push([pos, label]); + this.xticks.push({pos, label, has_tick}); } } @@ -293,9 +295,11 @@ DygraphLayout.prototype._evaluateLineTicks = function() { for (var j = 0; j < axis.ticks.length; j++) { tick = axis.ticks[j]; label = tick.label; - pos = this.dygraph_.toPercentYCoord(tick.v, i); + has_tick = !('label_v' in tick); + v = has_tick ? tick.v : tick.label_v; + pos = this.dygraph_.toPercentYCoord(v, i); if ((pos > 0.0) && (pos <= 1.0)) { - this.yticks.push([i, pos, label]); + this.yticks.push({axis: i, pos, label, has_tick}); } } }