chartkick: library options hash does not work !!
It’s imperative that I use chartkick in my web app; however, there’s one issue stopping me from using it: I’m not able to change the background color or use any library options within the ‘library’ hash when creating the chart. I’ve tested charting libraries Chart.js and Highcharts.js, and the results are the same. Whatever library options I pass, none of them work. Am I doing something wrong? Here’s an example of my chart:
<%= line_chart User.group(:created_at).count, library: {backgroundColor: "#555"} %>
I’m using Chartkick 2.0. Is anyone else having this issue?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (3 by maintainers)
Can someone create a JS Fiddle to reproduce? With Highcharts, you need to use:
http://api.highcharts.com/highcharts#chart.backgroundColor
Chart.js doesn’t have an option for background color, but you use CSS to set it.
update, found the solution. but ruby can’t instantiate javascript object from ruby object. is there any solution for this?
For those coming on across this closed issue… The following worked for me (from a haml file):
NOTE: pointRadius, not pointSize!
And
lineTension: 0
did indeed create straight-line, point-to-point line.