White Arrow icon
Back to all Elements

Chart.js in Webflow

A short tutorial on how to implement a Chart.js plugin in a Webflow project

1. Add the chart.js file to the project. Best is in the page/projects custom code section, before </body> tag.

2. Initiate a canvas with <canvas> tags (HTML embed widget)

3. Call the chart.js and configure options.

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.js"></script>

<canvas id="myChart" width="400" height="400"></canvas>

<script>

 

 var ctx = document.getElementById('myChart');

 var myChart = new Chart(ctx, {

   type: 'bar',

   data: {

     labels: ["1st", "2nd", "3rd", "4th", "5th"],

     datasets: [{

       label: 'Some Label',

       data: [10, 20, 30, 40, 50],

       backgroundColor: ["white", "#A5DBFF", "#B6E5F9", "#D1F0FF", "#8ED3FF"],

     }]

   },

 });

</script>

Copy


Preview:

browser mockup
Share:
Heart icon

Michael's Vsauce was my gateway Youtube channel to the world of fun educational vlogs. This was the 1st video I stumbled upon.

Might also interest you:

Symbol in RichText

Cloneable
CMS
Code

Insert a symbol element into a RichText. On a static or dynamic page.

Read more
Blue arrow iconWhite Arrow icon

Round Scroll Indicator / Progress Bar

Cloneable
Interactions
Animation

A round scroll indicator mad with Webflow elements and interactions

Read more
Blue arrow iconWhite Arrow icon

Pass Parameters

Cloneable
Code

Pass input fields parameters and add them to the destination URL.

Read more
Blue arrow iconWhite Arrow icon