1
Good evening friends,
I had a javascript code extract using JSP tags that generated a pizza chart and works correctly. Now I need to migrate to Thymeleaf and I have no idea how to write the code. The javascript code with JSP is like this:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="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>