Lightweight, configurable and simple bar chart library in JS
barChartJS is a Canvas based simple Javascript Bar Chart Library to provide a configurable, lightweight and dependency-free experience.
Download the barChart.min.js
and include it in your project
<script src="barChart.min.js"></script>
To create the bar chart, you need a block level container like a div or p.
<div id="chart">This will be bar chart!</div>
Then you can create the BarChart object in your JavaScript file
const bacrChart = new BarChart(chartId, chartWidth, chartHeight, data);
-
chartId - containerId (String)
Defines the id of container like "chart" -
chartWidth (Interger)
Define the width of the chart like 500 -
data (Objects Array)
Defines the data objects. The objects should have 2 key-value pairs: label and value. Example data:
const data = [
{ label: "Jan", value: 23 },
{ label: "Feb", value: 11 },
{ label: "Mar", value: 55 },
{ label: "Apr", value: 893 },
{ label: "May", value: 343 }
];