Code review comment for lp:~allanlesage/qa-coverage-dashboard/initial-mega-merge

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

move this out of the html, it's using a lot of the same code

467 +<script type="text/javascript">
468 + d3.json('{% url "gaps_api_project" project.name %}', function(data) {
469 + nv.addGraph(function() {
470 + var chart = nv.models.lineChart()
471 + .width(1100).height(400);
472 + chart.forceY([0, 1]);
473 + chart.xAxis
474 + .axisLabel('Date')
475 + .tickFormat(function(d){return d3.time.format('%Y%m%d')(new Date(d * 1000));})
476 +
477 + chart.yAxis
478 + .axisLabel('%')
479 + .tickFormat(d3.format('%'))
480 + d3.select('#line-chart svg').datum(data).transition().duration(500).call(chart);
481 +
482 + nv.utils.windowResize(chart.update);
483 +
484 + return chart;
485 + });
486 + });
487 +</script>

640 +<script type="text/javascript">
641 + d3.json('{% url 'gaps_api_stack' stack.name %}', function(data) {
642 + nv.addGraph(function() {
643 + var chart = nv.models.lineChart()
644 + .width(900).height(400);
645 + chart.forceY([0, 1]);
646 + chart.xAxis
647 + .axisLabel('Date')
648 + .tickFormat(function(d){return d3.time.format('%Y%m%d')(new Date(d * 1000));})
649 + chart.yAxis
650 + .axisLabel('%')
651 + .tickFormat(d3.format('%'))
652 + d3.select('#line-chart svg').datum(data).transition().duration(500).call(chart);
653 + nv.utils.windowResize(chart.update);
654 + return chart;
655 + });
656 + });
657 +</script>

758 +<script type="text/javascript">
759 + d3.json('{% url 'gaps_api_stack_list' %}', function(data) {
760 + nv.addGraph(function() {
761 + var chart = nv.models.lineChart()
762 + .width(900).height(400);
763 + chart.forceY([0, 1]);
764 + chart.xAxis
765 + .axisLabel('Date')
766 + .tickFormat(function(d){return d3.time.format('%Y%m%d')(new Date(d * 1000));})
767 + chart.yAxis
768 + .axisLabel('%')
769 + .tickFormat(d3.format('%'))
770 + d3.select('#line-chart svg').datum(data).transition().duration(500).call(chart);
771 + nv.utils.windowResize(chart.update);
772 + return chart;
773 + });
774 + });
775 +</script>

Can we move the properties in the model to the api?

« Back to merge proposal