Skip to content

Commit

Permalink
Ugh; another small fix to formatAxis()
Browse files Browse the repository at this point in the history
  • Loading branch information
kbroman committed Jan 7, 2022
1 parent f6d1c7b commit 6a7d23f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 3 additions & 5 deletions d3panels.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!function() { // encapsulate d3panels functions
var d3panels = {
version: "1.8.3"
version: "1.8.4"
};
"use strict";

Expand Down Expand Up @@ -29,10 +29,8 @@ d3panels.formatAxis = function (d) {

d.sort();

if (d.length === 0) {
gap = 0;
} else if (d.length === 1) {
gap = d[0];
if (d.length <= 1) {
gap = 1;
} else {
// take differences
d = function () {
Expand Down
2 changes: 1 addition & 1 deletion d3panels.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3panels",
"version": "1.8.3",
"version": "1.8.4",
"description": "D3-based graphics panels",
"author": "Karl Broman <[email protected]> (https://kbroman.org)",
"repository": "github:kbroman/d3panels",
Expand Down
2 changes: 1 addition & 1 deletion src/d3panels_top.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!function() { // encapsulate d3panels functions
var d3panels = {
version: "1.8.3"
version: "1.8.4"
};
6 changes: 2 additions & 4 deletions src/panelutil.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ d3panels.formatAxis = (d, extra_digits=0) ->
## remove nulls and sort
d = (x for x in d when x?)
d.sort()
if d.length == 0
gap = 0
else if d.length == 1
gap = d[0]
if d.length <= 1
gap = 1
else
# take differences
d = (d[i]-d[i-1] for i in [1..(d.length-1)])
Expand Down

0 comments on commit 6a7d23f

Please sign in to comment.