ankane / chartkick

Create beautiful JavaScript charts with one line of Ruby

Home Page:https://chartkick.com

Repository from Github https://github.comankane/chartkickRepository from Github https://github.comankane/chartkick

More formatting options on chart legends

elarue53078 opened this issue · comments

In discussing chartkick implementations, our team noticed certain ways we'd like to format the legend that we seem to be unable to do:

  1. The legend seems to put all the legend objects on one line; we would like the option to put each element on its own line.
  2. In connection with the above, we would like to left-align the legend elements. Currently only the default center alignment appears to be available.
  3. The color keys are currently rectangles. We would like to change this to squares.

Hey @elarue53078, you can use library option to make make customizations that the underlying charting library supports.

@ankane I am using the options like this:

library: { legend: { display: false, position: 'bottom', labels: { usePointStyle: true, boxWidth: 6 } } }

Also tried:

library: { options: { plugins: { legend: { display: true, position: 'bottom', labels: { usePointStyle: true, boxWidth: 6 } } } } }

Also tried:

library: { options: { legend: { display: true, position: 'bottom', labels: { usePointStyle: true, boxWidth: 6 } } } }

None worked. I am using Chart.js and it has the options I provided above.

Am I doing something wrong?

This is also not working for me