Skip to content

Commit 086282c

Browse files
committed
fix hasValidMinAndMax for autorangeoptions allowed attrs
1 parent 04b8efa commit 086282c

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/plots/cartesian/autorange.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -636,40 +636,44 @@ function lessOrEqual(v0, v1) { return v0 <= v1; }
636636
function greaterOrEqual(v0, v1) { return v0 >= v1; }
637637

638638
function applyAutorangeMinOptions(v, ax) {
639+
var autorangeoptions = ax.autorangeoptions;
639640
if(
640-
ax.autorangeoptions &&
641-
ax.autorangeoptions.minallowed !== undefined &&
642-
hasValidMinAndMax(ax, ax.autorangeoptions.minallowed, ax.autorangeoptions.maxallowed)
641+
autorangeoptions &&
642+
autorangeoptions.minallowed !== undefined &&
643+
hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)
643644
) {
644-
return ax.autorangeoptions.minallowed;
645+
return autorangeoptions.minallowed;
645646
}
646647

647648
if(
648-
ax.autorangeoptions &&
649-
ax.autorangeoptions.clipmin !== undefined &&
650-
hasValidMinAndMax(ax, ax.autorangeoptions.clipmin, ax.autorangeoptions.clipmax)
649+
autorangeoptions &&
650+
autorangeoptions.clipmin !== undefined &&
651+
hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)
651652
) {
652-
return Math.max(v, ax.d2l(ax.autorangeoptions.clipmin));
653+
return Math.max(v, ax.d2l(autorangeoptions.clipmin));
653654
}
654655
return v;
655656
}
656657

657658
function applyAutorangeMaxOptions(v, ax) {
659+
var autorangeoptions = ax.autorangeoptions;
660+
658661
if(
659-
ax.autorangeoptions &&
660-
ax.autorangeoptions.maxallowed !== undefined &&
661-
hasValidMinAndMax(ax, ax.autorangeoptions.minallowed, ax.autorangeoptions.maxallowed)
662+
autorangeoptions &&
663+
autorangeoptions.maxallowed !== undefined &&
664+
hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)
662665
) {
663-
return ax.autorangeoptions.maxallowed;
666+
return autorangeoptions.maxallowed;
664667
}
665668

666669
if(
667-
ax.autorangeoptions &&
668-
ax.autorangeoptions.clipmax !== undefined &&
669-
hasValidMinAndMax(ax, ax.autorangeoptions.clipmin, ax.autorangeoptions.clipmax)
670+
autorangeoptions &&
671+
autorangeoptions.clipmax !== undefined &&
672+
hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)
670673
) {
671-
return Math.min(v, ax.d2l(ax.autorangeoptions.clipmax));
674+
return Math.min(v, ax.d2l(autorangeoptions.clipmax));
672675
}
676+
673677
return v;
674678
}
675679

@@ -679,8 +683,8 @@ function hasValidMinAndMax(ax, min, max) {
679683
min !== undefined &&
680684
max !== undefined
681685
) {
682-
min = ax.d2l(ax.autorangeoptions.clipmin);
683-
max = ax.d2l(ax.autorangeoptions.clipmax);
686+
min = ax.d2l(min);
687+
max = ax.d2l(max);
684688
return min < max;
685689
}
686690
return true;

0 commit comments

Comments
 (0)