GitHub PullRequestReviewCommentEvent at 2014-02-26 14:33:56
Repository: promdash
Actor: stuartnelson3
Payload: {"comment":{"url":"https://api.github.com/repos/prometheus/promdash/pulls/comments/10081126","id":10081126,"diff_hunk":"@@ -17,6 +22,65 @@ angular.module(\"Prometheus.directives\").directive('graphChart', [\"$location\", \"W\n         });\n       }\n \n+      function refreshGraph(graph, series) {\n+        // TODO\n+        // show legend\n+        // bevhaviorSeries leaks\n+        if (!graph || (series||[]).length === 0) {\n+          return;\n+        }\n+        graph.series.splice(0, graph.series.length)\n+\n+        // remove references that were causing leak in toggle\n+        // seems like one extra behaviorSeries lingers, but just one\n+        // clean up rickshaw library\n+        // element[0].querySelectorAll(\"span.label\").onclick = null\n+        // element[0].querySelectorAll(\"a.action\").onclick = null\n+\n+        $(element[0]).find(\".label, .action\").each(function() {\n+          this.onclick = null;\n+        });\n+        element[0].querySelector(\".legend ul\").innerHTML = \"\"\n+\n+        // BUG: If legend items have the same name, they are all assigned the\n+        // same color after resize\n+        // https://github.com/shutterstock/rickshaw/blob/master/src/js/Rickshaw.Series.js#L73\n+        // same obj is returned each time from itemByName()\n+        //\n+        // edited Rickshaw vendor file at comments /*stn*/\n+        // itemByName only served to change order of items in legend, so I removed it\n+        formatTimeSeries(series);\n+\n+        // TODO: need to calculate graph height after this has been set and loaded,\n+        // otherwise the legend height is incorrect\n+        // if (scope.graphSettings.legendSetting !== \"always\" ||\n+        //     (scope.graphSettings.legendSetting === \"sometimes\" && series.length > 6)) {\n+        //   series.forEach(function(serie) {\n+        //     serie.noLegend = true;\n+        //   });\n+        // }\n+\n+        var data = {items: series};\n+        graph.series.load(data);\n+        graph.configure({\n+          renderer: scope.graphSettings.stacked ? 'stack' : 'line'\n+        });\n+\n+        // PR to fix circular internal reference?\n+        behaviorSeries.graph = null;\n+        behaviorSeries.legend = null;\n+        behaviorSeries._addBehavior = null;\n+        behaviorSeries = null;","path":"app/assets/javascripts/angular/directives/graph_chart.js","position":71,"original_position":71,"commit_id":"287508742ac70b5c8a89338d3789b390b08a1da9","original_commit_id":"287508742ac70b5c8a89338d3789b390b08a1da9","user":{"login":"stuartnelson3","id":1398104,"avatar_url":"https://gravatar.com/avatar/c6e2bd81e1e4915e52fcd3ff67d35590?d=https%3A%2F%2Fidenticons.github.com%2F7d8a90c1ae50e8d0bbc8578d76a56ab9.png&r=x","gravatar_id":"c6e2bd81e1e4915e52fcd3ff67d35590","url":"https://api.github.com/users/stuartnelson3","html_url":"https://github.com/stuartnelson3","followers_url":"https://api.github.com/users/stuartnelson3/followers","following_url":"https://api.github.com/users/stuartnelson3/following{/other_user}","gists_url":"https://api.github.com/users/stuartnelson3/gists{/gist_id}","starred_url":"https://api.github.com/users/stuartnelson3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuartnelson3/subscriptions","organizations_url":"https://api.github.com/users/stuartnelson3/orgs","repos_url":"https://api.github.com/users/stuartnelson3/repos","events_url":"https://api.github.com/users/stuartnelson3/events{/privacy}","received_events_url":"https://api.github.com/users/stuartnelson3/received_events","type":"User","site_admin":false},"body":"trying to unset `behaviorSeries` references, but it is still being held on to in `legend` according to the profiler. Hoping to straighten this out tonight.","created_at":"2014-02-26T14:33:56Z","updated_at":"2014-02-26T14:33:56Z","html_url":"https://github.com/prometheus/promdash/pull/68#discussion_r10081126","pull_request_url":"https://api.github.com/repos/prometheus/promdash/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/comments/10081126"},"html":{"href":"https://github.com/prometheus/promdash/pull/68#discussion_r10081126"},"pull_request":{"href":"https://api.github.com/repos/prometheus/promdash/pulls/68"}}}}