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

angular-metergauge

v1.0.3

Published

angular directive for displaying meter gauge/speedometer gauge visualization

Downloads

8

Readme

angular-metergauge(speedometer gauge)

An angular JS directive for meter/speedometer gauge visualization with real time update.

##Demo https://amitgen414.github.io/angular-metergauge

Requirements

  • D3.js v4.2.2
  • AngularJS v1.0.1+

Getting started

You will need to include angular JS and 'D3 JS' in your project to make the directive work

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>

Include angular-metergauge module script with above incuded scripts script on your page. You can copy the angular-metergauge.min.js from build folder of repo and add it in your script folder

<script src="./script/angular-metergauge.min.js"></script>

Add angular-metergauge to your app module's dependency.

angular.module('myApp', ['meterGauge']);

Install with npm

$ npm install angular-metergauge 

##Options

Option | Description --------------------| ----------- gaugeRadius | Sets the size of gauge circle. minVal | Minimum value to be shown in gauge scale. maxVal | Maximum value to be shown in gauge scale. needleVal | Sets the value of needle to be pointed. tickSpaceMinVal | space between the major ticks of the gauge. tickSpaceMajVal | space between the sub ticks of the gauge. divID | sets an id for svg where gauge will be rendered (Optional). gaugeUnits | Unit of the values to be shown(ex. Kmph,%). tickColMaj | sets colour of the major tick. tickColMin | sets colour of the sub tick. outerEdgeCol | sets the colour of outer circle of the gauge. pivotCol | sets colour of the pivot innerCol | sets colour of inner body of the gauge unitsLabelCol | sets colour of units label tickLabelCol | sets colour of labels of the ticks needleCol | sets colour of the needle defaultFonts | sets the default fonts in gauge.

Configuration

We can configure the angular-metergauge for Size, colour,value fonts and other available options. we have to add a variable in scope of the controller and pass it to the config option of directive. Here is an example of classic theme configuration.

angular.module('myApp').controller('myAppController',['$scope', function($scope){
    $scope.classic = {
            gaugeRadius: 140,
            minVal: 0,
            maxVal: 1000,
            needleVal: Math.round(700),
            tickSpaceMinVal: 10,
            tickSpaceMajVal: 100,
            divID: "gaugeBox",
            gaugeUnits: "Kmh",
            tickColMaj:'#656D78',
            tickColMin:'#656D78',
            outerEdgeCol:'#CCD1D9',
            pivotCol:'#434A54',
            innerCol:'#E6E9ED',
            unitsLabelCol:'#656D78',
            tickLabelCol:'#656D78',
            needleCol:'#434A54',
            defaultFonts:''
        }

}]);
 

Directive usage

angular-metergauge is an element directive. you will just have to add the directive in you html view and attach the config variable through scope.

<!--meter gauge with classic as config variable -->
 <meter-gauge gaugeconfig="classic"></meter-gauge>
</div>

##Dynamically Change value For real time update of the metergauge value, configuration's needleVal parameter can be changed in the contoller. Updated value will be immediately reflected if the gauge. In the example give below, after every two seconds, metergauge's value will change.

 $interval(function(){
            $scope.classic.needleVal =Math.round( Math.random()*1000)
  },2000);

##Customization If you want to customize the app according to your needs, here is what should be done.

  1. Clone the respository in your local workspace.
  2. Install Ruby and Compass in your system as it required for compiling your sass files.
  3. Install the npm dependencies.
$ npm install
  1. Install bower dependencies.
$ bower install
  1. Start the with the dev environment. it will build the project and launch it in the browser with real time code change update.
$ npm run serve 
  1. After you are done with your changes , you can run build command
  $ npm run build 

you will have the script as well as a demo website ready.