Coder Social home page Coder Social logo

angular-raphael-gauge's Introduction

jQuery Raphael Gauge

Code Climate

You can see demo here.

Why bother?

I needed this kind of Gauge "chart" for one of my projects and it was great opportunity to get some experience in both AngularJS and Raphael.js :)

INSTALLATION

via bower:

bower install angular-raphael-gauge

or simply download latest source code from repository: link

USAGE

Include angular-raphael-gauge in your HTML file. Remember about including Raphael.js and jQuery.

<!-- AngularJS -->
<script src="path/to/angular.min.js"></script>

<!-- JQuery -->
<script src="path/to/jquery.min.js"></script>

<!-- Raphael.js -->
<script src="path/to/raphael-min.js"></script>

<!-- angular raphael gauge -->
<script src="path/to/angular-raphael-gauge.min.js"></script>

Next plugin-in angular-raphael-gauge into your application:

var angularDemo = angular.module('angularDemo', ['angular-raphael-gauge']);

Now all you have to do is put directive code into HTML file:

<raphael-gauge id="gauge1" config="gauge"></raphael-gauge>

and pass some options via config object in $scope:

angularDemo.controller('DemoCtrl', ['$scope', function ($scope) {
  $scope.gauge = {
          name: 'Some data',
          opacity: 0.55,
          value: 65,
          text: 'some cool data'
        };
}]);

Updating $scope.value will update gauge value and render animation.

That's it! :) See demo for working example.

OPTIONS

Here are options available to be set during runtime:

var options = {
              name: false,  // text under gauge
              value: 25,    // value
              image: false, // path to image (should be square) - it will be under gauge
              text: false,  // text in the middle of gauge
              textColor: '#000000', // text color
              arcColor: '#57E0EA',  // animated arc color
              bgArcColor: '#000',   // round background under arc
              opacity: false,   // arc opacity
              duration: 1600,   // animation duration
              easing: 'bounce' // Raphael easing effect. Don't use backIn or Elastic, they mess up animation :/
            };

Building / Minifing

You can build minified version yourself, by simply using Grunt in project root.

grunt

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

angular-raphael-gauge's People

Contributors

wasilak avatar

Watchers

Abhijeet 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.