I am looking for the best way to set nvd3 chart x domain to represent given period of time in real time line chart - for example last hour. In other words - I am adding new data (y is numeric value, x is timestamp) every second and I want x axis to show last hour of time. Currently I am updating forceX with every data update - it works, but seems very ineffective.
var startDate = (new Date()).getTime();
startDate = startDate-3600000;
options.chart.forceX = [startDate,new Date()];
data[0].values.push({x: new Date(), y: newValue});
api.update();
Is there a better way?