1.0.2-release • Published 6 years ago

angular5-svg-round-progressbar v1.0.2-release

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

Angular5 SVG Round Progressbar

Ionic/Angular module that uses SVG to create a circular progressbar with Angular5 and AOT(Ahead of Time) compiler support. Originally made by crisbeto, crisbeto/angular-svg-round-progressbar. Go give that repo a star for his efforts!

Note

responsive and semicircle option is not available in this versio because of some issues. Will fix that later or you may contirubte to this repo.

Installation

First you have to install the module through npm:

npm install angular5-svg-round-progressbar --save

Afterwards you need to import the RoundProgressModule in your module:

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

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

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
semicircleN/AWhether the progressbar should be a full circle or a semicircle.Nofalseboolean
clockwiseWhether the progressbar should rotate clockwise or counter-clockwise.Notrueboolean
responsiveN/AWhether 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"></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 using the RoundProgressConfig service. 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} from 'angular5-svg-round-progressbar';

@NgModule({
  imports: [RoundProgressModule]
})
export class YourModule {
  constructor(private _config: RoundProgressConfig) {
    _config.setDefaults({
      color: '#f00',
      background: '#0f0'
    });
  }
};

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
  • npm run build to generate /dist/ with .js and .d.ts files

Issues

For any issues please report them in the issues section.

Credits

1.0.2-release

6 years ago

1.0.1-release

6 years ago

1.0.44-alpha

6 years ago

1.0.43-alpha

6 years ago

1.0.42-alpha

6 years ago

1.0.41-alpha

6 years ago

1.0.40-alpha

6 years ago

1.0.39-alpha

6 years ago

1.0.38-alpha

6 years ago

1.0.37-alpha

6 years ago

1.0.36-alpha

6 years ago

1.0.35-alpha

6 years ago

1.0.34-alpha

6 years ago

1.0.33-alpha

6 years ago

1.0.32-alpha

6 years ago

1.0.31-alpha

6 years ago

1.0.30-alpha

6 years ago

1.0.29-alpha

6 years ago

1.0.28-alpha

6 years ago

1.0.27-alpha

6 years ago

1.0.26-alpha

6 years ago

1.0.25-alpha

6 years ago

1.0.24-alpha

6 years ago

1.0.23-alpha

6 years ago

1.0.22-alpha

6 years ago

1.0.21-alpha

6 years ago

1.0.20-alpha

6 years ago

1.0.19-alpha

6 years ago

1.0.18-alpha

6 years ago

1.0.17-alpha

6 years ago

1.0.16-alpha

6 years ago

1.0.15-alpha

6 years ago

1.0.14-alpha

6 years ago

1.0.13-alpha

6 years ago

1.0.12-alpha

6 years ago

1.0.11-alpha

6 years ago

1.0.10-alpha

6 years ago

1.0.9-alpha

6 years ago

1.0.8-alpha

6 years ago

1.0.7-alpha

6 years ago

1.0.6-alpha

6 years ago

1.0.5-alpha

6 years ago

1.0.4-alpha

6 years ago

1.0.3-alpha

6 years ago

1.0.2-alpha

6 years ago

1.0.1-alpha

6 years ago

1.0.0-alpha

6 years ago