Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Legend Align Labels like table format

Open at-webdev opened this issue 5 years ago • 3 comments

Hello All,
I am trying align legend labels in table format like Red and Green box to start at same line, Yellow and Blue boxes to start at same line, Here's what it looks like when browser is resized, Screen Shot 2021-02-12 at 5 45 51 PM

Fiddle Link: https://jsfiddle.net/9u62nkb0/2/ I went through available legend styling options, but couldn't figure it out. Is it possible to apply css styles directly on the label ? or is there any legend configuration to fix the same. Any leads are appreciated.

at-webdev avatar Feb 12 '21 23:02 at-webdev

Does the start alignment in v3 meet your needs? It's the red chart on https://www.chartjs.org/samples/master/legend/title.html

etimberg avatar Feb 13 '21 00:02 etimberg

@etimberg,In my case aligning it to start only fixes the first column, is it possible to make the yellow and blue legend labels to start at the same line on smaller browser size. with align: 'start' as below, image

at-webdev avatar Feb 13 '21 22:02 at-webdev

Unfortunately there's no way to align the items in columns. The best solution I can offer is to create your own legend plugin that positions differently, or make a legend out of HTML

etimberg avatar Feb 13 '21 23:02 etimberg