From 2c62af4d9bd1c46444ca78d8c83d25d23d88affd Mon Sep 17 00:00:00 2001 From: rajataggarwal91 Date: Tue, 23 Jun 2015 16:29:53 -0700 Subject: [PATCH 1/2] Vertical slider axis inversion When orientation of slider was set to vertical, the minimum of axes started from top instead of bottom. Even then the values did not match the labels. The change is just an inversion of range. This has not been thoroughly tested, but it works fine for my application --- d3.slider.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/d3.slider.js b/d3.slider.js index d9e3c58..76f4d5f 100755 --- a/d3.slider.js +++ b/d3.slider.js @@ -135,6 +135,7 @@ return function module() { } else { handle1.style("bottom", formatPercent(scale(value))); + console.log("hello: "+scale(value)); drag.on("drag", onDragVertical); } @@ -160,7 +161,10 @@ return function module() { } // Copy slider scale to move from percentages to pixels - axisScale = scale.ticks ? scale.copy().range([0, sliderLength]) : scale.copy().rangePoints([0, sliderLength], 0.5); + if(orientation == "horizontal") + axisScale = scale.ticks ? scale.copy().range([0,sliderLength]) : scale.copy().rangePoints([0,sliderLength], 0.5); + else + axisScale = scale.ticks ? scale.copy().range([sliderLength, 0]) : scale.copy().rangePoints([sliderLength, 0], 0.5); axis.scale(axisScale); // Create SVG axis container From b2d84912704cbbbd82165f142a7b5c6a786dc98f Mon Sep 17 00:00:00 2001 From: rajataggarwal91 Date: Tue, 23 Jun 2015 16:31:04 -0700 Subject: [PATCH 2/2] Removed console.log Removed console.log in previous change --- d3.slider.js | 1 - 1 file changed, 1 deletion(-) diff --git a/d3.slider.js b/d3.slider.js index 76f4d5f..4fab4aa 100755 --- a/d3.slider.js +++ b/d3.slider.js @@ -135,7 +135,6 @@ return function module() { } else { handle1.style("bottom", formatPercent(scale(value))); - console.log("hello: "+scale(value)); drag.on("drag", onDragVertical); }