I can't seem to figure out how or if Chartkick supports table charts. I tried table_chart as if I were doing any other chart, but it didn't work. Anyone know if chartkick supports that? I couldn't find it in the documentation.
You can check kick chart for integration with rails
http://chartkick.com/
you can use like
for_line_chart
= line_chart Model.group_by_day(:created_at).count %>
pie_chart
= pie_chart Model.group(:field).count
column_chart
= column_chart Model.group_by_hour_of_day(:field).count
bar_chart
= bar_chart Model.group(:field).sum(:field)
area_chart
= area_chart Model.group_by_minute(:created_at).maximum(:field)
line_chart
= line_chart completed_tasks_charts_path
For more please consult the link shared above hopefully this will help you a lot.
There is no such thing as table chart in chartkick.
There are line, pie, column, area, bar, geo charts and timeline avaliable.
All kind of charts with usage explanations you can find on chartkick official website.
Related
I am working on a multiple series line chart in ruby on rails. I have passed to the chart data as such:
<%= line_chart #budget.transactions.group(:category).group(:date).sum(:amount) %>
In the developer tools I looked at the script that populates the chart and it looks like:
new Chartkick.LineChart("chart-2", [{"name":"debt","data":[["2017-04-19",5.43],["2017-04-20",60.0]]},
{"name":"entertainment","data":[["2017-04-19",30.0]]},
{"name":"food","data":[["2017-04-20",15.0],["2017-04-21",20.0]]},
{"name":"housing","data":[["2017-04-02",17.33],["2017-04-10",20.0],["2017-05-01",522.0]]},
{"name":"transportation","data":[["2017-04-20",50.0]]},
{"name":"utilities","data":[["2017-04-19",35.0],["2017-04-21",20.0],["2017-04-27",77.34]]}], {});
To me the format for the data being passed to the chart seems correct, but the output... not so much. Also I was thinking using the Ruby Date class, rather than DateTime was causing a problem but I'm not sure. Any help appreciated.
enter image description here
I am adding charts on my Rails application and I started using chartkick the variety of charts that it offers are not quite what I would like.
I found in their documentation that you can use the Highcharts library. The issue is, I followed the steps but nothing happens...
Does anyone know the correct way to use these two together?
Here is the code I write: <%= column_chart #prsd_data, xtitle: "Members", ytitle: " # of publications", width: "100%", height: "100%" %>
#prsd_data is a hash that contains as keys the names of some people and as values an array of 2 integers.s
NOTE: The chart I want to generate is something like this one : Highcharts
Try this,
Add this gem "chartkick" to your gemfile
Add this <%= javascript_include_tag "https://www.google.com/jsapi" %> to your application.html.erb.
and you are good to go for any chartkick graph.
I have been playing around with the chartkick gem using highcharts.js and was wondering if anyone had been able to get drilldowns to work. If so what options did you pass in to get it to work?
I think you are looking for something like this
http://www.highcharts.com/demo/column-drilldown
Hope it helps you .
Please can anyone help me with this issue?
I have A ruby on rails app and I am trying to use ChartKick.
I have the following code in my Controller to get all Publications:
#mentor_pub = Publication.all.where(user: current_user).order("mentor ASC")
And I am using the code below in my views.
<%= column_chart #mentor_pub.group(:mentor).count, height: "600px", discrete: true%>
You can see the image of what I am talking about here
the chart is displaying the way I want it, but The Yaxis is displaying decimal numbers instead of integers.
Please How would I modify the Yaxis to show integers?
Chartkick uses Google Visualization under the hood and allows you to pass options directly to the library using the library option like so:
<%= line_chart data, library: {backgroundColor: "#eee"} %>
for your exact problem you'll have to look into Googles documentation or this stackoverflow answer https://stackoverflow.com/a/16036721/390977 might help.
I have the following issue. I have a google map (using YM4r + Geokit) within Ruby on Rails, anyhow, i basically have an array of markers which are populated in the following manner
#shops.each do
|sto|
markers << GMarker.new (....)
end
They are definitely being stored fine as under 10 markers they are displayed just fine. The problem arises when there are more than 10 markers on the same page,
Further code related to displaying if this may help:
#map.overlay_global_init(GMarkerGroup.new(true, markers), "sto_markers")
in the html.erb file:
<%= GMap.header %>
<%= javascript_include_tag("markerGroup") %>
<%= #map.to_html%>
<%= #map.div(:width => 700, :height => 500)%>
Only 10 markers are displayed on screen instead of the correct amount in the markers array.
Has anyone ever encountered this issue please? i'm really at a loss on how to overcome this please
Hmm, I have never used these plugins (I prefer to work directly with the API, much easier :)), so this is just random thinking.
Have you looked in the source of the rendered HTML? In there you should have a Javascript Object or Array with all your markers defined. If all of them do show up there, then it is easier to pinpoint if the problem is on the Javascript or the Rails side. (That is what <%= #map.to_html%> should do unless I'm completely off).
Update:
After some looking into the plugin, I can't really tell what the error can be, however since it do put out everything in clear Javascript in the file, it would probably help a lot if you can post the rendered HTML source. I believe that you will find the solution by looking there.