Create beautiful JavaScript charts with one line of Ruby
open sourceMITself-hostablefree
Chartkick draws line, pie, column, bar, area and scatter charts, plus geo charts and timelines, from one helper call such as line_chart User.group_by_day(:created_at).count. It renders with Chart.js by default, or Google Charts or Highcharts, and takes data as a hash, an array or a URL that returns JSON, so a slow chart can load from its own endpoint after the page. Andrew Kane (ankane) makes the Ruby gem along with Chartkick.js on npm, React and Vue components, and Chartkick.py for Django and Flask. It pairs with his Groupdate gem for grouping records by day, week or hour.
Problems it solves
- add a chart of signups per day to my Rails admin page without learning a charting library
- turn an ActiveRecord group-by count into a line chart in one line of view code
- I keep fighting Chart.js config just to draw a simple bar chart
- show a pie chart of orders by status on an internal dashboard
- charts that load their data from a separate endpoint so the page doesn't time out
- draw a map shaded by country from a hash of counts
- let users download a chart as an image without any server code
- format chart axes as currency or percentages without writing JavaScript callbacks
- refresh a chart from its data URL every minute on a live dashboard
- switch from Chart.js to Highcharts or Google Charts without rewriting my views
- quick charts in a Django or Flask template from a dictionary of values
- the same simple chart components in React or Vue as in my Rails views
- plot a timeline of date ranges, like who held a role when
Features
- line, pie, column, bar, area and scatter charts
- geo charts and timelines with Google Charts
- Chart.js, Google Charts or Highcharts as the renderer, and several on one page
- data as a hash, an array or a URL returning JSON
- multiple series, stacked and grouped
- number formatting: prefix, suffix, thousands and decimal separators, rounding, byte sizes
- download charts as images in the browser (Chart.js)
- refresh a chart's data on an interval
- global options and a JavaScript API for each chart
- Importmap, Bun, esbuild, rollup.js, Webpack and Sprockets setups
View 2 more
- guide for Content Security Policy
- works with Sinatra and Padrino as well as Rails
Capabilities
| Has an API | plan not known |
|---|
