<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<style>
body {
height: 90vh;
background-color: rgb(239, 237, 237);
display: flex;
justify-content: center;
align-items: center;
}
.chart-container {
width: 700px;
display: flex;
}
.small-column {
width: 40px;
}
.large-column {
max-width: 700px;
overflow-x: scroll;
}
.container {
width: calc(1000px - 40px);
height: 500px;
}
</style>
<title>Document</title>
</head>
<body>
<div class="chart-box">
<div class="chart-container">
<div class="small-column">
<canvas id="mySecondChart"></canvas>
</div>
<div class="large-column">
<div class="container">
<canvas id="myChart"></canvas>
</div>
</div>
</div>
</div>
<script src=
"https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'line',
data: {
labels: ['Python', 'JavaScript', 'C++', 'C', 'Java', 'PHP'],
datasets: [{
label: 'Percentage (%)',
data: [49, 63, 22, 19, 30, 19],
borderColor: 'green',
fill: false,
}]
},
options: {
maintainAspectRatio: false,
layout: {
padding: {
top: 11
}
},
plugins: {
legend: {
display: false
}
},
scales: {
y: {
ticks: {
display: false
},
border: {
display: false
}
}
}
}
});
const ctx2 = document.getElementById('mySecondChart');
new Chart(ctx2, {
type: 'line',
data: {
datasets: [{
data: [49, 63, 22, 19, 30, 19],
fill: false,
}]
},
options: {
maintainAspectRatio: false,
layout: {
padding: {
bottom: 36
}
},
plugins: {
legend: {
display: false
}
},
scales: {
x: {
ticks: {
display: false
},
gridLines: {
display: false
}
},
y: {
afterFit: (c) => {
c.width = 40;
}
}
}
}
});
</script>
</body>
</html>