npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dial-gauge

v0.1.5

Published

Dial Gauge is a web component that provides a customizable dial gauge for numeric display.

Downloads

22

Readme

Dial Gauge Web Component

Published on npm Published on webcomponents.org Version

Dial Gauge is a web component that provides a customizable dial gauge for numeric display. It is suitable for progress indication as well as graphical display of real time numeric data. It utilizes SVG and is written in pure Javascript with no dependencies.

Installation

  • NPM npm install dial-gauge

  • CDN <script type="module" src="https://www.unpkg.com/dial-gauge/dial-gauge.js"></script>

Usage

The Dial Gauge component utilizes the custom element tag <dial-gauge>. The custom element has the following attributes:

  • value - The custom element component value.
  • scale-start - The custom element scale starting value.
  • scale-end - The custom element scale ending value.
  • main-title - The custom element main title, displayed at the top of the component.
  • sub-title - The custom element subtitle, displayed at the bottom of the component.
  • scale-offset - The custom element bottom offset, an angle applied to adjust the beginning and end of the scale.

The component will automatically update when attributes are set dynamically and displays a numeric representation of the data, as well as the graphical dial. Values that are outside the scale range will display OL for outside limits. The component 'sub-title' attribute is suitable for displaying the units of the data.

<dial-gauge main-title="Main" sub-title="Sub" scale-start="0" scale-end="100" scale-offset="30" value="50">
</dial-gauge>

CSS Style Variables

The following CSS property variables, along with their default values, are available for custom styling. |Property Variable|Default Value| |---|---| |General Element| |--dg-background-color|#ffffff| |--dg-border|1px solid #000000| |--dg-border-radius|5px| |--dg-box-shadow|3px 3px 5px 1px rgba(0,0,0,0.35)| |--dg-display|inline-block| |--dg-height|200px| |--dg-margin|0| |--dg-width|200px| |--dg-z-index|0| |Title| |--dg-title-color|#000000| |--dg-title-font-family|Verdana, Geneva, Tahoma, sans-serif| |--dg-title-font-size|1.5em| |Dial Arc| |--dg-arc-background-color|#efefef| |--dg-arc-color|#000000| |--dg-arc-width|20| |Numeric Display| |--dg-numeric-color|#000000| |--dg-numeric-font-family|Verdana, Geneva, Tahoma, sans-serif| |--dg-numeric-font-size|2.5em| |Subtitle| |--dg-subtitle-color|#000000| |--dg-subtitle-font-family|Verdana, Geneva, Tahoma, sans-serif| |--dg-subtitle-font-size|1em|

Changing the Tag Name

The Dial Gauge component uses the <dial-gauge> tag in html. In certain cases users may want, or need, to change the tag name. This can be accomplished in Javascript by subclassing the element and registering this subclass under a new tag name.

import {DialGauge} from 'dial-gauge';

customElements.define('my-new-tag', class extends DialGauge{});

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.