I'm drawing a scatter plot using d3js and nvd3.js. To fetch and render the data I use:
var chart;
var data;
var url = window.location+"/data";
d3.json(url, function(error, json) {
if (error) return console.warn(error);
data = json;
nv.addGraph(function() {
chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.useVoronoi(true)
.color(d3.scale.category10().range())
.transitionDuration(300);
chart.xAxis.tickFormat(d3.format('.001f'));
chart.yAxis.tickFormat(d3.format('.02f'));
chart.tooltipContent(function(key){
var result = '<h2>'+ key + '</h2>';
return result;
});
d3.select('#div2 svg')
.datum(data)
.call(chart);
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { ('New State:', JSON.stringify(e)); });
return chart;
});
});
Unfortunately the server the data comes from takes up to 2 minutes to render all the data. So my function times out. How can I increase the timeout value, so the graph actually displays?