Skip to content

Commit

Permalink
Allow continues scales be partially out of domain
Browse files Browse the repository at this point in the history
  • Loading branch information
vladminsky committed Jan 16, 2016
1 parent f02e4fc commit 8498805
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/dev-quick-test/ex-048.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ window.samples.push({
,
{
dim: 'y1',
val: [50, 75],
val: [-50, 55],
text: '100 points',
position: 'front',
color: '#FFAB00'
Expand Down
9 changes: 8 additions & 1 deletion plugins/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@
var to = metaInfo.to;

var primaryScaleInfo = chart.getScaleInfo(metaInfo.primaryScale);
var isOutOfDomain = (!primaryScaleInfo.isInDomain(from) || !primaryScaleInfo.isInDomain(to));

var isX0OutOfDomain = !primaryScaleInfo.isInDomain(from);
var isX1OutOfDomain = !primaryScaleInfo.isInDomain(to);

var isOutOfDomain = (primaryScaleInfo.discrete ?
(isX0OutOfDomain || isX1OutOfDomain) :
(isX0OutOfDomain && isX1OutOfDomain)
);

if (isOutOfDomain) {
console.log('Annotation is out of domain');
Expand Down

0 comments on commit 8498805

Please sign in to comment.