GithubHelp home page GithubHelp logo

hhy5277 / angular-svg-round-progressbar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crisbeto/angular-svg-round-progressbar

0.0 1.0 0.0 5.81 MB

Angular module that uses SVG to create a circular progressbar

Home Page: http://crisbeto.github.io/angular-svg-round-progressbar/

License: MIT License

JavaScript 20.41% TypeScript 79.59%

angular-svg-round-progressbar's Introduction

Angular SVG round progressbar

Angular module that uses SVG to create a circular progressbar

Demo

Click here for the Angular 1.x version

Install

First you have to install the module through npm:

npm install angular-svg-round-progressbar --save

Afterwards you need to import the RoundProgressModule in your module:

import {NgModule} from '@angular/core';
import {RoundProgressModule} from 'angular-svg-round-progressbar';

@NgModule({
  imports: [RoundProgressModule]
})
export class YourModule {};

If you're using SystemJS as your module loader, there is also a UMD bundle at ./node_modules/angular-svg-round-progressbar/dist/round-progress.umd.js.

Options

Name Description Required Default value Possible values
current The current progress. Limited by the max option. Yes undefined number
max The progress' maximum value. Yes undefined number
radius Radius of the circle. No 125 number
color The color of the current value on the circle. No #45ccce string
background Color of the circle's background. No #eaeaea string
stroke Specifies the circle's thickness. No 15 number
semicircle Whether the progressbar should be a full circle or a semicircle. No false boolean
clockwise Whether the progressbar should rotate clockwise or counter-clockwise. No true boolean
responsive Whether the progressbar should fit inside its parent container. Note Turning this option on will override the specified radius in order to make the circle fit in its parent. The radius to stroke ratio won't change. No false boolean
rounded Whether the current progress ending should be rounded or straight. No false boolean
duration The duration of the animation. Pass 0 for no animation. No 800 number
animationDelay Milliseconds to wait before starting an animation. No 0 number
onRender Callback function that gets executed every time the circle is animated. The function gets called with the current progress as it is being animated. No undefined Function
animation The easing function that will be used when animating. No easeOutCubic linearEase
easeInQuad
easeOutQuad
easeInOutQuad
easeInCubic
easeOutCubic
easeInOutCubic
easeInQuart
easeOutQuart
easeInOutQuart
easeInQuint
easeOutQuint
easeInOutQuint
easeInSine
easeOutSine
easeInOutSine
easeInExpo
easeOutExpo
easeInOutExpo
easeInCirc
easeOutCirc
easeInOutCirc
easeInElastic
easeOutElastic
easeInOutElastic
easeInBack
easeOutBack
easeInOutBack
easeInBounce
easeOutBounce
easeInOutBounce

Minimal example:

<round-progress [current]="current" [max]="max"></round-progress>

Full example:

<round-progress
    [current]="current"
    [max]="max"
    [color]="'#45ccce'"
    [background]="'#eaeaea'"
    [radius]="125"
    [stroke]="20"
    [semicircle]="true"
    [rounded]="true"
    [clockwise]="false"
    [responsive]="false"
    [duration]="800"
    [animation]="'easeInOutQuart'"
    [animationDelay]="0"
    (onRender)="doSomethingWithCurrentValue($event)"></round-progress>

Configuring the default values

The module comes with some pre-configured options for things like colors, size, stroke etc. If these don't match your app's design, you can change the global defaults by providing a new value for the ROUND_PROGRESS_DEFAULTS injection token. Whenever an option isn't defined on a round-progress element, it's value will be taken from the defaults.

import {NgModule} from '@angular/core';
import {
  RoundProgressModule,
  RoundProgressConfig,
  ROUND_PROGRESS_DEFAULTS
  } from 'angular-svg-round-progressbar';

@NgModule({
  imports: [RoundProgressModule],
  providers: [{
    provide: ROUND_PROGRESS_DEFAULTS,
    useValue: {
      color: '#f00',
      background: '#0f0'
    }
  }]
})
export class YourModule {};

Browser support

  • Internet Explorer 9+
  • Firefox 28.0+
  • Chrome 31+
  • Safari 5.1+
  • and pretty much any browser that supports SVG

Note: Some older browsers may require (a polyfill for requestAnimationFrame). Read more about the requestAnimationFrame browser support.

Development

  • npm install to install development dependencies
  • gulp to run a development server. Not mandatory(you can run the build/index.html directly), but more convenient.
  • gulp module:build to build minified demo in build/
  • gulp deploy to do a build and push the demo to the gh-pages branch

Credits

angular-svg-round-progressbar's People

Contributors

crisbeto avatar gedrap avatar jasonconway-williams avatar jwfwessels avatar konsumer avatar michel-soares avatar purush0th avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.