chart_footer.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. chart.x(function(datum){ return datum.r; })
  7. .xAxis.options({
  8. axisLabel: customSettings.XLABEL || 'Changeset',
  9. tickFormat: d3.format('.0f')
  10. });
  11. chart.xAxis
  12. .tickValues(changesets_count)
  13. .tickFormat(function(d){return changesets[d]})
  14. .rotateLabels(-90);
  15. chart.y(function(datum){ return datum.v; })
  16. .yAxis.options({
  17. axisLabel: customSettings.YLABEL || 'GFlops'/*,
  18. tickFormat: function(val){ return d3.format('.0f')(val) + ' GFlops'; }*/
  19. });
  20. chart.tooltip.headerFormatter(function(d) { return changesets[d]
  21. + ' <p style="font-weight:normal;text-align: left;">'
  22. + changesets_details[d] + "</p>"; });
  23. //chart.useInteractiveGuideline(true);
  24. d3.select('#chart').datum(data).call(chart);
  25. var plot = d3.select('#chart > g');
  26. /* setup the title */
  27. plot.append('text')
  28. .style('font-size', '24px')
  29. .attr('text-anchor', 'middle').attr('x', '50%').attr('y', '20px')
  30. .text(customSettings.TITLE || '');
  31. /* ensure the chart is responsive */
  32. nv.utils.windowResize(chart.update);
  33. </script>
  34. </body>
  35. </html>