Skip to content

Commit

Permalink
refactor: limit top/bottom axis tick rotation to top/bottom zoom bar …
Browse files Browse the repository at this point in the history
…only
  • Loading branch information
hlyang397 committed Sep 2, 2020
1 parent f2489e7 commit bc124bb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/core/src/components/axes/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,20 @@ export class Axis extends Component {
axisPosition === AxisPositions.TOP
) {
let shouldRotateTicks = false;
const isTopOrBottomZoomBarEnabled =
Tools.getProperty(
this.model.getOptions(),
"zoomBar",
"top",
"enabled"
) ||
Tools.getProperty(
this.model.getOptions(),
"zoomBar",
"bottom",
"enabled"
);

// user could decide if tick rotation is required during zoom domain changing
const rotateWhileZooming = Tools.getProperty(
axisOptions,
Expand All @@ -450,20 +464,23 @@ export class Axis extends Component {

if (
this.zoomDomainChanging &&
isTopOrBottomZoomBarEnabled &&
(!rotateWhileZooming ||
rotateWhileZooming === TickRotations.ALWAYS)
) {
// if zoomDomain is changing and options is set to ALWAYS or not set
shouldRotateTicks = true;
} else if (
this.zoomDomainChanging &&
isTopOrBottomZoomBarEnabled &&
rotateWhileZooming === TickRotations.NEVER
) {
// if zoomDomain is changing and options is set to NEVER
shouldRotateTicks = false;
} else if (
!this.zoomDomainChanging ||
(this.zoomDomainChanging &&
isTopOrBottomZoomBarEnabled &&
rotateWhileZooming === TickRotations.AUTO)
) {
// if zoomDomain is NOT changing or
Expand Down

0 comments on commit bc124bb

Please sign in to comment.