G3 is a flexible Javascript framework for building steam gauge instrument panels that display live external metrics from flight (or other) simulators like X-Plane and Microsoft FS2020. Here's a screenshot with some of the included flight gauges (or try this live demo):
- Install G3
- Get started, then follow the tutorial to build a panel or design a new gauge
- Browse the Contributed Gauge Gallery, the Cookbook of short recipes, and the complete API reference
- Give back by contributing new gauges and panels
- Explore related resources
Keywords: G3 D3 Javascript SVG flight simulator gauges instruments control panel metrics telemetry dashboard visualization dataviz XPlane FS2020
G3's goal is to provide a lightweight, browser-based solution for building steam-gauge control panels using simple hardware atop a commodity LCD display, powered by an affordable single-board computer like the Pi. One of my original inspirations was this awesome Cessna setup. G3 could also be useful for interactive data visualizations and dashboards.
The name G3 is a tortured backronym for "generic gauge grammar"—and has an aircraft connection—but was mainly chosen in homage to D3. It's part of a quixotic pandemic project to build a DHC-2 Beaver simpit. Although there are plenty of alternatives for creating instrument panels, I decided it would be fun to roll my own based on pure Javascript with SVG using D3. After several iterations, I ended up very close to the pattern suggested by Mike Bostock several years ago in Towards reusable charts.
The iconic Omega Speedmaster watch,
mimicked by the example omegaSpeedmaster gauge below
(see live demo),
showcases G3's flexibility to create complex, working gauges that look good:
You can skip installing altogether and just refer to a standalone copy of the module distribution from an NPM CDN like these:
https://unpkg.com/@patricksurry/g3/dist/g3-contrib.min.js
https://cdn.jsdelivr.net/npm/@patricksurry/g3/dist/g3-contrib.min.js
You can also set up an npm project, by creating a project directory and installing G3:
npm install @patricksurry/g3
If you prefer a local standalone copy, you can download any of g3[-contrib][.min].js
directly from unpkg or
jsDelivr (right-click and "Save As").
The base g3 package provides the API to define gauges and assemble them into control panels,
and the g3-contrib package adds a bunch of predefined gauges and panels
that you can use or modify. The .min versions are minified to load slightly faster,
but harder to debug. Choosing g3-contrib.js is probably a good start.
See Contributing if you want to hack on G3.
Check things are working by creating a minimal HTML file called gallery.html
that shows all the contributed gauges, animated with fake metrics:
<html>
<body>
<script src="https://unpkg.com/@patricksurry/g3/dist/g3-contrib.min.js"></script>
<script>
g3.gallery.contrib('body');
</script>
</body>
</html>Serve it locally with something like python -m http.server
and browse to http://localhost:8000/gallery.html.
Then follow the tutorial to build your own panel, display real metrics from a simulator, and design a new gauge. The cookbook has short recipes for common problems.
If you want to extend G3, improve the documentation,
or just add your own examples back into the package,
you should start by forking and cloning the
git repo
followed by npm install.
Check the issue tracker
if you're looking for something to play with.
Check the unit tests after any changes with npm run test.
The same type check, lint, tests and build run in CI on every pull request (see .github/workflows/ci.yml).
Ensure new code is tested using npm test -- --coverage.
The test suite also verifies that every contributed gauge has a JSDoc description,
matches its deterministic SVG snapshot in tests/contrib/*.svg, and is documented in doc/CONTRIB.md.
After adding or modifying a contributed gauge in src/contrib/, run npm run docs
to regenerate the SVG snapshots and doc/CONTRIB.md.
You can test changes interactively by serving directly from the src/ tree using
Vite.
Use npm run start to launch the gauge gallery panel from src/index.html
in your browser.
(Note this HTML script uses module style imports unlike the production distribution.)
You can build the bundled package and TypeScript declarations into dist/ by typing npm run build
(dist/ is git-ignored and built automatically on npm publish via the prepack script).
Once you're happy with your changes, make a pull request.
When I want to publish a new release, I also bump the version in package.json,
then merge and tag in github and finally publish with something like:
git tag v0.1.20
git push origin --tags
npm login
npm publish --access public- Towards reusable charts
- Python SimConnect Python interface for MS FS2020 using SimConnect
- Sim Innovations create instrument panels with Air Manager
- Home cockpit simulator control interface combine physical instruments and panels
- MobiFlight open source project integrating hardware with your flight sim
See doc/API.md, and doc/COOKBOOK.md for short recipes.

