diff --git a/g.line.js b/g.line.js index 308c046..1e0bd6e 100644 --- a/g.line.js +++ b/g.line.js @@ -101,16 +101,16 @@ } } - var allx = Array.prototype.concat.apply([], valuesx), - ally = Array.prototype.concat.apply([], valuesy), - xdim = chartinst.snapEnds(Math.min.apply(Math, allx), Math.max.apply(Math, allx), valuesx[0].length - 1), - minx = xdim.from, - maxx = xdim.to, - ydim = chartinst.snapEnds(Math.min.apply(Math, ally), Math.max.apply(Math, ally), valuesy[0].length - 1), - miny = ydim.from, - maxy = ydim.to, - kx = (width - gutter * 2) / ((maxx - minx) || 1), - ky = (height - gutter * 2) / ((maxy - miny) || 1); + var allx = Array.prototype.concat.apply([], valuesx); + var ally = Array.prototype.concat.apply([], valuesy); + var xdim = chartinst.snapEnds(Math.min.apply(Math, allx), Math.max.apply(Math, allx), valuesx[0].length - 1); + var minx = Math.min.apply(Math, allx);//xdim.from; + var maxx = Math.max.apply(Math, allx);//xdim.to; + var ydim = chartinst.snapEnds(Math.min.apply(Math, ally), Math.max.apply(Math, ally), valuesy[0].length - 1); + var miny = Math.min.apply(Math, ally);//ydim.from; + var maxy = Math.max.apply(Math, ally);//ydim.to; + var kx = (width - gutter * 2) / ((maxx - minx) || 1); + var ky = (height - gutter * 2) / ((maxy - miny) || 1); var axis = paper.set(); diff --git a/test/linechart.html b/test/linechart.html index e2967ed..08d908c 100644 --- a/test/linechart.html +++ b/test/linechart.html @@ -40,7 +40,7 @@ r.linechart(330, 10, 300, 220, x, [y.slice(0, 1e4), y2.slice(0, 1e4), y3.slice(0, 1e4)], { shade: true }); r.linechart(10, 250, 300, 220, x, [y, y2, y3], { nostroke: true, shade: true }); - var lines = r.linechart(330, 250, 300, 220, [[1, 2, 3, 4, 5, 6, 7],[3.5, 4.5, 5.5, 6.5, 7, 8]], [[12, 32, 23, 15, 17, 27, 22], [10, 20, 30, 25, 15, 28]], { nostroke: false, axis: "0 0 1 1", symbol: "circle", smooth: true }).hoverColumn(function () { + var lines = r.linechart(330, 250, 300, 220, [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[3.5, 4.5, 5.5, 6.5, 7, 8]], [[12, 32, 23, 15, 17, 27, 22, 28, 17, 29], [10, 20, 30, 25, 15, 28]], { nostroke: false, axis: "0 0 1 1", symbol: "circle", smooth: true }).hoverColumn(function () { this.tags = r.set(); for (var i = 0, ii = this.y.length; i < ii; i++) {