Home forums Using CanvasJS X Axis Data Consists of year and y consists of runs made by player

This topic contains 19 replies, has 3 voices, and was last updated by  Sunil Urs 1 year, 3 months ago.

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #10653

    Cameron
    Member

    Is it possible or not? that line draw on X-axis for value 0.

    #10655

    Sanjoy
    Moderator

    Cameron,

    Basically the value of log(0) is not defined and tends to -Infinity. So, if you put it in your logarithmic chart it will look like DataPoint at - Infity. Here to ignore such case I have mapped it’s value to null. But sill if you want to customise further you can edit convertToLog function as per your requirement. You can edit it like below

     function convertToLog(data){
        var dataPoints;
        for(var j= 0; j<data.length;j++){
            dataPoints = data[j].dataPoints;
            for(var i = 0; i< dataPoints.length; i++){
    			if(dataPoints[i].y > 0)
              		dataPoints[i].y = Math.log10(dataPoints[i].y);
    			else if(dataPoints[i].y === 0)
    				dataPoints[i].y = null; //update dataPoints[i].y as per your requirement (-Infinity)
    			else
    				dataPoints[i].y = null;
            }
         }
     }
    #10691

    Cameron
    Member

    Please check labels for X-Axis if width of window is maximum then it display two times year.
    Error when map size increases for X-Axis labels.

    • This reply was modified 1 year, 6 months ago by  Cameron.
    #11017

    Sanjoy
    Moderator

    Cameron,

    Setting valueFormatString to “####” will round-off all the intermediate values. So, here 2006.5 will appear as 2007 and so on.
    To avoid this issue you can set interval to 1.

    #11972

    Sunil Urs
    Keymaster

    [Update]: We have just released v1.9.0 with Logarithmic Axis. Please checkout gallery page for Logarithmic Scale.

Viewing 5 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic.