daily-activity-graph
v1.0.1
Published
graph to display daily activity
Downloads
1
Readme
Daily Activity Graph
Daily Graph is a lightweight JavaScript library to create a daily activity chart that looks and behaves similar to the GitHub contribution graph.
Table of Contents
Installation
Install the package via npm:
npm install daily-activity-graph
Usage
First, include the Daily Graph library in your JavaScript file:
import DailyGraph from "daily-activity-graph";
Next, create a new instance of DailyGraph
:
const data = [...] // your data
const chart = new DailyGraph('.chart-container', data);
You can then call the render()
method to display the chart:
chart.render();
API
new DailyGraph(selector, data)
Create a new DailyGraph instance.
selector
(String): The CSS selector of the DOM element where the graph will be inserted.data
(Array): An array of objects, each representing one day of activity data. Each object should have adate
(Date object or string) and acount
(number).
DailyGraph.render()
Render the graph in the DOM.
DailyGraph.update(data)
Update the graph with new data.
data
(Array): An array of objects, each representing one day of activity data. Each object should have adate
(Date object or string) and acount
(number).
Contributing
We appreciate all contributions! If you'd like to contribute, feel free to open a pull request.
License
MIT