12.0.0 • Published 5 months ago

angular-svg-round-progressbar v12.0.0

Weekly downloads
12,528
License
MIT
Repository
github
Last release
5 months ago

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 {}

Or RoundProgressComponent, if you're using standalone:

import {Component} from '@angular/core';
import {RoundProgressComponent} from 'angular-svg-round-progressbar';

@Component({
  standalone: true,
  imports: [RoundProgressComponent],
  template: '...'
})
export class YourComponent {}

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

Options

NameDescriptionRequiredDefault valuePossible values
currentThe current progress. Limited by the max option.Yesundefinednumber
maxThe progress' maximum value.Yesundefinednumber
radiusRadius of the circle.No125number
colorThe color of the current value on the circle.No#45cccestring
backgroundColor of the circle's background.No#eaeaeastring
strokeSpecifies the circle's thickness.No15number
semicircleWhether the progressbar should be a full circle or a semicircle.Nofalseboolean
clockwiseWhether the progressbar should rotate clockwise or counter-clockwise.Notrueboolean
responsiveWhether 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.Nofalseboolean
roundedWhether the current progress ending should be rounded or straight.Nofalseboolean
durationThe duration of the animation. Pass 0 for no animation.No800number
animationDelayMilliseconds to wait before starting an animation.No0number
onRenderCallback function that gets executed every time the circle is animated. The function gets called with the current progress as it is being animated.NoundefinedFunction
animationThe easing function that will be used when animating.NoeaseOutCubiclinearEase 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"/>

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)"/>

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

The project uses yarn to manage dependencies to make sure that you have it installed.

  • yarn to install development dependencies.
  • yarn lint to lint the source files.
  • yarn start to run a development server. Go to localhost:4200 to see the demo.
  • yarn build-lib to build the library in production mode.
  • yarn build-demo to build the demo in production mode.
  • yarn release-lib to build the library and release it to npm.
  • yarn release-demo to build the demo and deploy it to GitHub Pages.

Credits

12.0.0

5 months ago

11.0.0

11 months ago

10.0.0

1 year ago

9.0.0

2 years ago

8.0.0

2 years ago

7.0.0

3 years ago

6.0.1

3 years ago

6.0.0

3 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

6 years ago

1.2.1

6 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.4.8

8 years ago

0.4.7

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.10

8 years ago

0.3.9

8 years ago

0.3.8

9 years ago

0.3.7

9 years ago

0.3.6

9 years ago

0.3.5

9 years ago

0.3.4

9 years ago