Git Product home page Git Product logo

ng-gauge's Introduction

ng-gauge

Flexible gauge graph made with SVG ang Angular2 that can be used as pie chart too.

As seen on Angularbeers http://www.meetup.com/AngularJS-Beers/events/234753624/

Installing

ng-gauge is available via npm

npm install ng-gauge -S

Import GaugeModule in your module

import { GaugeModule } from 'ng-gauge';

And the models where you need them

import { GaugeSegment, GaugeLabel } from 'ng-gauge';



## Usage:
```html
<ng-gauge></ng-gauge>

Set a width and height for the gauge and it will scale accordingly.

Example code can be checked in src/app/app.html

Options:

  • rounded: boolean = true | whether linecap should be rounded
  • reverse: boolean = false | segments are sorted by value. whether drawing order should be sorted
  • animationSecs: number = 0.5 | animation of lines when changing values
  • bgRadius: number = 100 | radius of background circle
  • bgColor: string | color of background circle
  • label: GaugeLabel[] | labels to be displayed
  • segments: GaugeSegment[] | info to be displayed

GaugeSegment is a class you MUST use and it has the following properties:

  • radius: number = 100 | outer radius of this segment (border is painted inside)
  • goal: number = 100 | maximum value for given segment
  • value: number | value to be represented
  • color: string | color of the segments
  • bgColor: string = 'transparent' | background color of this segment
  • borderWidth: number = 100 | width of the border. Gets painted inside radius

GaugeLabel is a class you CAN use and it has the following properties:

  • color: string | color of this label
  • text: string | content of this label
  • x: number = 0 | x from starting point (center center)
  • y: number = 0 | y from starting point (center center)
  • fontSize: string = '1em' | font size of this label

Known issues:

  • IE11 does not show animations
  • IE11 does not show straight lines when displaying full pie chart

ng-gauge's People

Contributors

angular-cli avatar subarroca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ng-gauge's Issues

Usage error

Hello,
i am trying to use the module in my ionic 2 app.

I've installed it according the docs:
npm install ng2-kw-gauge -S

In the app.module.ts i added:
import { GaugeModule, GaugeSegment, GaugeLabel } from 'ng2-kw-gauge';
@NgModule({ imports: [ IonicModule.forRoot(MyApp), GaugeModule, GaugeSegment, GaugeLabel ],

The template.html looks like:
<ng2-kw-gauge></ng2-kw-gauge>

But i get a browser error:
Error: Cannot find module "ng2-kw-gauge"

Maybe someone can point me in the correct direction what i'am doing wrong?

IE11 Support

Hi,
It seems it doesn't work well in Internet Explorer 11 (visibility + animations).

Any idea how to fix..?

10X.

Using it with system.config.js

I have tried to use it with the system.config.js, but can't get it to work. Is there a working example?
I appreciate your work and didn't find a better gauge or doughnut chart with this function for Angular2.

is Angular 5 Compatible?

I would like to know if this library is compatible with Angular 5. If not, is it planned to be updated?

usate with systemjs

Hi,

i am trying to use the library with systemjs, but i am not able to make it compile.

i have to manually compile the lib before use it with systemjs?

90 deg charts on Microsoft Edge

I was testing on different browser and found that Microsoft Edge displays only a 90 deg portion of the chart. Any thoughts?

Angular 4.0.0 Support

Hello,
today i tried an Ionic update. Now it uses Angular 4.0.0. But i wasn't successful:

npm WARN [email protected] requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN [email protected] requires a peer of @angular/platform-browser@^2.0.0 but none was installed.

Hopefully this is a ng2-kw-gauge issue?

To version 0.0.8 i updated in the meanwhile.

Regards
.nowrap

Microsoft Edge SVG rendering bug

Greetings and big thanks for your awesome component.

I experienced some issues with using it in MS Edge.

This is how the gauges are rendered in Chrome (and in Firefox):
chrome

And this is how they are rendered in MS Edge:
edge

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.