1 /* setup the chart and its options */ 2 var chart = nv.models.lineChart() 3 .color(d3.scale.category10().range()) 4 .margin({left: 75, bottom: 100}) 5 .forceX([0]).forceY([0]); 6 7 chart.x(function(datum){ return datum.r; }) 8 .xAxis.options({ 9 axisLabel: customSettings.XLABEL || 'Changeset', 10 tickFormat: d3.format('.0f') 11 }); 12 chart.xAxis 13 .tickValues(changesets_count) 14 .tickFormat(function(d){return changesets[d]}) 15 .rotateLabels(-90); 16 17 chart.y(function(datum){ return datum.v; }) 18 .yAxis.options({ 19 axisLabel: customSettings.YLABEL || 'GFlops'/*, 20 tickFormat: function(val){ return d3.format('.0f')(val) + ' GFlops'; }*/ 21 }); 22 23 chart.tooltip.headerFormatter(function(d) { return changesets[d] 24 + ' <p style="font-weight:normal;text-align: left;">' 25 + changesets_details[d] + "</p>"; }); 26 27 //chart.useInteractiveGuideline(true); 28 d3.select('#chart').datum(data).call(chart); 29 var plot = d3.select('#chart > g'); 30 31 /* setup the title */ 32 plot.append('text') 33 .style('font-size', '24px') 34 .attr('text-anchor', 'middle').attr('x', '50%').attr('y', '20px') 35 .text(customSettings.TITLE || ''); 36 37 /* ensure the chart is responsive */ 38 nv.utils.windowResize(chart.update); 39 </script> 40 </body> 41</html> 42