{"action":"created","comment":{"url":"https://api.github.com/repos/selfhub/selfhub/pulls/comments/22663373","id":22663373,"diff_hunk":"@@ -1,11 +1,87 @@\n var React = require(\"react\");\n var AppStore = require(\"../store/app_store\");\n+var c3 = require(\"c3\");\n+var _ = require(\"lodash\");\n \n var Chart = React.createClass({\n   componentDidMount: function() {\n-    AppStore.getVisualizationData(this.props.schemaName,\n-      AppStore.generateChart\n-    );\n+    AppStore.renderSchema(this.props.schemaName);\n+  },\n+  statics: {\n+    renderTimeSeriesChart: function(table, headerIndex) {\n+      headerIndex = headerIndex || 2;\n+      if (Array.isArray(table)) {\n+        var csvHeader = AppStore.formatCSVHeader(table[0][headerIndex]);\n+        var _schemaCSVData = [csvHeader];\n+    \n+        for (var i = 1; i < table.length - 1; i++) {\n+          _schemaCSVData.push(table[i][headerIndex]);\n+        }\n+    \n+        c3.generate({\n+          bindto: \".visualization-view\",\n+          data: {\n+            columns: [_schemaCSVData]\n+           },\n+          axis: {\n+            y: {\n+              label: {\n+                text: csvHeader,\n+                position: \"outer-middle\"\n+              }\n+            },\n+            x: {\n+              show: true,\n+              label: {\n+                text: \"Time\",\n+                position: \"outer-middle\"\n+              }\n+            }\n+          }\n+        });\n+      }\n+    },\n+    renderHistogramChart: function(csvData) {\n+      var transformHistogramData = function(csvData, headerIndex) {\n+        var bucketSize = 2;\n+        var header = csvData[0][headerIndex];","path":"client/js/components/chart.jsx","position":50,"original_position":50,"commit_id":"4d6bca77610060709bb50e1377d0a47b5a66a8e8","original_commit_id":"4d6bca77610060709bb50e1377d0a47b5a66a8e8","user":{"login":"dduugg","id":697964,"avatar_url":"https://avatars.githubusercontent.com/u/697964?v=3","gravatar_id":"","url":"https://api.github.com/users/dduugg","html_url":"https://github.com/dduugg","followers_url":"https://api.github.com/users/dduugg/followers","following_url":"https://api.github.com/users/dduugg/following{/other_user}","gists_url":"https://api.github.com/users/dduugg/gists{/gist_id}","starred_url":"https://api.github.com/users/dduugg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dduugg/subscriptions","organizations_url":"https://api.github.com/users/dduugg/orgs","repos_url":"https://api.github.com/users/dduugg/repos","events_url":"https://api.github.com/users/dduugg/events{/privacy}","received_events_url":"https://api.github.com/users/dduugg/received_events","type":"User","site_admin":false},"body":"does `csvData[0]` exist?","created_at":"2015-01-08T16:47:22Z","updated_at":"2015-01-08T16:47:22Z","html_url":"https://github.com/selfhub/selfhub/pull/174#discussion_r22663373","pull_request_url":"https://api.github.com/repos/selfhub/selfhub/pulls/174","_links":{"self":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/comments/22663373"},"html":{"href":"https://github.com/selfhub/selfhub/pull/174#discussion_r22663373"},"pull_request":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/selfhub/selfhub/pulls/174","id":27039793,"html_url":"https://github.com/selfhub/selfhub/pull/174","diff_url":"https://github.com/selfhub/selfhub/pull/174.diff","patch_url":"https://github.com/selfhub/selfhub/pull/174.patch","issue_url":"https://api.github.com/repos/selfhub/selfhub/issues/174","number":174,"state":"open","locked":false,"title":"refactor client side and add histogram chart","user":{"login":"zindlerb","id":3388704,"avatar_url":"https://avatars.githubusercontent.com/u/3388704?v=3","gravatar_id":"","url":"https://api.github.com/users/zindlerb","html_url":"https://github.com/zindlerb","followers_url":"https://api.github.com/users/zindlerb/followers","following_url":"https://api.github.com/users/zindlerb/following{/other_user}","gists_url":"https://api.github.com/users/zindlerb/gists{/gist_id}","starred_url":"https://api.github.com/users/zindlerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindlerb/subscriptions","organizations_url":"https://api.github.com/users/zindlerb/orgs","repos_url":"https://api.github.com/users/zindlerb/repos","events_url":"https://api.github.com/users/zindlerb/events{/privacy}","received_events_url":"https://api.github.com/users/zindlerb/received_events","type":"User","site_admin":false},"body":":full_moon_with_face:  :sleepy: :full_moon_with_face: ","created_at":"2015-01-08T16:25:57Z","updated_at":"2015-01-08T16:47:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac0321053a703e0e1c01b89cb7ca4baff2b0c33a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/selfhub/selfhub/pulls/174/commits","review_comments_url":"https://api.github.com/repos/selfhub/selfhub/pulls/174/comments","review_comment_url":"https://api.github.com/repos/selfhub/selfhub/pulls/comments/{number}","comments_url":"https://api.github.com/repos/selfhub/selfhub/issues/174/comments","statuses_url":"https://api.github.com/repos/selfhub/selfhub/statuses/4d6bca77610060709bb50e1377d0a47b5a66a8e8","head":{"label":"zindlerb:react-refactor","ref":"react-refactor","sha":"4d6bca77610060709bb50e1377d0a47b5a66a8e8","user":{"login":"zindlerb","id":3388704,"avatar_url":"https://avatars.githubusercontent.com/u/3388704?v=3","gravatar_id":"","url":"https://api.github.com/users/zindlerb","html_url":"https://github.com/zindlerb","followers_url":"https://api.github.com/users/zindlerb/followers","following_url":"https://api.github.com/users/zindlerb/following{/other_user}","gists_url":"https://api.github.com/users/zindlerb/gists{/gist_id}","starred_url":"https://api.github.com/users/zindlerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindlerb/subscriptions","organizations_url":"https://api.github.com/users/zindlerb/orgs","repos_url":"https://api.github.com/users/zindlerb/repos","events_url":"https://api.github.com/users/zindlerb/events{/privacy}","received_events_url":"https://api.github.com/users/zindlerb/received_events","type":"User","site_admin":false},"repo":{"id":28110938,"name":"selfhub","full_name":"zindlerb/selfhub","owner":{"login":"zindlerb","id":3388704,"avatar_url":"https://avatars.githubusercontent.com/u/3388704?v=3","gravatar_id":"","url":"https://api.github.com/users/zindlerb","html_url":"https://github.com/zindlerb","followers_url":"https://api.github.com/users/zindlerb/followers","following_url":"https://api.github.com/users/zindlerb/following{/other_user}","gists_url":"https://api.github.com/users/zindlerb/gists{/gist_id}","starred_url":"https://api.github.com/users/zindlerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindlerb/subscriptions","organizations_url":"https://api.github.com/users/zindlerb/orgs","repos_url":"https://api.github.com/users/zindlerb/repos","events_url":"https://api.github.com/users/zindlerb/events{/privacy}","received_events_url":"https://api.github.com/users/zindlerb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zindlerb/selfhub","description":"","fork":true,"url":"https://api.github.com/repos/zindlerb/selfhub","forks_url":"https://api.github.com/repos/zindlerb/selfhub/forks","keys_url":"https://api.github.com/repos/zindlerb/selfhub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zindlerb/selfhub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zindlerb/selfhub/teams","hooks_url":"https://api.github.com/repos/zindlerb/selfhub/hooks","issue_events_url":"https://api.github.com/repos/zindlerb/selfhub/issues/events{/number}","events_url":"https://api.github.com/repos/zindlerb/selfhub/events","assignees_url":"https://api.github.com/repos/zindlerb/selfhub/assignees{/user}","branches_url":"https://api.github.com/repos/zindlerb/selfhub/branches{/branch}","tags_url":"https://api.github.com/repos/zindlerb/selfhub/tags","blobs_url":"https://api.github.com/repos/zindlerb/selfhub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zindlerb/selfhub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zindlerb/selfhub/git/refs{/sha}","trees_url":"https://api.github.com/repos/zindlerb/selfhub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zindlerb/selfhub/statuses/{sha}","languages_url":"https://api.github.com/repos/zindlerb/selfhub/languages","stargazers_url":"https://api.github.com/repos/zindlerb/selfhub/stargazers","contributors_url":"https://api.github.com/repos/zindlerb/selfhub/contributors","subscribers_url":"https://api.github.com/repos/zindlerb/selfhub/subscribers","subscription_url":"https://api.github.com/repos/zindlerb/selfhub/subscription","commits_url":"https://api.github.com/repos/zindlerb/selfhub/commits{/sha}","git_commits_url":"https://api.github.com/repos/zindlerb/selfhub/git/commits{/sha}","comments_url":"https://api.github.com/repos/zindlerb/selfhub/comments{/number}","issue_comment_url":"https://api.github.com/repos/zindlerb/selfhub/issues/comments/{number}","contents_url":"https://api.github.com/repos/zindlerb/selfhub/contents/{+path}","compare_url":"https://api.github.com/repos/zindlerb/selfhub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zindlerb/selfhub/merges","archive_url":"https://api.github.com/repos/zindlerb/selfhub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zindlerb/selfhub/downloads","issues_url":"https://api.github.com/repos/zindlerb/selfhub/issues{/number}","pulls_url":"https://api.github.com/repos/zindlerb/selfhub/pulls{/number}","milestones_url":"https://api.github.com/repos/zindlerb/selfhub/milestones{/number}","notifications_url":"https://api.github.com/repos/zindlerb/selfhub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zindlerb/selfhub/labels{/name}","releases_url":"https://api.github.com/repos/zindlerb/selfhub/releases{/id}","created_at":"2014-12-16T23:05:22Z","updated_at":"2015-01-06T20:13:28Z","pushed_at":"2015-01-08T16:25:10Z","git_url":"git://github.com/zindlerb/selfhub.git","ssh_url":"git@github.com:zindlerb/selfhub.git","clone_url":"https://github.com/zindlerb/selfhub.git","svn_url":"https://github.com/zindlerb/selfhub","homepage":null,"size":1474,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"selfhub:develop","ref":"develop","sha":"6b85a1c398e3d2c0508f271d1afa9584b3c99af7","user":{"login":"selfhub","id":10214048,"avatar_url":"https://avatars.githubusercontent.com/u/10214048?v=3","gravatar_id":"","url":"https://api.github.com/users/selfhub","html_url":"https://github.com/selfhub","followers_url":"https://api.github.com/users/selfhub/followers","following_url":"https://api.github.com/users/selfhub/following{/other_user}","gists_url":"https://api.github.com/users/selfhub/gists{/gist_id}","starred_url":"https://api.github.com/users/selfhub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selfhub/subscriptions","organizations_url":"https://api.github.com/users/selfhub/orgs","repos_url":"https://api.github.com/users/selfhub/repos","events_url":"https://api.github.com/users/selfhub/events{/privacy}","received_events_url":"https://api.github.com/users/selfhub/received_events","type":"Organization","site_admin":false},"repo":{"id":28109544,"name":"selfhub","full_name":"selfhub/selfhub","owner":{"login":"selfhub","id":10214048,"avatar_url":"https://avatars.githubusercontent.com/u/10214048?v=3","gravatar_id":"","url":"https://api.github.com/users/selfhub","html_url":"https://github.com/selfhub","followers_url":"https://api.github.com/users/selfhub/followers","following_url":"https://api.github.com/users/selfhub/following{/other_user}","gists_url":"https://api.github.com/users/selfhub/gists{/gist_id}","starred_url":"https://api.github.com/users/selfhub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selfhub/subscriptions","organizations_url":"https://api.github.com/users/selfhub/orgs","repos_url":"https://api.github.com/users/selfhub/repos","events_url":"https://api.github.com/users/selfhub/events{/privacy}","received_events_url":"https://api.github.com/users/selfhub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/selfhub/selfhub","description":"SelfHub is a central platform for sharing and analyzing quantified-self data. Users can contribute to ongoing studies by uploading anything from step count information passively collected by Fitbit to any kind of data they collect on their own.","fork":false,"url":"https://api.github.com/repos/selfhub/selfhub","forks_url":"https://api.github.com/repos/selfhub/selfhub/forks","keys_url":"https://api.github.com/repos/selfhub/selfhub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/selfhub/selfhub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/selfhub/selfhub/teams","hooks_url":"https://api.github.com/repos/selfhub/selfhub/hooks","issue_events_url":"https://api.github.com/repos/selfhub/selfhub/issues/events{/number}","events_url":"https://api.github.com/repos/selfhub/selfhub/events","assignees_url":"https://api.github.com/repos/selfhub/selfhub/assignees{/user}","branches_url":"https://api.github.com/repos/selfhub/selfhub/branches{/branch}","tags_url":"https://api.github.com/repos/selfhub/selfhub/tags","blobs_url":"https://api.github.com/repos/selfhub/selfhub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/selfhub/selfhub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/selfhub/selfhub/git/refs{/sha}","trees_url":"https://api.github.com/repos/selfhub/selfhub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/selfhub/selfhub/statuses/{sha}","languages_url":"https://api.github.com/repos/selfhub/selfhub/languages","stargazers_url":"https://api.github.com/repos/selfhub/selfhub/stargazers","contributors_url":"https://api.github.com/repos/selfhub/selfhub/contributors","subscribers_url":"https://api.github.com/repos/selfhub/selfhub/subscribers","subscription_url":"https://api.github.com/repos/selfhub/selfhub/subscription","commits_url":"https://api.github.com/repos/selfhub/selfhub/commits{/sha}","git_commits_url":"https://api.github.com/repos/selfhub/selfhub/git/commits{/sha}","comments_url":"https://api.github.com/repos/selfhub/selfhub/comments{/number}","issue_comment_url":"https://api.github.com/repos/selfhub/selfhub/issues/comments/{number}","contents_url":"https://api.github.com/repos/selfhub/selfhub/contents/{+path}","compare_url":"https://api.github.com/repos/selfhub/selfhub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/selfhub/selfhub/merges","archive_url":"https://api.github.com/repos/selfhub/selfhub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/selfhub/selfhub/downloads","issues_url":"https://api.github.com/repos/selfhub/selfhub/issues{/number}","pulls_url":"https://api.github.com/repos/selfhub/selfhub/pulls{/number}","milestones_url":"https://api.github.com/repos/selfhub/selfhub/milestones{/number}","notifications_url":"https://api.github.com/repos/selfhub/selfhub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/selfhub/selfhub/labels{/name}","releases_url":"https://api.github.com/repos/selfhub/selfhub/releases{/id}","created_at":"2014-12-16T22:25:58Z","updated_at":"2015-01-08T03:23:49Z","pushed_at":"2015-01-08T03:23:48Z","git_url":"git://github.com/selfhub/selfhub.git","ssh_url":"git@github.com:selfhub/selfhub.git","clone_url":"https://github.com/selfhub/selfhub.git","svn_url":"https://github.com/selfhub/selfhub","homepage":"http://selfhub.io","size":2887,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":20,"forks":6,"open_issues":20,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/174"},"html":{"href":"https://github.com/selfhub/selfhub/pull/174"},"issue":{"href":"https://api.github.com/repos/selfhub/selfhub/issues/174"},"comments":{"href":"https://api.github.com/repos/selfhub/selfhub/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/selfhub/selfhub/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/selfhub/selfhub/statuses/4d6bca77610060709bb50e1377d0a47b5a66a8e8"}}}}