I've seen plotly charts in linqpad, but I'm trying to create a simple chart.js example. Can't seem to do it. Has anyone tried successfully?
(this was what I tried but didn't work)
I'm certainly not an expert, but the following works for me
var html = """ <div> <canvas id="myChart"></canvas> </div> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> 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 } } } }); </script> """; new LINQPad.Controls.IFrame(html, width:"50%" ).Dump();
and produces
Thank you sgmoore! That made my day!
Comments
(this was what I tried but didn't work)
I'm certainly not an expert, but the following works for me
and produces

Thank you sgmoore! That made my day!