vue-speedometer is a Vue 3 component library for rendering highly configurable speedometer-like gauges, leveraging D3.js for its robust data visualization capabilities. The current stable version is 3.0.1, which represents a complete rewrite utilizing Vue's Composition API and Single File Components (SFCs), requiring Vue 3.3.0 or later. While a specific release cadence isn't published, major version updates tend to align with significant architectural changes or Vue major version compatibility, with v3 focusing exclusively on Vue 3. This library differentiates itself by providing a performant, D3-driven gauge, offering a "slim build" option for users who wish to manage D3 microbundles externally, and maintains consistent API patterns across its React and Svelte ports. It provides extensive customization for appearance, segments, and labels.
npm install vue-speedometerVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `vue-speedometer` with dynamic value updates and common configuration props for customization.
Ensure your project's Vue version is >=3.3.0. For Vue 2 projects, use vue-speedometer v1.x.
Validate input values to ensure `value >= minValue` and `value <= maxValue` before passing them to the component.
Be aware that the actual number of segments or labels might slightly differ from the exact number specified. Refer to D3's `d3-array` and `d3-scale` documentation for details.
Install the necessary D3 microbundles: `npm install d3-array d3-color d3-ease d3-format d3-interpolate d3-scale d3-selection d3-shape d3-transition`.
Ensure `import VueSpeedometer from 'vue-speedometer'` is present in your `<script setup>` block, or that the component is explicitly registered via `app.component('VueSpeedometer', VueSpeedometer)` if not using SFCs with script setup.Ensure that the `value` prop passed to `<VueSpeedometer>` is always a JavaScript `Number`. If your data comes as a string, parse it using `parseInt()` or `parseFloat()` (e.g., `:value="parseInt(myStringValue)"`).
Install all the specified D3 microbundles as direct dependencies: `npm install d3-array d3-color d3-ease d3-format d3-interpolate d3-scale d3-selection d3-shape d3-transition`.