6

Does Chartkick allow users to label the x/y axies?

     Sample Code:
     <%= line_chart Product.group("purchased").maximum(:price) %>
Chris Lewis
  • 1,315
  • 10
  • 25
elyrly
  • 61
  • 1
  • 7

1 Answers1

15

Yes, with Google Charts, use:

<%= line_chart Product.group("purchased").maximum(:price), {library: {hAxis: {title: "X"}, vAxis: {title: "Y"}}} %>

Andrew Kane
  • 3,200
  • 19
  • 40
  • 1
    On a similar note, how do you set the height and width of the chart? – reectrix Feb 20 '14 at 16:31
  • 1
    <%= line_chart Product.group("purchased").maximum(:price), {height: "400px", library: {hAxis: {title: "X"}, vAxis: {title: "Y"}}} %> is how you include the height... – Chris Lewis Mar 06 '14 at 22:36