Skip to content

Commit

Permalink
Update 2023-11-15-data_visualization.markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
TripleYei authored Nov 15, 2023
1 parent c5cd06e commit 09993d4
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions _posts/2023-11-15-data_visualization.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Work with Data in D3
## Chart.js


Gráfico Barras
Pie Charts
~~~~
<!DOCTYPE html>
<html>
Expand All @@ -67,15 +67,20 @@ Gráfico Barras
<body>
<canvas id="myChart"></canvas>
<style>
canvas{
width: 100%;
max-width: 700px;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
type: 'pie',
data: {
labels: ['HTML', 'CSS', 'JS'],
datasets: [{
Expand All @@ -97,3 +102,49 @@ Gráfico Barras
</html>
~~~~


Bar Charts

~~~~
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<canvas id="myChart"></canvas>
<style>
canvas{
width: 100%;
max-width: 700px;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['HTML', 'CSS', 'JS'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
</body>
</html>
~~~~

0 comments on commit 09993d4

Please sign in to comment.