Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails + Chartkick: How to change the date format of the tooltip?

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.

like image 463
user984621 Avatar asked Jan 04 '15 23:01

user984621


1 Answers

This works for the x axis:

<%= line_chart @model.group(:created_at).count, library: { hAxis: { format: 'MM/dd' } } %>
like image 110
Chris Jones Avatar answered Nov 15 '22 01:11

Chris Jones