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

Legend not showing correctly #50

Closed
alc32 opened this issue Aug 24, 2018 · 1 comment
Closed

Legend not showing correctly #50

alc32 opened this issue Aug 24, 2018 · 1 comment

Comments

@alc32
Copy link

alc32 commented Aug 24, 2018

If the text is a bit long, it is shown above the options, and if window size is small, text is not displayed properly.
Codepen

Issue1

Issue2

@junedchhipa
Copy link
Contributor

HI Alejandro,

Thanks for reporting the issue.

The legends are drawn by SVG methods so not easily controlled with CSS. The toolbar is a collection of simple HTML elements and is customizable with the help of CSS.
So, we can move the toolbar up/down if it's getting in the way when we put the legends at the top. Or we can move the legends in options which I will show in the example below.

The reason - why I haven't set defaults for each of these options is that all users will have different requirements where to put the legends / where to put the toolbar, etc.
So, I leave up to the users to customize with simple tweaks (margin/offsets) - where they want to put these elements. That doesn't mean I haven't checked for possibilities that can go wrong when setting these tweaks. It's just that it is difficult to test all the possibilities of these placements.

To fight your issue of too lengthy legends,
I have tweaked the legend property to the following

legend: {
    show: true,
    position: "top",
    containerMargin: {
      top: 30
    }
  },

This will give enough space for the toolbar that floats in the top-right corner.

And - to fight your issue of "too long legends getting cropped in mobile", we can set the responsive options to set the smaller font size for legends in smaller devices.

responsive: [
    {
      breakpoint: 500,
      options: {
        legend: {
          fontSize: "11px"
        }
      }
    }
  ]

Here is the complete codepen example

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

No branches or pull requests

2 participants