Rails 7: Filtering Data with ChartKick & Stimulus – Ruby on Rails Tutorial


I’ve been using Chartkick for years, but upgrading to Rails 7 made me take a look at how I’d been trapping Chartkick events and upgrade it to work with Stimulus. I am talking about trapping the clicking on a chart and using it as a kind of filter for the associated data.

00:00 Intro
00:30 App setup
01:30 Install ChartKick
04:20 Sample Chart
06:00 Creating a model
07:15 Seed data with ChatGPT
11:30 Model Views
16:30 Old Way – pure Javascript
22:50 New Way – Stimulus.js
23:00 Create Stimulus Controller
23:30 Edit the view
25:30 Edit the Stimulus Controller
30:30 Filter the data
33:30 Fetching the data
41:35 Set the Stimulus Controller Target
44:20 Recap

For a detailed article (i.e. transcript with source code kind of thing) you can look at my Substack: https://philonrails.substack.com/

See the code for this episode here: https://github.com/philsmy/stimulus-chartkick

Some people online just talk – I just do. One of my major SaaS products out there is Zonmaster.com (https://public.zonmaster.com) THE AutoResponder and Customer Management tool for Amazon Sellers. Join over 17,000 other Amazon Sellers and sign up today!

Looking for great hosting? I’ve been using DigitalOcean for 7 years and they have never let me down. Amazing.
Check them out here https://m.do.co/c/f1c6edf8597f and get $100(!!!) free credits towards the cost of servers.

#techEntrepreneur #entrepreneurship #softwareDevelopment

,

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.