Skip to content

Commit

Permalink
Merge pull request #1054 from ioam/widget_precision
Browse files Browse the repository at this point in the history
Fixed python widget key precision to match JS
  • Loading branch information
jlstevens committed Jan 16, 2017
2 parents a026702 + d42e139 commit 890d09d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion holoviews/plotting/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def escape_vals(vals, escape_numerics=True):
unicode for safety.
"""
# Ints formatted as floats to disambiguate with counter mode
ints, floats = "%.1f", "%.11f"
ints, floats = "%.1f", "%.10f"

escaped = []
for v in vals:
Expand Down
5 changes: 2 additions & 3 deletions holoviews/plotting/widgets/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ SelectionWidget.prototype.get_key = function(current_vals) {
{
val = this.current_vals[i];
if (!(typeof val === 'string')) {
if (val % 1 === 0) { var fixed = 1;}
else { var fixed = 10;}
val = val.toFixed(fixed)
if (val % 1 === 0) { val = val.toFixed(1); }
else { val = val.toFixed(10); val = val.slice(0, val.length-1);}
}
key += "'" + val + "'";
if(i != this.slider_ids.length-1) { key += ', ';}
Expand Down

0 comments on commit 890d09d

Please sign in to comment.