Rails Charts Using ECharts from Apache

https://news.ycombinator.com/rss Hits: 13
Summary

Rails Charts One more gem to build nice charts for your Ruby on Rails application. With it you can build various types of charts Apache eCharts library (v. 5.4.0). This gem simplifies interface and adding few helpers to start adding charts in your app with just a few lines of code. What you can build with it: In most cases with one line of code you can have a nice chart. The idea of this gem was inspired by Chartkick gem which is great and allows you to build charts very quickly. It works best in cooperation with groupdate gem. Unfortunatelly it's missing many needed types of charts or other customization options. This implementation have more options and similar "interface" for building charts. Installation Add gem to your application's Gemfile: gem "rails_charts" Then execute: $ ./bin/bundle install You can install ECharts with installation command $ ./bin/rails rails_charts:install or do it manualy Sprockets add eCharts in main JS bundle, e.g. app/assets/javascripts/application.js //= require echarts.min.js //= require echarts/theme/dark.js add your first chart e.g. <%= line_chart User . group ( :age ) . count %> customize charts if needed. See available options or official documentation. Webpack / esbuild Run: yarn add echarts For Rails 7 In app/javascript/application.js add this: import * as echarts from 'echarts' ; import 'echarts/theme/dark' ; window . echarts = echarts ; For Rails 6 In app/javascript/packs/application.js add this: import * as echarts from 'echarts' ; import 'echarts/theme/dark' ; window . echarts = echarts ; add your first chart e.g. <%= line_chart User . group ( :age ) . count %> customize charts if needed. See available options or official documentation. Importmaps change config/importmap.rb pin "echarts" , to : "echarts.min.js" pin "echarts/theme/dark" , to : "echarts/theme/dark.js" add eCharts in main JS import "echarts" import "echarts/theme/dark" add your first chart e.g. <%= line_chart User . group ( :age ) . count %> customize charts...

First seen: 2025-08-20 04:05

Last seen: 2025-08-20 16:20