Giter VIP home page Giter VIP logo

angular-cal-heatmap-directive's Introduction

#Cal Heatmap AngularJS Directive#

This is an AngularJS directive for cal-heatmap http://kamisama.github.io/cal-heatmap/

##How to use it##

Use bower to install the library

$ bower install angular-cal-heatmap-directive

Create an index.html as shown below.

<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF8">
	<title>Angular Cal Heatmap directive</title>
	<link rel="stylesheet" type="text/css" href="bower_components/cal-heatmap/cal-heatmap.css">
</head>
<body ng-app="myapp">

<cal-heatmap></cal-heatmap>

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/d3/d3.js"></script>
<script type="text/javascript" src="bower_components/cal-heatmap/cal-heatmap.js"></script>
<script type="text/javascript" src="bower_components/angular-cal-heatmap-directive/dist/1.3.0/calHeatmap.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>

</html>

The app.js is the application Angualar app. Add the dependency to the calHeatmap directive in the app.js as shown below.

angular.module('myapp',['calHeatmap']);

This will generate a default Cal Heatmap as shown below.

To add your own configuration, you can use config attribute as shown below.

<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF8">
	<title>Angular Cal Heatmap directive</title>
	<link rel="stylesheet" type="text/css" href="bower_components/cal-heatmap/cal-heatmap.css">
</head>
<body ng-app="myapp">

<cal-heatmap config="{domain:'year',range:1,cellSize:15}"></cal-heatmap>

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/d3/d3.js"></script>
<script type="text/javascript" src="bower_components/cal-heatmap/cal-heatmap.js"></script>
<script type="text/javascript" src="bower_components/angular-cal-heatmap-directive/dist/1.3.0/calHeatmap.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>

</html>

This will produce the heatmap as shown below.

This directive supports most of the options supported by cal-heatmap library http://kamisama.github.io/cal-heatmap/#options

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.