0

I am using chartkick to draw a line chart. This works fine except that labels on the x-axis are overlapping and unreadable. I want to change the orientation of these labels on the x-axis so that they are angled out at 45 degrees from the axis. Can anyone tell me how to do this?

<%= line_chart User.all.group_by_day(:created_at, last: 14, discrete: true).count %>
Adam Jones
  • 2,370
  • 5
  • 23
  • 40

1 Answers1

0

Okay, I didn't realise I was using google-visualisation and when I did it was relatively straight forward to find the answer:

<%= line_chart User.all.group_by_day(:created_at, last: 14, discrete: true).count, {library: { hAxis: {slantedText: true, slantedTextAngle: 45 } } } %>

For further options see here: Google Charts - Visualisation: Line Chart

Adam Jones
  • 2,370
  • 5
  • 23
  • 40