Hello altogether!
I’m trying to implement some charts into a screen. For a first step I set up these lines, putting all the required code into one htmlBox.
The code works fine when loaded into my browser directly from file.
JMix shows up all the code, but only a blank canvas area. No charts.
The ‘alert’ command is fired, so for this swift test, the script block should be working…
Here’s the code:
<div>
<canvas id="myChart" width="800" height="400"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script>
<script type="text/javascript">
alert("Hallo1");
var ctx = document.getElementById('myChart');
var stars = [135850, 52122, 148825, 16939, 9763];
var frameworks = ['React', 'Angular', 'Vue', 'Hyperapp', 'Omi'];
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: frameworks,
datasets: [{
label: 'Github Stars',
data: stars
}]
},
})
</script>
]]>
</templateContents>
</htmlBox>
Thanks for all your ideas.
Maybe one question on top, for instance it might be necessary to have the block set in the area of the later html output. How could this be done?
Thanks in advance,
HP