Daily Graph is a lightweight JavaScript library to create a daily activity chart that looks and behaves similar to the GitHub contribution graph.
Install the package via npm:
npm install daily-activity-graph
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();
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).
Render the graph in the DOM.
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).
We appreciate all contributions! If you'd like to contribute, feel free to open a pull request.
MIT