Hello @bartplessers,
First, you need to add an HTML-control into the form where the chart should be rendered with the content:
<canvas id="myChart"></canvas>
Next, add the code below to the JS editor. Note that the path in the require config must be without .js.
fd.spRendered(function(){
requirejs.config({
paths: {
chart: 'https://cdn.jsdelivr.net/npm/chart'
}
});
require(['chart'], function(Chart) {
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
})
})