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
move this out of the html, it's using a lot of the same code
467 +<script type="text/ javascript" > function( ) { lineChart( ) 1100).height( 400); function( d){return d3.time. format( '%Y%m%d' )(new Date(d * 1000));}) d3.format( '%')) '#line- chart svg').datum( data).transitio n().duration( 500).call( chart); windowResize( chart.update) ;
468 + d3.json('{% url "gaps_api_project" project.name %}', function(data) {
469 + nv.addGraph(
470 + var chart = nv.models.
471 + .width(
472 + chart.forceY([0, 1]);
473 + chart.xAxis
474 + .axisLabel('Date')
475 + .tickFormat(
476 +
477 + chart.yAxis
478 + .axisLabel('%')
479 + .tickFormat(
480 + d3.select(
481 +
482 + nv.utils.
483 +
484 + return chart;
485 + });
486 + });
487 +</script>
640 +<script type="text/ javascript" > function( ) { lineChart( ) 900).height( 400); function( d){return d3.time. format( '%Y%m%d' )(new Date(d * 1000));}) d3.format( '%')) '#line- chart svg').datum( data).transitio n().duration( 500).call( chart); windowResize( chart.update) ;
641 + d3.json('{% url 'gaps_api_stack' stack.name %}', function(data) {
642 + nv.addGraph(
643 + var chart = nv.models.
644 + .width(
645 + chart.forceY([0, 1]);
646 + chart.xAxis
647 + .axisLabel('Date')
648 + .tickFormat(
649 + chart.yAxis
650 + .axisLabel('%')
651 + .tickFormat(
652 + d3.select(
653 + nv.utils.
654 + return chart;
655 + });
656 + });
657 +</script>
758 +<script type="text/ javascript" > stack_list' %}', function(data) { function( ) { lineChart( ) 900).height( 400); function( d){return d3.time. format( '%Y%m%d' )(new Date(d * 1000));}) d3.format( '%')) '#line- chart svg').datum( data).transitio n().duration( 500).call( chart); windowResize( chart.update) ;
759 + d3.json('{% url 'gaps_api_
760 + nv.addGraph(
761 + var chart = nv.models.
762 + .width(
763 + chart.forceY([0, 1]);
764 + chart.xAxis
765 + .axisLabel('Date')
766 + .tickFormat(
767 + chart.yAxis
768 + .axisLabel('%')
769 + .tickFormat(
770 + d3.select(
771 + nv.utils.
772 + return chart;
773 + });
774 + });
775 +</script>
Can we move the properties in the model to the api?