Hey,
Sorry, I currently lack the time to give a proper tutorial
I can give you some snippets to help you a bit, but it doesn’t chart as-is:
<script src="https://cdnjs.cloudflare.com/ajax/libs/apexcharts/3.39.0/apexcharts.min.js" integrity="sha512-jZMUAHj0E1ZO8dGoWdvwCQ/bh4sefOi6lwM5XcjnpzyTfOc409SrdZAdbvum112UT1c/SqVSPZAzksUkxVcQ8w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/apexcharts/3.39.0/apexcharts.min.css" integrity="sha512-tJYqW5NWrT0JEkWYxrI4IK2jvT7PAiOwElIGTjALSyr8ZrilUQf+gjw2z6woWGSZqeXASyBXUr+WbtqiQgxUYg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
Where you want to place the chart, place this:
<div id="mychart1"></div>
<script>
function runChart() {
// ApexCharts stuff goes here - check their documentation
// var options = (...)
const chart = new ApexCharts(document.querySelector("#mychart1"), options);
chart.render();
}
</script>
To get the data of a server connect, use in Apex Charts options:
series: [
{
name: "My data 1",
data: dmx.parse("content.sc_mydata.data.mydata1"),
},
The data “mydata1” I believe it must be an array, so server-side you need to use the .flatten formatter after the DB query (use a Set Value)
To run the chart, use a Dynamic Event on your server connect, to run the Javascript function “runChart” we defined previously