phlex-echarts Starter App — Setup Guide
Run these commands in order. Each section is self-contained. Total time: approximately 5–10 minutes.
If you wish to bypass the build instructions, you can always download the basic working copy phlex-echarts-starter.zip
The end result should be a basic working app:

1. Generate the Rails app
|
|
2. Add gems
|
|
3. Pin ECharts
|
|
Then open config/importmap.rb and verify the echarts line references the ESM build.
If it does not contain esm in the filename, replace it manually:
|
|
4. Install Phlex
|
|
5. Write application files
Create our initial application_layout and a default route.
app/views/layouts/application.html.erb
Replace the generated layout with:
|
|
config/routes.rb
|
|
app/controllers/smoke_controller.rb
|
|
app/views/smoke/index.html.rb
|
|
app/javascript/controllers/smoke_controller.js
|
|
app/javascript/controllers/smoke_chart_controller.js
|
|
6. Migrations
|
|
7. Models
app/models/gdp_reading.rb
|
|
app/models/labour_force_reading.rb
|
|
app/models/cpi_reading.rb
|
|
app/models/leading_index_reading.rb
|
|
app/models/daily_activity_reading.rb
|
|
8. Seed data files
We have a generator file to create our initial datasets:
|
|
db/seeds.rb
|
|
9. Verify
|
|
All five stack checks should pass. If ECharts fails to render, open the browser console —
the most common cause is the importmap pin resolving to a CJS build rather than the ESM build.
Check that the URL in config/importmap.rb contains esm in the filename.