Home Forums Chart Support Transform jstl view code to thymeleaf code

Transform jstl view code to thymeleaf code

Viewing 4 posts - 1 through 4 (of 4 total)
  • #21956

    Hello everybody,

    I’m using Thymeleaf template in place of jsp and i woul like to convert this code of the view in thymeleaf code .

    thank you in advance for any advice

    <!-- chart.jsp-->
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <script type="text/javascript">
    window.onload = function() {
    var dps = [[]];
    var chart = new CanvasJS.Chart("chartContainer", {
    	exportEnabled: true,
    	animationEnabled: true,
    	theme: "light2", // "light1", "dark1", "dark2"
    	title: {
    		text: "Visitor Demographics of a Website"
    	subtitles: [{
    		text: "Age Groups of Visitors"
    	data: [{
    		type: "pie",
    		yValueFormatString: "#,##0\"%\"",
    		indexLabel: "{label} - {y}",
    		dataPoints: dps[0]
    var yValue;
    var label;
    <c:forEach items="${dataPointsList}" var="dataPoints" varStatus="loop">
    	<c:forEach items="${dataPoints}" var="dataPoint">
    		yValue = parseFloat("${dataPoint.y}");
    		label = "${dataPoint.label}";
    			label : label,
    			y : yValue,
    <div id="chartContainer" style="height: 370px; width: 100%;"></div>
    <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>



    Please take a look at this sample project for integrating CanvasJS in Spring MVC web-project that uses Thymeleaf template engine as view layer.

    CanvasJS Chart in Thymeleaf

    Also, check out this thread for more information.

    Priyanka M S
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.