Skip to content

Commit

Permalink
add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mhkeller committed Nov 24, 2020
1 parent b42ba66 commit 1443c6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/utils/padScale.js
Expand Up @@ -22,6 +22,13 @@ export default function padScale (scale, padding) {
return scale.domain();
}

if (scale.domain().length !== 2) {
console.warn('[LayerCake] The scale is expected to have a domain of length 2 to use padding. Are you sure you want to use padding? Your scale\'s domain is:', scale.domain());
}
if (scale.range().length !== 2) {
console.warn('[LayerCake] The scale is expected to have a range of length 2 to use padding. Are you sure you want to use padding? Your scale\'s range is:', scale.range());
}

const { lift, ground } = getPadFunctions(scale);

const d0 = scale.domain()[0];
Expand Down

0 comments on commit 1443c6d

Please sign in to comment.