canvasjs-dashboard-samples/assets/web-analytics/real-time.js
// update "Page Views Per Second" chart every second and "Page Views Per Minute" chart every minute

update "Page Views Per Second" chart every second and "Page Views Per Minute" chart every minute
update " Page Views Per Second " chart every second and " Page Views Per Minute " chart every minute
function updatePageViewsCharts() {
		var time1, time2;
		time1 = new Date();
		time1.setMilliseconds(0);
		yValuePageViewsPerSecond = generateRandomNumber(pageViewsPerSecondLowerLimit, pageViewsPerSecondUpperLimit); 
		pageViewsPerSecondDataPoints.push({ x: time1, y: yValuePageViewsPerSecond });
    if (pageViewsPerSecondDataPoints.length > 60)
    	pageViewsPerSecondDataPoints.shift();
		pageViewsPerSecondColumnChart.render();		
    sumYValuePageViewsPerSecond += yValuePageViewsPerSecond;
		if (numberOfSeconds >= 60) {
			time2 = new Date();
			time2.setSeconds(0);
    	pageViewsPerMinuteDataPoints.push({ x: time2, y: sumYValuePageViewsPerSecond });
			if (pageViewsPerMinuteDataPoints.length > 60) 
				pageViewsPerMinuteDataPoints.shift();
      pageViewsPerMinuteColumnChart.render();
			sumYValuePageViewsPerSecond = 0;
      numberOfSeconds = 0;
    }
    numberOfSeconds++;
}
function updatePageViewsCharts ( ) { var time1 , time2 ; time1 = new Date ( ) ; time1 . setMilliseconds ( 0 ) ; yValuePageViewsPerSecond = generateRandomNumber ( pageViewsPerSecondLowerLimit , pageViewsPerSecondUpperLimit ) ; pageViewsPerSecondDataPoints . push ( { x : time1 , y : yValuePageViewsPerSecond } ) ; if ( pageViewsPerSecondDataPoints . length > 60 ) pageViewsPerSecondDataPoints . shift ( ) ; pageViewsPerSecondColumnChart . render ( ) ; sumYValuePageViewsPerSecond += yValuePageViewsPerSecond ; if ( numberOfSeconds >= 60 ) { time2 = new Date ( ) ; time2 . setSeconds ( 0 ) ; pageViewsPerMinuteDataPoints . push ( { x : time2 , y : sumYValuePageViewsPerSecond } ) ; if ( pageViewsPerMinuteDataPoints . length > 60 ) pageViewsPerMinuteDataPoints . shift ( ) ; pageViewsPerMinuteColumnChart . render ( ) ; sumYValuePageViewsPerSecond = 0 ; numberOfSeconds = 0 ; } numberOfSeconds ++ ; }
update "Page Views Per Second" chart every second and "Page Views Per Minute" chart every minute
update " Page Views Per Second " chart every second and " Page Views Per Minute " chart every minute