d3 speedometer sample
Overview
The d3 Speedometer Sample is a ready-to-run module that shows the d3 Speedometer widget in action. Import it into your app, open one page, and try every setting of the widget live: change a value in a form and watch the gauge update. It is the quickest way to learn what the widget can do and to find the right settings before you build your own page.
What is included
- A Home_Web page with a speedometer gauge and a "Features" panel below it.
- 30 input fields in the Features panel, one for every widget property: value, range, segments, colours, needle, dimensions, labels and formatting.
- A non-persistable entity, d3Speedometer, with an attribute for every property. Nothing is stored in your database.
- A data source microflow that opens the gauge with ready-made demo values: value 250 on a 0–500 scale, 5 segments with labels, 400 px wide.
- A link to the react-d3-speedometer documentation for further reading.
- The d3 Speedometer widget 1.0.1 itself, so no separate widget download is needed.
Documentation
Typical usage scenario
The d3 Speedometer Sample is a ready-to-run demo of the d3 Speedometer widget. Use it to:
- Learn the widget quickly: open one page and see the gauge with working demo values, without building anything.
- Experiment before you build: try values, ranges, segment colours, threshold zones, labels and needle animations in a form, and see the result straight away.
- Find the right settings: work out which colours, custom stops or label JSON you need, then use the same values in your own app.
- Start from a working example: copy the entity, data source microflow and page as a template for your own gauges.
- Demonstrate the widget to colleagues or customers before you commit to it.
It solves the usual "how do I configure this?" problem. With 30 properties, many entered as text (comma-separated lists or JSON), it is much faster to try settings live than to read about them.
Features and limitations
Features
- The page Home_Web shows a speedometer gauge and a Features panel with 30 input fields, one for every widget property.
- A non-persistable entity, d3Speedometer, has an attribute for every property, so nothing is stored in your database.
- The data source microflow DS_d3Speedometer opens the gauge with demo values: value 250, range 0–500, 5 segments with 5 labels, 400 px wide.
- A button opens the react-d3-speedometer documentation.
- The module role User is already set up for the page, the microflow and the entity.
- Bundled widgets: d3 Speedometer 1.0.1 and Tooltip 1.4.2, so no separate downloads are needed.
Limitations
- It is a demo: the values are not saved and are reset each time the page opens.
- Web profiles only; the d3 Speedometer widget does not support native mobile.
- The widget's own limitations apply. Values of 0 or below fall back to the defaults, so negative ranges are not possible, and value, minimum and maximum are whole numbers only.
Dependencies
- Mendix Studio Pro 10.24.17 or a later 10.24 version.
Installation
1. Download d3speedometer.mpk.
2. In Studio Pro, choose File > Import Module Package and select the file.
3. If Studio Pro reports that a widget package already exists (for example Tooltip), keep the newer version.
4. The module d3speedometer now appears in the App Explorer. Both widgets are added to your widgets folder.
Configuration
1. Security: open App > Security > User roles and give the user roles that should see the demo the module role d3speedometer.User. Without it, the page and its data source are not accessible.
2. Navigation: add the page d3speedometer.Home_Web to your navigation menu, or open it from a button on an existing page.
3. Run the app, log in with a user who has that role, and open the page.
4. Change any field in the Features panel and watch the gauge update.
Things to try:
- Segment colours: red,orange,green
- Custom segment stops: 0,300,450,500
- Value text: ${value} km/h
- Needle transition: easeElastic
Known bugs
None.
Report to https://github.com/bharathidas/d3_speedometer/issues
Frequently Asked Questions
Do I need to download the d3 Speedometer widget separately?
No. The sample includes widget 1.0.1.
The page says I have no access. What should I do?
Give your user role the module role d3speedometer.User under App > Security.
Are my changes saved?
No. The entity is non-persistable, so the page always starts with the demo values.
Can I use the sample page in production?
It is meant for learning and testing. Copy the approach into your own entity and page instead.
Can I remove the sample later?
Yes. Delete the d3speedometer module; the widget stays in your widgets folder and keeps working on your own pages.
Which Mendix version do I need?
Studio Pro 10.24.17 or a later 10.24 version. For Mendix 9.12.4, use the older sample app d3_speedometer.mpk from the GitHub release Version1.1.
Releases
## d3 Speedometer 1.0.1
Widget version: **1.0.1** (same as this GitHub release tag)
### Compatibility
- Mendix Studio Pro **10.24.17**
- Built with `@mendix/pluggable-widgets-tools` 10.16.0
- Rendering library react-d3-speedometer 2.2.1 (unchanged)
`Speedometer.xml` is byte-identical to 1.0.0, so existing widget instances keep their configuration. Source changes are lint-only; the package is now a minified production build (72 KB instead of 428 KB).
### Install
Download `mendix.Speedometer.mpk` from this release and import it into your Mendix app.
Sample module: download [`d3speedometer.mpk`](https://github.com/bharathidas/d3_speedometer/raw/Version1.0.1/d3speedometer.mpk) from the repository (Studio Pro 10.24.17, bundles widget 1.0.1), import it via *File > Import Module Package* and open `d3speedometer.Home_Web`.
### Known behavior (carried over from 1.0.0)
- Values of 0 or below are ignored for value, minValue, maxValue and the other numeric attributes, and the default is used instead. A negative minValue is therefore not possible.
- If customSegmentLabels is set while maxSegmentLabels is empty, the widget passes 0 and numeric segment labels render at `rotate(NaN)`, stacking at the center. Set maxSegmentLabels to the segment count to avoid this.
### Previous version (Mendix 9.12.4, widget 1.0.0)
- [Version1.0](https://github.com/bharathidas/d3_speedometer/releases/tag/Version1.0) — widget `mendix.Speedometer.mpk` 1.0.0
- [Version1.1](https://github.com/bharathidas/d3_speedometer/releases/tag/Version1.1) — sample app `d3_speedometer.mpk`