ankane / chartkick

Create beautiful JavaScript charts with one line of Ruby
https://chartkick.com
MIT License
6.33k stars 565 forks source link

Hide one or more legend labels (but not all) #581

Closed fakeharxy closed 2 years ago

fakeharxy commented 2 years ago

Hello, I have searched existing issues and I believe this is unique...

Is there a way to not show a legend for some line chart data but not others? I see there is quite a complicated way in native chart.js, but it involves a JS callback in the invocation of the graph which I'm not sure is possible via Ruby.

Is this possible? Many thanks

ankane commented 2 years ago

Hey @fakeharxy, Chartkick doesn't have an option for it, so you'll need to use the approach from the underlying charting library. There's not a way to pass JS callbacks from Ruby, so you'd need to use the JavaScript API/Chartkick.js directly.

fakeharxy commented 2 years ago

Thanks for looking into it. 👍