Home forums Report Bugs where do I make mistakes?

This topic contains 3 replies, has 2 voices, and was last updated by  altayolcay 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19906

    altayolcay
    Member

    I make a mistake in the code somewhere. but I can not produce a solution. y axis time, x axis angle, y2 axis will get a percentage value. coding is on the following page.

    http://jsfiddle.net/5druj8br/25/

    #19908

    altayolcay
    Member

    I found the coding error. I still can not produce a solution. Maybe you can help? Error in the following encoding:

    createPareto();	
    function createPareto(){
    	var dps = [];
    	var yValue, yTotal = 0, yPercent = 0;
    
    	for(var i = 0; i < chart.data[0].dataPoints.length; i++)
          {
    		yTotal += chart.data[0].dataPoints[i].y; 
      }
      
    	for(var i = 0; i < chart.data[0].dataPoints.length; i++){
    		yValue = chart.data[0].dataPoints[i].y;
    		yPercent += (yValue /yTotal  * 100);
    		dps.push({label: chart.data[0].dataPoints[i].label, y: yPercent});
    	}
    	
    	chart.addTo("data",{type:"line", yValueFormatString: "0.##\"%\"", dataPoints: dps});
    	chart.data[1].set("axisYType", "secondary", false);
    	chart.axisY[0].set("maximum", yTotal);
    	chart.axisY2[0].set("maximum", 100);
    }
    #19912

    Indranil Deo
    Member

    @altayolcay,

    Please take a look at this updated jsfiddle.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19913

    altayolcay
    Member

    thank you so much. It was what I wanted. thank you.

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

You must be logged in to reply to this topic.