Skip to content

Commit

Permalink
Ensure value is valid. Fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwalley committed May 5, 2018
1 parent 01f1b4e commit 5d60ea8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-simple-slider",
"version": "0.2.0",
"version": "0.2.1",
"description": "Renders an SVG slider",
"keywords": ["d3", "d3-module", "slider", "visualization"],
"homepage": "https://github.com/johnwalley/d3-simple-slider",
Expand Down
6 changes: 6 additions & 0 deletions src/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ function slider() {
.domain(scale.range())
.clamp(true);

// Ensure value is valid
value = scaleLinear()
.range(domain)
.domain(domain)
.clamp(true)(value);

tickFormat = tickFormat || scale.tickFormat();

var axis = selection.selectAll(".axis").data([null]);
Expand Down

0 comments on commit 5d60ea8

Please sign in to comment.