Giter Club home page Giter Club logo

angular-barchart's Introduction

Angular BarChart Directive

A reusable angular.js directive that will render a bar chart based upon data passed from the controller.

In your app config, add the directive as a dependancy injection like so

app = angular.module('appName', [
   'ftBarChart'
]);

Use the directive by placing the code tag as follows:

<div bar-chart ng-model="data"></div>

Defaults are in place for all the chart configurations, however the following configurations may be added as attributes to the directive element.

chart-height="200" 
chart-width="778" 
chart-color="rgba(99,99,99,0.3)"

The data that fills the chart is passed by reference to the directive from the scope of the parent controller defined by the ng-model attribute.

// Controller File
app.controller('someCtrl', ['$scope', function($scope){
  $scope.someData = [12, 15, 36, 8, 14, 20, 45, 18, 20, 27, 37, 48, 60, 30, 55, 80];
}]);

// View
<div bar-chart ng-model="someData"></div>

angular-barchart's People

Contributors

ecwillis avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

angular-barchart's Issues

support passing in a collection

I want to be able to pass in something like this:

[ { name: 'blah', value: 1 }, { name: 'blah2', value: 10 }...]

so detect if its an object and then add another directive attribute to tell it which key to read off of, in this case "value"

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.