Good evening, friends,
I had a javascript code extract using JSP tags that generated a pie chart and it works correctly. I now need to migrate to Thymeleaf and I have no idea how to write the code. The javascript code with the JSP looks like this:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><scripttype="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChartPie);
function drawChartPie() {
var data = google.visualization.arrayToDataTable([
['Conta', 'Valor'],
<c:forEach items="${model.contaCorretora }" var="contaCorretora">
['${contaCorretora.tipoConta}', ${contaCorretora.valorAtual}],
</c:forEach>
]);
var options = {
title: '${model.pessoa.nome }'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>