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

[BUG]: pointLabels overlap tick labels for radar chart with large font size #5280

Closed
adrianhelvik opened this issue Feb 19, 2018 · 7 comments · Fixed by #5914
Closed

[BUG]: pointLabels overlap tick labels for radar chart with large font size #5280

adrianhelvik opened this issue Feb 19, 2018 · 7 comments · Fixed by #5914
Milestone

Comments

@adrianhelvik
Copy link

This is both a bug and a feature request.

Expected Behavior

It should be possible to provent the ticks and pointLabels from colliding. A way to do this without breaking backwards compatibility would be to set padding at options.scale.pointLabels.padding.

Current Behavior

The pointLabels and tick labels collide.

Possible Solution

Add padding when calling measureLabelSize in scales/scale.radialLinear.js?

Steps to Reproduce (for bugs)

https://codepen.io/adrianhelvik/pen/BYYGzO?#

Context

I want to create a radar chart that conforms to the design I've been given and that is not possible. Tweaking another option would be a good alternative for my use case.

Environment

@adrianhelvik adrianhelvik changed the title [BUG]: pointLabels overlap tick labels for radar chart with large font size [FEATURE]: pointLabels overlap tick labels for radar chart with large font size Feb 19, 2018
@adrianhelvik adrianhelvik changed the title [FEATURE]: pointLabels overlap tick labels for radar chart with large font size [BUG]: pointLabels overlap tick labels for radar chart with large font size Feb 19, 2018
@tfwww
Copy link
Contributor

tfwww commented Feb 21, 2018

Does anyone pick it up? If no, maybe I can handle it.

@etimberg
Copy link
Member

@wmzhong what are you thinking of as a solution to this problem?

@tfwww
Copy link
Contributor

tfwww commented Feb 22, 2018

@etimberg On the below function:

function measureLabelSize(ctx, fontSize, label) {
    if (helpers.isArray(label)) {
        return {
            w: helpers.longestText(ctx, ctx.font, label),
            h: (label.length * fontSize) + ((label.length - 1) * 1.5 * fontSize)
        };
    }
    return {
        w: ctx.measureText(label).width,
        h: fontSize + 10
    };
}

Maybe we can return the 'h' with bigger value. But I'm not sure how big to add it.

@etimberg
Copy link
Member

@wmzhong sounds good. I would make a configuration option for that value rather than a hardcoded number. The default would be 0 (existing behaviour) but it makes it easy to configure on a per chart basis

@tfwww
Copy link
Contributor

tfwww commented Feb 23, 2018

@etimberg It's better to make a configuration option. That's good.

@HCodemesh
Copy link

any solution to this?

@adrianhelvik
Copy link
Author

Sweet! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants