@HTML5 @JavaScript
Simple vertical bar-charts visualizer
Download and import bar-chart.js into Project.
<script src="bar-chart.js"></script>
A block-level container like div is needed to visualize a bar-chart.
<div id="bar-chart"></div>
Create a BarChart object similar to the one below.
var chart = new BarChart(id, title, data)
chart.render()
-
id: String
the id attribute of the container -
title: String
bar-chart title -
data: Array({label: String, value: Number})
bar-chart data
<div id="p-table"></div>
let data = [
{label: 'Lithium', value: 6.9},
{label: 'Beryllium', value: 9.0},
{label: 'Boron', value: 10.8},
{label: 'Carbon', value: 12.0},
{label: 'Florine', value: 18.9},
]
var chart = new BarChart('p-table', 'Periodic Table', data)
chart.render()