Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <!--Import Google Icon Font-->
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
 <!-- Chart JS -->
  <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
  <title>Document</title>
</head>

<body>
  <div class="container">
    <h3>Modal</h3>

    <a href="#chart1" class="btn orange modal-trigger">Open Modal</a>
    <a href="#chart2" class="btn orange modal-trigger">Open Modal</a>

    <div id="chart1" class="modal">
      <div class="modal-content">
         <canvas class="chart" id="myChart-1"></canvas>
      <div class="modal-footer">
        <a href="#" class="modal-close btn orange">Agree & Close</a>
      </div>
    </div>
    </div>
    <div id="chart2" class="modal">
      <div class="modal-content">
         <canvas class="chart" id="myChart-2"></canvas>
      <div class="modal-footer">
        <a href="#" class="modal-close btn orange">Agree & Close</a>
      </div>
  </div>
  <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

  <script>
    $(document).ready(function() {
      $('#chart1').modal();
      $('#chart2').modal();
    })
  </script>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                let canvas1 = document.getElementById('myChart-1').getContext('2d');

let chart1 = new Chart(canvas1, {
    // The type of chart we want to create
    type: 'line',

    // The data for our dataset
    data: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
        datasets: [{
            label: 'My First dataset',
            backgroundColor: 'rgb(255, 99, 132)',
            borderColor: 'rgb(255, 99, 132)',
            data: [0, 10, 5, 2, 20, 30, 45]
        }]
    },

    // Configuration options go here
    options: {}
});

let canvas2 = document.getElementById('myChart-2').getContext('2d');

let chart2 = new Chart(canvas2, {
    // The type of chart we want to create
    type: 'line',

    // The data for our dataset
    data: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
        datasets: [{
            label: 'My First dataset',
            backgroundColor: 'rgb(255, 99, 132)',
            borderColor: 'rgb(255, 99, 132)',
            data: [0, 10, 5, 20, 20, 40, 45]
        }]
    },

    // Configuration options go here
    options: {}
});
              
            
!
999px

Console