jQuery Punchcard

GitHub inspired Punchcard,
as a jQuery plugin.

Intro

Knowing when the userbase access the app might save you from tough situations.
- What time is the best to publish the new version?
- When is the best time to send a newsletter to your users?

This jQuery plugin is inspired from GitHub punchcard for project's commits.
It is based on Eran Schoellhorn's work angular-punch-card.

Examples

Basic initialization.

Timezone

Installation

Include the script and stylesheet in the page:

<link rel="stylesheet" href="punchcard.min.css" />

<!-- Dependencies -->
<script src="jquery.min.js"></script>
<script src="moment.min.js"></script>
<script src="moment-timezone-with-data.min.js"></script>
            
<script src="punchcard.min.js" async></script>

This plugin is also registered under http://bower.io/ to simplify integration. Try:

npm install -g bower
bower install jquery-punchcard

Usage

Setting up a punchcard is fairly easy. The following snippet creates one:

<div id="punchcardExample"></div>
<script>
    $(document).ready(function () {
        $('#punchcardExample').punchcard({
            data: [
                [3, 0, 0, 1, 0, 0, 5, 5, 1, 2, 5, 0],
                [0, 0, 0, 0, 40, 35, 40, 0, 0, 1, 2, 1, 5],
                [0, 10, 0, 20, 0, 30, 0, 40, 0, 50, 0, 60],
                [3, 10],
                [0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 10, 0, 0, 10, 0, 10],
                [],
                [0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 0, 1]
            ],
            singular: 'login',
            plural: 'logins',
            timezones: ['local', 'utc', 'America/Los_Angeles'],
            timezoneIndex:0
        });
    });
</script>