Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
add rotation during panning
Browse files Browse the repository at this point in the history
  • Loading branch information
Sugan G authored and Sugan G committed Mar 29, 2024
1 parent 2635971 commit afecbda
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/carbon-graphs/src/js/helpers/axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,24 @@ const translateAxes = (axis, scale, config, canvasSVG) => {
config,
)})`,
)
.call(axis.x);
.call(axis.x)
.selectAll('text')
.style('text-anchor', () => {
if (!utils.isDefined(config.axis.x.ticks.tickLabelsRotation)) {
config.axis.x.ticks.tickLabelsRotation = 0;
return 'middle';
}
const rotation = config.axis.x.ticks.tickLabelsRotation;
if (rotation === 0) {
return 'middle';
} if (rotation !== 0) {
return 'end';
} if (!utils.validTickLabelRotations.has(rotation)) {
return 'middle';
}
return 'middle';
})
.attr('transform', () => `rotate(${config.axis.x.ticks.tickLabelsRotation})`);
canvasSVG
.select(`.${styles.axisY}`)
.transition()
Expand Down

0 comments on commit afecbda

Please sign in to comment.