{"action":"created","issue":{"url":"https://api.github.com/repos/krispo/angular-nvd3/issues/37","labels_url":"https://api.github.com/repos/krispo/angular-nvd3/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/krispo/angular-nvd3/issues/37/comments","events_url":"https://api.github.com/repos/krispo/angular-nvd3/issues/37/events","html_url":"https://github.com/krispo/angular-nvd3/issues/37","id":42757573,"number":37,"title":"Refresh the view on data  change","user":{"login":"vayias","id":4191510,"avatar_url":"https://avatars.githubusercontent.com/u/4191510?v=3","gravatar_id":"","url":"https://api.github.com/users/vayias","html_url":"https://github.com/vayias","followers_url":"https://api.github.com/users/vayias/followers","following_url":"https://api.github.com/users/vayias/following{/other_user}","gists_url":"https://api.github.com/users/vayias/gists{/gist_id}","starred_url":"https://api.github.com/users/vayias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vayias/subscriptions","organizations_url":"https://api.github.com/users/vayias/orgs","repos_url":"https://api.github.com/users/vayias/repos","events_url":"https://api.github.com/users/vayias/events{/privacy}","received_events_url":"https://api.github.com/users/vayias/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2014-09-15T10:10:04Z","updated_at":"2015-11-25T07:30:01Z","closed_at":null,"body":"Hi krispo,\r\n\r\nI was wondering if a simple view for a line chart like :\r\n    <div ng-controller=\"chartCtrl\">\r\n        <nvd3 options=\"options\" data=\"data\"></nvd3>\r\n    </div>\r\n\r\nwould refresh(redraw new graph) if the data changes.\r\n\r\nIf no, is there is any way to do it?"},"comment":{"url":"https://api.github.com/repos/krispo/angular-nvd3/issues/comments/159524776","html_url":"https://github.com/krispo/angular-nvd3/issues/37#issuecomment-159524776","issue_url":"https://api.github.com/repos/krispo/angular-nvd3/issues/37","id":159524776,"user":{"login":"fayyazurrehman","id":7439984,"avatar_url":"https://avatars.githubusercontent.com/u/7439984?v=3","gravatar_id":"","url":"https://api.github.com/users/fayyazurrehman","html_url":"https://github.com/fayyazurrehman","followers_url":"https://api.github.com/users/fayyazurrehman/followers","following_url":"https://api.github.com/users/fayyazurrehman/following{/other_user}","gists_url":"https://api.github.com/users/fayyazurrehman/gists{/gist_id}","starred_url":"https://api.github.com/users/fayyazurrehman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fayyazurrehman/subscriptions","organizations_url":"https://api.github.com/users/fayyazurrehman/orgs","repos_url":"https://api.github.com/users/fayyazurrehman/repos","events_url":"https://api.github.com/users/fayyazurrehman/events{/privacy}","received_events_url":"https://api.github.com/users/fayyazurrehman/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T07:30:01Z","updated_at":"2015-11-25T07:30:01Z","body":"i have tried . this is my example code\n\n<!DOCTYPE html>\n<head>\n<meta charset=\"utf-8\">\n<script src=\"bower_components/angular/angular.js\"></script>\n<script src=\"bower_components/d3/d3.js\"></script>\n<script src=\"bower_components/nvd3/build/nv.d3.js\"></script> <!-- or use\nanother assembly -->\n<script src=\"bower_components/angular-nvd3/dist/angular-nvd3.js\"></script>\n<link rel=\"stylesheet\" href=\"bower_components/nvd3/build/nv.d3.css\">\n<script >\nvar model = [{ \"date\": \"2012-01-12\", \"europe\": \"45\", \"asia\": \"40\",\n\"america\": \"60\" },\n            { \"date\": \"2012-01-19\", \"europe\": \"20\", \"asia\": \"35\",\n\"america\": \"70\" },\n            { \"date\": \"2012-01-25\", \"europe\": \"40\", \"asia\": \"45\",\n\"america\": \"62\" },\n            { \"date\": \"2012-02-12\", \"europe\": \"52\", \"asia\": \"40\",\n\"america\": \"65\" }\n            ];\nangular.module('myApp', ['nvd3'])\n\n\n    .controller('MainCtrl', function($scope) {\n        $scope.datalist = model;\n        $scope.RETRIEVE_DEFAULT_NR = 50;\n        $scope.state = {};\n        $scope.state.confList = [];\n        $scope.retrieveNr = $scope.RETRIEVE_DEFAULT_NR;\n\n        $scope.options={};\n         $scope.options1 = {\n            //d3.select(\"#nvd3\").selectAll(\"svg\").remove();\n            chart: {\n                type: 'lineChart',\n                height: 450,\n                margin : {\n                    top: 20,\n                    right: 20,\n                    bottom: 40,\n                    left: 40\n                },\n                //var parseDate = d3.time.format(\"%d-%b-%y\").parse;\n                x: function(d){ return d.x; },\n                y: function(d){ return d.y; },\n                useInteractiveGuideline: true,\n                dispatch: {},\n                xAxis: {\n                    axisLabel: 'Date (day-month-year)',\n                    tickFormat: function(d) {\n                        return d3.time.format('%d-%m')(new Date(d))\n                    },\n                    staggerLabels: false\n                },\n                yAxis: {\n                    axisLabel: 'Attendees (a)',\n                    tickFormat: function(d){\n                        //console.log(d);\n                        return d3.format('40')(d);\n                    },\n                    axisLabelDistance: -30\n                },\n                callback: function(chart){\n                    console.log(\"!!! lineChart callback !!!\");\n                }\n            },\n            title: {\n                enable: true,\n                text: 'Continent-wise Attendees list'\n            }\n        };\n\n        $scope.retrieveLastNItems = function(n) {\n\n          $scope.data = datAndAttendees($scope.datalist);\n        };\n\n        $scope.setAndRetrieveLastNItems = function(n) {\n            $scope.state.retrieveNr = n;\n            $scope.retrieveLastNItems($scope.retrieveNr);\n        };\n\n        $scope.addNewItem = function(datetxt,europetxt,asiatxt,americatxt) {\n          $scope.datalist.push({ date: datetxt, europe: europetxt, asia:\nasiatxt, america: americatxt});\n\n          var sdata=$scope.datalist;\n          console.log(sdata);\n          $scope.data = datAndAttendees(sdata);\n\n\n          };\n      console.log($scope.data);\n      $scope.options = $scope.options1;\n\n      //$scope.data = datAndAttendees($scope.datalist);\n\n      /*Random Data Generator */\n      function datAndAttendees(adata) {\n          //console.log(adata);\n          var europedata=[];\n          var asiadata=[];\n          var americadata=[];\n\n          var parseDate = d3.time.format(\"%Y-%m-%d\").parse;\n\n          //Data is represented as an array of {x,y} pairs.\n          for ( var i in adata) {\n              var ddate = parseDate(adata[i].date);\n\n              var deurope = adata[i].europe;\n              var dasia = adata[i].asia;\n              var damerica = adata[i].america;\n\n              //var dattendee = adata[i].attendee;\n              //d.date = parseDate(d.date);\n\n              //date.push({x:i, y:ddate});\n              europedata.push({x:ddate, y:deurope});\n              asiadata.push({x:ddate, y:dasia});\n              americadata.push({x:ddate, y:damerica});\n\n          }\n\n          //Line chart data should be sent as an array of series objects.\n          return [\n                {\n                  values: americadata,\n                  key: 'America',\n                  color: '#7777ff',\n                  area: true\n                },\n                {\n                  values: asiadata,\n                  key: 'Asia',\n                  color: '#2ca02c',\n                  area: true\n                },\n                {\n                  values: europedata,\n                  key: 'Europe',\n                  color: '#ff7f0e',\n                  area: true\n                }\n\n                ];\n      }\n\n    })\n</script\n\n</head>\n\n<body ng-app=\"myApp\" ng-controller=\"MainCtrl\">\n\n<div ng-init=\"setAndRetrieveLastNItems(15)\" style=\"margin: auto;\">\n\n    <div  class=\"col-md-2\">\n    </div>\n      <div style=\" margin: auto;\" class=\"col-md-8\">\n\n\n      <nvd3 options=\"options\" data=\"data\" api=\"api\" config=\"{deepWatchData:\ntrue}\"></nvd3>\n\n\n        <form ng-submit=\"addNewItem(datetxt,europetxt,asiatxt,americatxt)\">\n          <fieldset>\n            <input type=\"text\" placeholder=\"Add date\" size=10\nng-model=\"datetxt\" />\n            <input type=\"text\" placeholder=\"Add europe\" size=5\nng-model=\"europetxt\" />\n            <input type=\"text\" placeholder=\"Add asia\" size=5\nng-model=\"asiatxt\" />\n            <input type=\"text\" placeholder=\"Add america\" size=5\nng-model=\"americatxt\" />\n            <button class=\"btn btn-primary\">Add item</button>\n          </fieldset>\n        </form>\n\n        <table class=\"table table-striped\" >\n          <thead>\n            <tr>Date</tr>\n            <tr>Europe</tr>\n            <tr>Asia</tr>\n            <tr>America</tr>\n          </thead>\n          <tbody>\n            <tr ng-repeat=\"item in datalist\">\n              <td>{{ item.date }}</td>\n              <td>{{ item.europe }}</td>\n              <td>{{ item.asia }}</td>\n              <td>{{ item.america }}</td>\n            </tr>\n          </tbody>\n        </table>\n\n    </div>\n  <div  class=\"col-md-2\">\n  </div>\n</div>\n\n\n</body>\n\n\n\n\nBest Regards,\n\nFayyaz Ur Rehman,\n\nOn Wed, Nov 25, 2015 at 12:06 PM, krispo <notifications@github.com> wrote:\n\n> @fayyazurrehman <https://github.com/fayyazurrehman> , currently try to\n> use deepWatchData: true in config (for the latest versions). We set this\n> to false by default due to some performance issues, so the charts are\n> static by default. But I find that a lot of people suffer from this and got\n> another questions.. So, we are likely to go back to dynamic charts by\n> default. I'm working on this.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/krispo/angular-nvd3/issues/37#issuecomment-159521698>.\n>\n"}}