# google\_charts

Published articles for google\_charts.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Ruby, ChartKick and chart.js versus Google Charts and the Y Axis Auto Sizing

DevFeed: [Ruby, ChartKick and chart.js versus Google Charts and the Y Axis Auto Sizing](<https://devfeed.tech/articles/ruby-chartkick-and-chart-js-versus-google-charts-and-the-y-axis-auto-sizing-28304.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/ruby/2019/12/13/ruby-chartkick-and-chart-js-versus-google-charts-and-the-y-axis-auto-sizing.html>)

Author: Fuzzygroup

Published: 2019-12-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Library](<https://devfeed.tech/topics/library.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [chartjs](<https://devfeed.tech/tags/chartjs.md>), [chartkick](<https://devfeed.tech/tags/chartkick.md>), [charts](<https://devfeed.tech/tags/charts.md>), [code](<https://devfeed.tech/tags/code.md>), [google](<https://devfeed.tech/tags/google.md>), [google-charts](<https://devfeed.tech/tags/google-charts.md>), [graph](<https://devfeed.tech/tags/graph.md>), [graphs](<https://devfeed.tech/tags/graphs.md>), [js](<https://devfeed.tech/tags/js.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [yaxis](<https://devfeed.tech/tags/yaxis.md>)

### AI overview

This tutorial explains how to use the Ruby ChartKick library with chart.js or Google Charts. It also covers dynamically setting the y-axis minimum and adding chart colors.

### Source excerpt

Like a lot of people in the Open Source world, I rarely know actual people in the Open Source world - but I do know github usernames. And one of those names that I truly respect is ankane. I've rarely found a bit of code he wrote that I don't like or use. And while I'm not a big open source creator, I'd like to think that I give back by writing documentation like this blog post. Today I'm talking about the ChartKick library by ankane. ChartKick is an easy way to build JavaScript charts with a single line of Ruby. I've used ChartKick on and off for years but how it works has always been a bit of a mystery. Hopefully this blog post de-mystifies it a bit. ChartKick Can Use Different Graphing Engines I have always used ChartKick in the past just with the default Google Charts engine. Much to my surprise, ChartKick can use chart.js underneath. This is surprising to me and utterly awesome. Here's where I learned this. Using ChartKick with chart.js In application.js, you need both of these: //= require Chart.bundle //= require chartkick Note 1: This assumes that you aren't using yarn / webpacker. Note 2: If you change application.js, you need to restart your development server. Here's a picture of a graph using chart.js: Using ChartKick with Google Charts If you are using ChartKick with Google Charts then you need to remove the line below from application.js: //= require Chart.bundle and then you need to add, into your layout or your html template: <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %> Here's a picture of a graph using Google Charts: Y Axis Auto Sizing / Setting Axis Minimums Dynamically The Y axis on my graphs, for years, has always been zero. I had a friend complain about this to me and a documentation grovel (ok I read it more closely than I ever had before) revealed this: min defaults to 0 for charts with non-negative values. Use nil to let the charting library decide. Adding a Bit of Color to Your Graph I haven't used this in quite a