Last active
October 7, 2020 17:25
-
-
Save stungeye/278cc02fa670e3b5ffda31f546905d3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
border: 1px solid grey; | |
font-family: Century Gothic, CenturyGothic, AppleGothic, sans-serif; | |
margin: 2rem auto; | |
padding-bottom: 2rem; | |
text-align: center; | |
width: 500px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Modules with Parcel</title> | |
<link rel="stylesheet" href="index.css"> | |
</head> | |
<body> | |
<h1>Items in Bag of Holding</h1> | |
<!-- Javascript will target this canvas element and display a chart. --> | |
<canvas id="chart"></canvas> | |
<!-- Load the Javascript at the end of the body tag so that DOM is ready when script runs. --> | |
<script src="./index.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import from the chart.js npm module. | |
import { Chart } from "chart.js"; | |
// Get the context of the canvas element in our HTML file. | |
let ctx = document.querySelector("canvas").getContext("2d"); | |
// Create a pie chart showing the contents of our bag of holding. | |
new Chart(ctx, { | |
type: "pie", | |
data: { | |
labels: ["🏺 Amphora", "📜 Scrolls", "🗡️ Daggers"], | |
datasets: [ { data: [12, 19, 3], backgroundColor: ["#ff6384", "#36a2eb", "#ffce56"] } ] | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment