• Stars
    star
    147
  • Rank 250,364 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A light weight and customizable version of GitHub's contribution graph

svelte-heatmap

Netlify Build status Dependencies Dev dependencies Size NPM License

A light weight and customizable version of GitHub's contribution graph.

Heatmap examples

📦 Installation

The recommended way to install this package is through NPM.

npm install svelte-heatmap

Alternatively, you may access it via the CDN. When using the CDN, this package will be exposed globally as SvelteHeatmap.

<script src="https://unpkg.com/svelte-heatmap"></script>

🚀 Basic usage

To create a heatmap, pass props and a target to the SvelteHeatmap constructor.

import SvelteHeatmap from 'svelte-heatmap';

const heatmap = new SvelteHeatmap({
    props: {
        data: [
            // ...
        ],
    },
    target: '#some-container',
});

To remove the component, call $destroy.

heatmap.$destroy();

See the Svelte documentation for more information.

⚙️ Options

Note: Date values for data, startDate, and endDate should be JavaScript Date objects objects, or a value compatible with the Date constructor.

allowOverflow

Renders cells that fall outside the startDate to endDate range. Defaults to false.

cellGap

Defines the space between cells.

cellRadius

Defines the radius of each cell. This should be a number relative to the cellSize, or a string representing a percentage such as '50%'.

cellSize

Defines the size of each cell.

colors

Array of CSS colors to use for the chart, ordered from lowest to highest. Default colors match GitHub's contribution graph with ['#c6e48b', '#7bc96f', '#239a3b', '#196127'].

data

Array of objects containing the chart data. These objects should be in the shape of { date, value }.

dayLabelWidth

Horizontal space to allocate for day labels. If this is 0, day labels will not be rendered.

dayLabels

Array of strings to use for day labels. Defaults to ['', 'Mon', '', 'Web', '', 'Fri', ''].

fontColor

Label font color. Defaults to #333.

fontFamily

Label font family. Defaults to sans-serif.

fontSize

Label font size. Defaults to 8.

emptyColor

CSS color to use for cells with no value.

monthGap

Defines the space between months when view is set to monthly.

monthLabelHeight

Vertical space to allocate for month labels. If this is 0, month labels will not be rendered.

monthLabels

Array of strings to use for month labels. Defaults to ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'].

startDate

Date object representing the first day of the graph. If omitted, this will default to the first day of the month or year, based on the current view.

endDate

Date object represending the last day of the graph. If omitted, this will default to the last day of the current month or year, depending on the current view.

view

Determines how the chart should be displayed. Supported values are monthly and yearly, defaults to yearly.

📄 License

MIT

Copyright (c) 2017-present, Scott Bedard

More Repositories

1

vuetober

A webpack starting point for single page apps with October CMS and Vue
JavaScript
243
star
2

oc-shop-plugin

An ecommerce platform for October CMS.
PHP
28
star
3

sveltober

Cybernetically enhanced October applications
JavaScript
19
star
4

vue-cli-plugin-moment

moment.js plugin for vue-cli
JavaScript
16
star
5

oc-webhooks-plugin

Integrate October applications with external services.
PHP
15
star
6

vuetober-spa

A single page application for October CMS, with the latest and greatest frontend
Vue
15
star
7

draganddrop

Drag and drop list re-ordering with OctoberCMS
HTML
14
star
8

oc-prerender-plugin

Prerendering plugin for October CMS
PHP
10
star
9

rainlab-user-api

A simple and extendable HTTP API for RainLab.User plugin
PHP
8
star
10

utils

A collection of utility types and functions
TypeScript
8
star
11

scottbedard.net

My personal code playground.
TypeScript
7
star
12

blogtags

Extends the RainLab.Blog plugin to allow for post tagging
PHP
7
star
13

oc-splitter-plugin

A/B split testing for October CMS
PHP
6
star
14

oc-useragent-plugin

Simple user agent detection for OctoberCMS.
PHP
6
star
15

vue-use-three

An experimental integration of Vue's composition API and Three.js
TypeScript
6
star
16

oc-stripe-plugin

Stripe integrations for October CMS
PHP
6
star
17

oc-socialite-plugin

Socialite API for RainLab.User
PHP
5
star
18

oc-shop-plugin-old

Currently being re-written, this version is not maintained
PHP
5
star
19

gradient

A customizable version of Stripe.com's background animation
JavaScript
4
star
20

oc-blogapi-plugin

A simple HTTP API for RainLab.Blog
PHP
4
star
21

analyticsextension

Custom Google Analytics widgets for OctoberCMS.
PHP
4
star
22

twister

Twisty puzzle state modeling
TypeScript
3
star
23

cube

A basic javascript class for modeling Rubik's cubes
JavaScript
3
star
24

tagbox

Not maintained
JavaScript
3
star
25

hexchess.rs

A Rust / TypeScript library for Gliński's hexagonal chess, and the brain of hexchess.club
Rust
3
star
26

vue-heatmap

Work in progress
JavaScript
2
star
27

oc-shop-spa

A single page application for Bedard.Shop
Vue
2
star
28

oc-backup-plugin

Automatically back up your October applications
PHP
2
star
29

warp-buttons

Button effects from Warp
HTML
2
star
30

gulp-octobercms

A gulp file for developing OctoberCMS themes
JavaScript
2
star
31

shipping

A simple PHP wrapper for USPS shipping calulations.
PHP
2
star
32

canvas-ribbon

A quick experiment with canvas elements
HTML
1
star
33

marionette-task

A simple task app with Marionette and Backbone
JavaScript
1
star
34

svelte-routing-bug

Demonstrating a Webpack issue with svelte-routing library
JavaScript
1
star
35

oc-vuetober-plugin

A starting point for javascript heavy October plugins.
JavaScript
1
star
36

oc-contact-plugin

A simple contact plugin for October CMS
PHP
1
star
37

vue-heatmap-old

A quick experiment with Vue.js
JavaScript
1
star
38

oc-uspsdriver-plugin

A USPS shipping driver for OctoberCMS
PHP
1
star
39

beeasyboards.com

A family of skateboarders, snowboarders, and dope people dedicated to cheap beer and good times!
Vue
1
star
40

oc-photography-plugin

PHP
1
star
41

warcraft

A nostalgic attempt to build a game from my childhood
HTML
1
star
42

vue-forward

The missing createApp function from Vue 2.7
TypeScript
1
star
43

pathfinder

TypeScript
1
star
44

vue-chrome

A starting point for Chrome extensions using Vue.js
JavaScript
1
star
45

rollup-karma-starter

JavaScript
1
star
46

oc-shop-theme

An example theme to test features for oc-shop-plugin
HTML
1
star
47

backbone-todo

Simple todo app to learn the basics of Backbone
JavaScript
1
star
48

oc-assetmonitor-plugin

Monitor the size of your an October theme's static assets.
PHP
1
star
49

oc-shop-api

JavaScript
1
star
50

minx

A model to represent the state of dodecahedral twisty puzzles
TypeScript
1
star