JSFiddle - React, Tailwind, and code Playground
by Osvaldo
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.bundle.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]" defer></script>
<div class="chart-container" style="position: relative; height:auto; width:100%">
<canvas id="line_chart_2" width="350" height="250"></canvas>
</div>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var ctx = document.getElementById("line_chart_2");
var line_chart_1 = new Chart(ctx, {
type: 'line',
data: {
labels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"],
datasets: [{
label: 'Humedad',
data: [20, 5, 19, 6, 21, 7, 21, 3, 13, 4, 20, 5, 19, 6, 21, 7, 21, 3, 13, 4],
borderColor: 'rgba(255, 77, 22, 1)',
backgroundColor: 'rgba(0,0,0,0)'
}]
},
options: {
title: {
display: true,
text: 'Inestabilidad / dinamismo',
fontSize: 16,
fontFamily: '"Work Sans",sans-serif',
fontColor: '#212529'
},
legend: {
display: true,
labels: {
fontName: '"Work Sans",sans-serif',
fontColor: '#212529',
fontSize: 13
}
},
elements: {
line: {
tension: 0, // disables bezier curves
}
},
layout: {
padding: {
bottom: 20
}
},
scales: {
yAxes: [{
ticks: {
...