JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.0.0-alpha/Chart.js"></script>
<div id="con" style="position:relative;width:100%;">
<canvas id="chart"></canvas>
</div>
JavaScript
var ctx = document.getElementById("chart");
var usage = new Chart(ctx, {
data: {
labels: ['1', '2', '3', '4', '5', '6', '7'],
datasets: [
{
label: "Collaborations",
type: "bar",
backgroundColor: "light-gray",
barPercentage: 0.8,
data: [2, 4, 3, 3, 4, 5, 2], // nb. var activeCollab
},
{
label: "Collaborations",
type: "line",
borderColor: "black",
data: [22, 24, 23, 23, 14, 35, 22],
fill: false
},
]
},
options: {
title: {
display: true,
text: 'Collaborations'
},
scales: {
x: {
scaleLabel: {
display: true,
labelString: 'Daily'
}
},
y: {
max: 110,
min: 20,
id: 'COLLAB',
type: 'linear',
position: 'left',
scaleLabel: {
display: true,
labelString: 'Collaborations /u'
},
ticks: {
stepSize: 18, //(110 - 20)/5 to have 5 equal ranges
},
}
},
legend: {
display: false
},
hover: {
mode: 'new mode'
},
}
});