0

I have a NVD3 graph displaying simple data set. I just want to draw a line over that graph with a different color(it's like a cut-off value , that will be x=5)

<meta http-equiv="content-type" content="text/html; charset=UTF8">
<script src="js/angular.js"></script>
<script src="js/d3.js"></script>
<script src="js/nv.d3.js"></script>
<script src="js/moment.js"></script>
<script src="../dist/angularjs-nvd3-directives.js"></script>
<link rel="stylesheet" href="stylesheets/nv.d3.css"/>
<script>
    var app = angular.module("nvd3TestApp", ['nvd3ChartDirectives']);

    function ExampleCtrl($scope){
        $scope.exampleData = [
            {
                "key": "Github Api Mean Web Response Time",
                "values": [[3,2],[4,6],[6,10],[2,6]]
            }]; 
    } 

</script>

<body ng-app='nvd3TestApp'>
  <div ng-controller="ExampleCtrl">
     <nvd3-line-chart
        data="exampleData"
        id="exampleId"
        width="1000"
        height="400"
        showXAxis="true"
        showYAxis="true" 
        margin="{left:50,top:50,bottom:50,right:50}"
        >
    <svg></svg>
    </nvd3-line-chart>

  </div>
</body>

Can anyone show me a way to add this vertical line to the graph I have now. It's better if we can add different color to that vertical line.

Note : this example I have is from here. It's lineChart.ticks.html

prime
  • 14,464
  • 14
  • 99
  • 131

1 Answers1

0

I found a way to do this like below.

<script>
    var app = angular.module("nvd3TestApp", ['nvd3ChartDirectives']);

    function ExampleCtrl($scope){
        $scope.exampleData = [
            {
                "key": "Github Api Mean Web Response Time",
                "values": [[3,2],[4,6],[6,10]]
            },
            {
                "key": "aaa",
                "values": [[5,0],[5,10]]
            }]; 
    } 

</script>

<body ng-app='nvd3TestApp'>

 <div ng-controller="ExampleCtrl">
  <nvd3-cumulative-line-chart
        data="exampleData"
        id="exampleId"
        width="1000"
        height="400"
        showXAxis="true"
        showYAxis="true" 
        margin="{left:50,top:50,bottom:50,right:50}"
        >
    <svg></svg>
  </nvd3-cumulative-line-chart>

 </div>

</body>
prime
  • 14,464
  • 14
  • 99
  • 131