1.0.1 • Published 10 months ago

daily-activity-graph v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

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 a date (Date object or string) and a count (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 a date (Date object or string) and a count (number).

Contributing

We appreciate all contributions! If you'd like to contribute, feel free to open a pull request.

License

MIT