Forum Replies Created by souravndp

Viewing 2 posts - 1 through 2 (of 2 total)
  • in reply to: Need some help regarding my usage scenario #22695

    Thank you very much :) Now, its perfect. CanvasJS really has a great documentation and support. This topic can be closed.

    in reply to: Need some help regarding my usage scenario #22691

    I have solved 2 and 3.
    .toFixed converts the number to sting. so, the chart rendering fails.
    Also, the correct way to display a live data is to use shift method on the datapoint array. This is mentioned in the Docs

    But I am still struggling with the 1st issue. The first point has the correct time axis. Then, for 10 seconds some ms is getting displayed and then again correct date-time is being displayed.

    I am using the following hack to overcome this behavior. If the datapoint array length is 0, I am adding 2 more data points. 1. (x: 10 sec ago and y: 0) This does not look good because of the line continuity. Thus I am also adding 2. (x: 10 ms ago and y: 0)

    
    if(dataPoints1.length==0){
    		dataPoints1.push({
    		x: new Date(Date.now() - 10000),
    		y: 0
    		});
    	dataPoints2.push({
    		x: new Date(Date.now() - 10000),
    		y: 0
    		});
    		dataPoints1.push({
    		x: new Date(Date.now() - 100),
    		y: 0
    		});
    	dataPoints2.push({
    		x: new Date(Date.now() - 100),
    		y: 0
    		});
    	}
    

    correction

    • This reply was modified 6 years, 3 months ago by souravndp. Reason: added some more clarification
Viewing 2 posts - 1 through 2 (of 2 total)