I am using a very nice gem to create charts using Ruby on Rails. But I am struggling to make a line chart with straight lines connecting the dots. It always creates curves. I need straight lines. Also I want to know if someone knows how to remove the dots from the line. I could not find a way to do it.
Chartkick.options = {
height: "300px",
min: -5,
max: 10,
discrete: true,
}
<% series_a = {"10" => -5, "11" => 9,"12" => 3,"13" => -1,"14" => 4,"15" => -2,"16" => -4} %>
<%= line_chart [{name: "Series A", data: series_a}] %>
So, you need to use 'library'. That lets you describe any preferences you have from Google charts, or from highcharts.
So you'll probably want to do something like the following:
<%= line_chart [{name: "Series A", data: series_a}], library: {curveType: "none", pointSize: 0} %>
Two things about the above line. Firstly, I do not normally use ruby-on-rails, so syntax may be off. Secondly, if you are using highcharts, it probably won't be {curveType: "none", pointSize:0}
that is GoogleChart specific. For highcharts, you will have to lookup the highchart options, and look for something similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With