7

I am generating the chart (with using Google Chart) this way:

  <%=
    area_chart [{:name => "Sold items", data: @items.group(:created_at).count}], :library => {hAxis: {title: "Period"}, vAxis: {title: "Amounts in UDS"}, title: "History Of Sales"}  
  %>

And the chart is nicely generated, but there's one thing that I am trying to change - the tooltip looks like this: enter image description here

Information in the tooltip are correct, but instead of displaying Oct 19, 2014, 2:00:00 AM I would love to display only Oct 19, 2014.

Is there any way to do it with Chartkick?

Thank you very much for your time.

user984621
  • 46,344
  • 73
  • 224
  • 412

2 Answers2

2

This works for the x axis:

<%= line_chart @model.group(:created_at).count, library: { hAxis: { format: 'MM/dd' } } %>
0

You can just use the ruby to change the datetime key into require formats. Example:

@items.group("created_at").count.map {|k,v| {k.strftime("%b %d, %Y") => v }}