Home forums Using CanvasJS Uncaught TypeError at array[1].push

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26780

    When the index for array becomes 1 it throws err UncaughtTypeError Cannot read property ‘push’ of undefined.

    <c:forEach items="${dataPointsList}" var="dataPoints" varStatus="loop">	
    	<c:forEach items="${dataPoints}" var="dataPoint">
    		xValue = parseInt("${dataPoint.x}");
    		yValue = parseFloat("${dataPoint.y}");
    		label = "${dataPoint.label}";
    		indexLabel = "${dataPoint.indexLabel}";
    		dps[parseInt("${loop.index}")].push({
    			x : xValue,
    			y : yValue
    		});		
    	</c:forEach>	
    </c:forEach>

    dps[parseInt(“1”)].push({
    x : xValue,
    y : yValue
    });

    #26839

    @krishnansa01,

    Can you kindly create JSFiddle reproducing the issue you are facing so that we can look into the code, understand the scenario better and help you resolve the same?

    In order to help us in understanding the issue, please have a reproducible demo of your chart. This one step can assure you a speedy response. Fork out our template JSFiddle and reproduce the chart at your end. Try to keep it to the bare minimum by removing unnecessary code.

    From what we have observed, sometimes things get delayed mostly when we are not able to reproduce the issue or not able to understand the exact requirements or the solution that we provide may not work properly due to the variation in chart-options being used by you and us.

    Having a JSFiddle helps us in figuring out the issue and many a time we can just edit your code on JSFiddle to fix the issue right away.


    Shashi Ranjan
    Team CanvasJS

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

You must be logged in to reply to this topic.