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

Customize legend box height #2051

Closed
timcui opened this issue Feb 24, 2016 · 39 comments · Fixed by #7459
Closed

Customize legend box height #2051

timcui opened this issue Feb 24, 2016 · 39 comments · Fixed by #7459

Comments

@timcui
Copy link

timcui commented Feb 24, 2016

as the code below, the legend box height is binded to the label fontSize, can i customize the legend box height independent of the label fontSize, like the boxWidth ?

`
// Draw the box

ctx.strokeRect(cursor.x, cursor.y, this.options.labels.boxWidth, this.options.labels.fontSize);
ctx.fillRect(cursor.x, cursor.y, this.options.labels.boxWidth, this.options.labels.fontSize);
`

@etimberg etimberg added this to the Version 2.0.1 milestone Feb 24, 2016
@etimberg
Copy link
Member

@timcui this is currently not possible. We can add it as an enhancement

@timcui
Copy link
Author

timcui commented Feb 24, 2016

thanks for support

@Ryan-Haines
Copy link

Another user here that would really appreciate this feature!

@dt1973
Copy link

dt1973 commented Nov 10, 2017

Any news on this? I can set boxWidth but not boxHeight?

  legend: {
    display: true,
    position: "right",
    labels: {
      fontFamily: "Comic Sans MS",
      boxWidth: 20,
      boxHeight: 2
    }
  }

@Ryan-Haines
Copy link

That's correct @dt1973 only boxWidth is supported

@dt1973
Copy link

dt1973 commented Nov 11, 2017

Hi @Ryan-Haines! That is unfortunate as most professional legend boxes these days seem to have really short heights. Looks a lot better imho!

@unoriginalscreenname
Copy link

Agree, this is actually a request from our design team as well. customizing this would be very helpful.

@simonbrunel
Copy link
Member

Implemented in #4890 (still need unit tests)

@DidierLmn
Copy link

+1 for this feature (#4890 was unfortunately closed before merging)

@rjurado01
Copy link

+1

@Ekliptor
Copy link

Ekliptor commented Feb 4, 2018

+1

8 similar comments
@JuOliveira93
Copy link

+1

@LucaLovagnini
Copy link

+1

@tarungarg546
Copy link

+1

@sagarseth9
Copy link

+1

@xesjkeee
Copy link

xesjkeee commented Jun 6, 2018

+1

@SangRyul
Copy link

SangRyul commented Jun 7, 2018

+1

@Saracevas
Copy link

+1

@josezulu
Copy link

+1

@dt1973
Copy link

dt1973 commented Jul 21, 2018

@simonbrunel hello! Any idea when we're likely to see this feature? Many thanks!

@jadurani
Copy link

jadurani commented Jul 23, 2018

Solution pending in #4811

@dt1973
Copy link

dt1973 commented Jul 23, 2018

#4811 looks to be almost finished through right?

@tomasdev
Copy link

@touletan are you alive? Your PR from 2018 didn't go through. Wondering if there are any alternatives?

@Mos-6
Copy link

Mos-6 commented Jan 15, 2020

This feature is really needed.

@tsturtz
Copy link

tsturtz commented Feb 24, 2020

+1

1 similar comment
@boakenfull
Copy link

+1

@joyceyuqiliu
Copy link

+1!

@PowerserveSean
Copy link

+1

@MatthieuAL
Copy link

Would be great indeed

@kimbuz
Copy link

kimbuz commented May 17, 2020

Would be great to have.

@MehdiMamas
Copy link

+1

@eloisebarrow
Copy link

Is this not available in the live editor? I tried adding version: 3.0 to my chart but boxHeight still isn't working.

@ioprea
Copy link

ioprea commented Jan 14, 2021

This still does not work, why is it closed? Has is been resolved?

@kurkle
Copy link
Member

kurkle commented Jan 14, 2021

This still does not work, why is it closed? Has is been resolved?

Yes, its been resolved. Its closed because its resolved. There is a test to ensure its working. You need to use v3 beta to have it.

@MatthieuAL
Copy link

MatthieuAL commented Jan 14, 2021 via email

@vincentwinkel
Copy link

Also waiting for it

@anthonychen118
Copy link

seems like it is still not in 3.5.1 yet...super wanted!

@Fr34k9
Copy link

Fr34k9 commented Sep 9, 2021

Also looking for it. 4 years ago posted, still not in. Also it would be great if we could define the style if a legend item is "hidden". The strikethrough is not perfect for everyone.

@Mhytos
Copy link

Mhytos commented Apr 17, 2024

As of 2023 its possible to define the width and height for the legend box, see https://www.chartjs.org/docs/latest/configuration/legend.html

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.