Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#11637 x label text direction #11761

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ export default class Scale extends Element {
const ctx = this.ctx;

const area = this._computeLabelArea();
if (area) {
if (area && this.labelRotation <= 90) {
clipArea(ctx, area);
}

Expand All @@ -1578,7 +1578,7 @@ export default class Scale extends Element {
renderText(ctx, label, 0, y, tickFont, renderTextOptions);
}

if (area) {
if (area && this.labelRotation <= 90) {
unclipArea(ctx);
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/helpers.canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ export function renderText(

ctx.save();
ctx.font = font.string;

if (opts.rotation < -1 * (Math.PI / 2) && opts.rotation > -1 * Math.PI) {
opts.rotation = opts.rotation - Math.PI;
}

setRenderOpts(ctx, opts);

for (i = 0; i < lines.length; ++i) {
Expand Down
Loading