All Projects → ashish-chopra → Ngx Gauge

ashish-chopra / Ngx Gauge

Licence: mit
A highly customizable Gauge component for Angular 9+ apps and dashboards

Programming Languages

typescript
32286 projects
arc
50 projects

Projects that are alternatives of or similar to Ngx Gauge

Coreui Free Bootstrap Admin Template
CoreUI is free bootstrap admin template
Stars: ✭ 11,038 (+6886.08%)
Mutual labels:  dashboard, angular2, angular4
Paperadmin
A flat admin dashboard using Angular JS 2/4
Stars: ✭ 80 (-49.37%)
Mutual labels:  dashboard, angular2, angular4
Angular Material Dashboard
A material-design dashboard by using angular
Stars: ✭ 347 (+119.62%)
Mutual labels:  dashboard, angular2, angular4
Coreui Free Angular Admin Template
CoreUI Angular is free Angular 2+ admin template based on Bootstrap 4
Stars: ✭ 1,279 (+709.49%)
Mutual labels:  dashboard, angular2, angular4
Ngvas
An Angular2/Angular4 library for HTML Canvas.
Stars: ✭ 31 (-80.38%)
Mutual labels:  canvas, angular2, angular4
Angular5 Iot Dashboard
Multipurpose dashboard admin for IoT softwares, remote control, user interface. Develop your client dashboards in Angular 5 with vast variety of components available.
Stars: ✭ 148 (-6.33%)
Mutual labels:  dashboard, angular2, angular4
Ngx Openlayers
Angular2+ components for Openlayers 4.x
Stars: ✭ 131 (-17.09%)
Mutual labels:  angular2, angular4
Fusebox Angular Universal Starter
Angular Universal seed project featuring Server-Side Rendering, @fuse-box bundling, material, firebase, Jest, Nightmare, and more
Stars: ✭ 132 (-16.46%)
Mutual labels:  angular2, angular4
Angular2 Spring
Angular 2+ and Spring Integration
Stars: ✭ 133 (-15.82%)
Mutual labels:  angular2, angular4
Ngx Config
Configuration utility for Angular
Stars: ✭ 135 (-14.56%)
Mutual labels:  angular2, angular4
Ng2 Smart Table
Angular Smart Data Table component
Stars: ✭ 1,590 (+906.33%)
Mutual labels:  angular2, angular4
Webapiclientgen
Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
Stars: ✭ 134 (-15.19%)
Mutual labels:  angular2, angular4
Ng2 Search Filter
Angular 2 / Angular 4 / Angular 5 custom pipe npm module to make a search filter on any input, 🔥 100K+ downloads
Stars: ✭ 137 (-13.29%)
Mutual labels:  angular2, angular4
Ngx Validators
Validator library for Angular 2+
Stars: ✭ 128 (-18.99%)
Mutual labels:  angular2, angular4
Ng Gapi
ng-gapi a Google api module for Angular 6+
Stars: ✭ 126 (-20.25%)
Mutual labels:  angular2, angular4
Paper Kit 2 Angular
Free Bootstrap 4 UI Kit for Angular 2+
Stars: ✭ 133 (-15.82%)
Mutual labels:  angular2, angular4
G2
📊 A highly interactive data-driven visualization grammar for statistical charts.
Stars: ✭ 11,020 (+6874.68%)
Mutual labels:  data-visualization, canvas
Ionic2 Pokedex
🎮 Pokédex sample app developed with Ionic 2, Angular 2 and Apache Cordova. Using Pokéapi as source for data.
Stars: ✭ 143 (-9.49%)
Mutual labels:  angular2, angular4
Amazing Time Picker
Timepicker (Clock Picker) for Angular 2, Angular 4 and Angular 5, Angular 6, Angular 7 - Compatible with Angular Material
Stars: ✭ 142 (-10.13%)
Mutual labels:  angular2, angular4
Poli
An easy-to-use BI server built for SQL lovers. Power data analysis in SQL and gain faster business insights.
Stars: ✭ 1,850 (+1070.89%)
Mutual labels:  data-visualization, dashboard

ngx-gauge

npm npm contributions welcome NPM

A highly customizable Gauge component for Angular 9 apps and dashboards. It provides many configurationable options to customize according to your needs. Checkout the live demo here. (For older versions of Angular, check out the compatibility matrix below).

alt text

Getting Started

Angular Version Compatibility Table

Angular Version ngx-gauge Version
6.0 -
7.0 -
8.0 1.0.0-beta.12
9.0 1.0.0

Step 1: Install npm module

For latest version use the command:

npm install ngx-gauge

For a specific version for an older Angular version as per Compatibility table above, use command:

npm install --save [email protected]<version>

Step 2: Import the NgxGaugeModule

import { NgxGaugeModule } from 'ngx-gauge';

@NgModule({
    ...
    imports: [NgxGaugeModule],
    ...
})
export class AppModule { }

Be sure to import NgxGaugeModule after Angular's BrowserModule, as the import order matters for NgModules.

Step 3: Use gauge component in HTML

NgxGaugeModule provides a <ngx-gauge> component which can be used in any angular template to render a gauge. It's configuration properties can be bind to a typescript variable as shown below:

import { Component } from '@angular/core';

@Component({
    selector: 'app-component',
    templateUrl: 'app.html'
})
export class AppComponent {
    
    gaugeType = "semi";
    gaugeValue = 28.3;
    gaugeLabel = "Speed";
    gaugeAppendText = "km/hr";
}
<ngx-gauge [type]="gaugeType" 
           [value]="gaugeValue" 
           [label]="gaugeLabel"  
           [append]="gaugeAppendText">
</ngx-gauge>

Checkout the extensive list of configuration properites given below and try them to acheive your desired customization. In case you face any problem, then raise an issue here.

Configuration Properties

There are plenty of configurable properties available to tune the gauge as per your needs.

Name Description Required Default value Possible values
size Specifies the size of the canvas in which Gauge will be drawn. It is used as width and height both. No 200 Positive Integer
type Specifies the gauge's type. No "full" "full", "semi", "arch"
min Specifies the minimum numeric value for gauge's scale. No 0 Any numeric value
max Specified the maximum numeric value for gauge's scale. No 100 Any numeric value
value Specifies the current value of the Gauge in the range specified by min and max. It is a required attribute. Yes undefined Any numeric value
cap The style of line ending at the gauge's end. No "butt" "round", "butt"
thick Specified the thickness of the gauge's bar. No 6 Any Positive Integer
label Specifies the text to display below the Gauge's reading. No undefined Any String
foregroundColor Specifies the foreground color of the Gauge's scale. No rgba(0, 150, 136, 1) Any color value string
backgroundColor Specifies the background color of the Gauge's scale. No rgba(0, 0, 0, 0.1) Any color value string
append Specifies a string appended to the Gauge's reading. For example "%" most commonly used. No undefined Any string
prepend Specifies a string prepended to the Gauge's reading. For example "$" in case of financial data displayed in Gauge. No undefined Any String
duration Specifies the duration (in milliseconds) of the Gauge's animation No 1500 Positive Integer
thresholds Specifies an object of threshold values at which the gauge's color changes. Checkout an example here. No none {}
animate toggles the gauge animation. No true boolean
aria-label Specifies the label used by screen readers No undefined Any String
aria-labelledby Specifies the ID of any external element to be used as label by screen readers No null Any ID String

Configure Threshold Color Ranges

You can customize the colors of the gauge based on the current value being shown. In order to show different colors when gauge crosses certain value, use property thresholds. It takes an object with the threshold value as key and an object with color property as value. For example:

@Component({ ... })
export class AppComponent {
    ...

    thresholdConfig = {
        '0': {color: 'green'},
        '40': {color: 'orange'},
        '75.5': {color: 'red'}
    };

    ...
}
<ngx-gauge ...  [thresholds]="thresholdConfig"></ngx-gauge>

The keys in the threshold object signifies the minimum value at which the color will be applied. For instance, if the gauge's current value is 53.2, then orange color will be applied because after point 40 every value will be displayed as orange, until next threshold is encountered. In this example 75.5 is the next threshold.

Custom Directives for display text

Sometimes setting a property value on <ngx-gauge> does not solve your purpose. You may want to add custom HTML for displaying value,append, prepend and label texts. In order to provide custom templates for these properties display following directives can be used.

<ngx-gauge [value]="currentValue">
    <ngx-gauge-append>
        <!-- custom append text or HTML goes here -->
    </ngx-gauge-append>
    <ngx-gauge-label>
        <!-- custom label text or HTML goes here -->
    </ngx-gauge-label>
    <ngx-gauge-prepend>
        <!-- custom prepend text or HTML goes here -->
    </ngx-gauge-prepend>
    <ngx-gauge-value>
        {{ currentValue * Math.PI | number }}
    </ngx-gauge-value>
</ngx-gauge>

Note that value attribute is still required on <ngx-gauge> even when you are providing custom template using <ngx-gauge-value>. Because value attribute is responsible for calculating the gauge's drawing on a scale.

Contribution Welcome!

The project is continously evolving with every new release. Give it a star, if you like it. For contribution, setup the development environment as follows:

  1. clone and setup the project dependencies
$> git clone https://github.com/ashish-chopra/ngx-gauge.git
$> npm install
  1. Use following commands based on what you'd like to do:
$> npm start             # builds the project and watch for changes. 
$> npm test              # runs test suite once and exit.
$> npm run test:watch    # starts the test framework and watch for changes in code.
$> npm run build         # triggers a manual build for library, outputs at `/dist` directory.
  1. To add a new feature or fix a bug, make sure to create a new branch from master.

First thing first, explore the issue tracker to find something to contribute. There are tons of other project setup related issues and activities in which you can help. Your feedback could also be a great contribution.

If you face any problem, then raise an issue here.

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].