Skip to content

Commit 8cb0e82

Browse files
author
Austin Martin
committed
fixing code to include both end points in n samples for better symmetry and span
1 parent d502dfb commit 8cb0e82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/traces/violin/calc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function calc(gd, trace) {
3939
// step that well covers the bandwidth and is multiple of span distance
4040
var dist = span[1] - span[0];
4141
var n = Math.ceil(dist / (bandwidth / 3));
42-
var step = dist / n;
42+
var step = (n > 1) ? dist / (n - 1) : 0;
4343

4444
if(!isFinite(step) || !isFinite(n)) {
4545
Lib.error('Something went wrong with computing the violin span');

0 commit comments

Comments
 (0)