How to get the N latest data and display that in the angularjs nvd3 stacked area chart

I'm using angularjs-nvd3-directives to create stacked area chart.Now my problem is I'm polling hundreds of data from server and I need to display on the the N latest data. How will I do that? Here's the HTML file<div ng-controller="GraphController as viewAll"> <nvd3-stacked-area-chart data="viewAll.data" id="graph" showXAxis="true" showYAxis="true" showLegend="true" interactive="true" tooltips="true" forcex="[xFunction()]"> <svg></svg> </nvd3-stacked-area-chart> </div>...Read more