Your best bet would be to create an HTML file and add the example code into it. Then, you can simply open the HTML file in your browser for visualization. Using Chart.js framework is key here, so make sure to include it in your HTML file like this:
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
Here's a snippet of how your HTML file structure should look:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="container">
<div class="row my-3">
<div class="col">
<h4>Bootstrap 4 Chart.js</h4>
</div>
</div>
<div class="row my-2">
<div class="col-md-6 py-1">
<div class="card">
<div class="card-body">
<canvas id="chLine"></canvas>
</div>
</div>
</div>
<div class="col-md-6 py-1">
<div class="card">
<div class="card-body">
<canvas id="chBar"></canvas>
</div>
</div>
</div>
</div>
<div class="row py-2">
<div class="col-md-4 py-1">
<div class="card">
<div class="card-body">
<canvas id="chDonut1"></canvas>
</div>
</div>
</div>
<div class="col-md-4 py-1">
<div class="card">
<div class="card-body">
<canvas id="chDonut2"></canvas>
</div>
</div>
</div>
<div class="col-md-4 py-1">
<div class="card">
<div class="card-body">
<canvas id="chDonut3"></canvas>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<script>
// Your Chart.js code goes here
</script>
</body>
</html>
You can also check the separated code blocks for reference:
// Your Chart.js code examples go here
<div class="container">
<!-- Your chart elements go here -->
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>