{"action":"created","comment":{"url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/comments/174630853","pull_request_review_id":104022796,"id":174630853,"diff_hunk":"@@ -142,24 +142,48 @@ export default class Chart extends React.Component {\n       dataTable.addColumn(column);\n     });\n     dataTable.addRows(this.props.rows);\n+    \n+    const applyNumberFormat = (column, options) => {\n+      const formatter = new window.google.visualization.NumberFormat(options);\n+      formatter.format(dataTable, column);\n+    }\n+    \n+    const applyDateFormat = (column, options) => {\n+      const formatter = new window.google.visualization.DateFormat(options);\n+      formatter.format(dataTable, column);\n+    }\n+    \n     if (this.props.numberFormat) {\n-      const formatter = new window.google.visualization.NumberFormat(\n-        this.props.numberFormat.options\n-      );\n-      formatter.format(dataTable, this.props.numberFormat.column);\n+      const { column, options } = this.props.numberFormat;\n+      this.applyNumberFormat(column, options);\n     }\n \n     if (this.props.dateFormat) {\n-      const dateFormat = new window.google.visualization.DateFormat(\n-        this.props.dateFormat.options\n-      );\n-      this.props.dateFormat.columns.forEach((columnIdx) => {\n-        dateFormat.format(dataTable, columnIdx);\n+      const { columns, options } = this.props.dateFormat;\n+      columns.forEach((col) => {\n+        this.applyDateFormat(col, options)\n       });\n     }\n+    \n+    this.props.formatters.forEach(({ \n+      type, \n+      column, \n+      options \n+    }) => {\n+      switch (type) {\n+        case 'NumberFormat':\n+          this.applyNumberFormat(column, options);","path":"src/components/Chart.js","position":43,"original_position":43,"commit_id":"349030834024783577cad1202bedb2f98ff9d127","original_commit_id":"349030834024783577cad1202bedb2f98ff9d127","user":{"login":"squadette","id":3052,"avatar_url":"https://avatars1.githubusercontent.com/u/3052?v=4","gravatar_id":"","url":"https://api.github.com/users/squadette","html_url":"https://github.com/squadette","followers_url":"https://api.github.com/users/squadette/followers","following_url":"https://api.github.com/users/squadette/following{/other_user}","gists_url":"https://api.github.com/users/squadette/gists{/gist_id}","starred_url":"https://api.github.com/users/squadette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squadette/subscriptions","organizations_url":"https://api.github.com/users/squadette/orgs","repos_url":"https://api.github.com/users/squadette/repos","events_url":"https://api.github.com/users/squadette/events{/privacy}","received_events_url":"https://api.github.com/users/squadette/received_events","type":"User","site_admin":false},"body":"Is there supposed to be a `break` here?  Eslint complains:\r\n\r\n````\r\n  179:9   error    Expected a 'break' statement before 'case'              no-fallthrough\r\n  181:9   error    Expected a 'break' statement before 'default'           no-fallthrough\r\n````\r\n","created_at":"2018-03-14T22:34:07Z","updated_at":"2018-03-14T22:39:14Z","html_url":"https://github.com/RakanNimer/react-google-charts/pull/167#discussion_r174630853","pull_request_url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/comments/174630853"},"html":{"href":"https://github.com/RakanNimer/react-google-charts/pull/167#discussion_r174630853"},"pull_request":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167","id":148526746,"html_url":"https://github.com/RakanNimer/react-google-charts/pull/167","diff_url":"https://github.com/RakanNimer/react-google-charts/pull/167.diff","patch_url":"https://github.com/RakanNimer/react-google-charts/pull/167.patch","issue_url":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/167","number":167,"state":"closed","locked":false,"title":"Add flexible and idiomatic way to handle formatters.","user":{"login":"nslocum","id":350357,"avatar_url":"https://avatars1.githubusercontent.com/u/350357?v=4","gravatar_id":"","url":"https://api.github.com/users/nslocum","html_url":"https://github.com/nslocum","followers_url":"https://api.github.com/users/nslocum/followers","following_url":"https://api.github.com/users/nslocum/following{/other_user}","gists_url":"https://api.github.com/users/nslocum/gists{/gist_id}","starred_url":"https://api.github.com/users/nslocum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nslocum/subscriptions","organizations_url":"https://api.github.com/users/nslocum/orgs","repos_url":"https://api.github.com/users/nslocum/repos","events_url":"https://api.github.com/users/nslocum/events{/privacy}","received_events_url":"https://api.github.com/users/nslocum/received_events","type":"User","site_admin":false},"body":"This change enables applying NumberFormat and DateFormat to multiple columns. It's also flexible and could be easily extended to include the other Formatters (e.g. ArrowFormat, BarFormat, etc.)\r\nhttps://developers.google.com/chart/interactive/docs/reference#formatters\r\n\r\n","created_at":"2017-10-24T22:15:34Z","updated_at":"2018-03-14T22:39:15Z","closed_at":"2017-12-17T06:12:40Z","merged_at":"2017-12-17T06:12:40Z","merge_commit_sha":"aa354281bb64a355b97f0d849bd353926616a20e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167/commits","review_comments_url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167/comments","review_comment_url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/167/comments","statuses_url":"https://api.github.com/repos/RakanNimer/react-google-charts/statuses/349030834024783577cad1202bedb2f98ff9d127","head":{"label":"nslocum:master","ref":"master","sha":"349030834024783577cad1202bedb2f98ff9d127","user":{"login":"nslocum","id":350357,"avatar_url":"https://avatars1.githubusercontent.com/u/350357?v=4","gravatar_id":"","url":"https://api.github.com/users/nslocum","html_url":"https://github.com/nslocum","followers_url":"https://api.github.com/users/nslocum/followers","following_url":"https://api.github.com/users/nslocum/following{/other_user}","gists_url":"https://api.github.com/users/nslocum/gists{/gist_id}","starred_url":"https://api.github.com/users/nslocum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nslocum/subscriptions","organizations_url":"https://api.github.com/users/nslocum/orgs","repos_url":"https://api.github.com/users/nslocum/repos","events_url":"https://api.github.com/users/nslocum/events{/privacy}","received_events_url":"https://api.github.com/users/nslocum/received_events","type":"User","site_admin":false},"repo":null},"base":{"label":"RakanNimer:master","ref":"master","sha":"2932f3fad8e45645d3f19ffd4693dbf0620ab7e0","user":{"login":"RakanNimer","id":1270909,"avatar_url":"https://avatars1.githubusercontent.com/u/1270909?v=4","gravatar_id":"","url":"https://api.github.com/users/RakanNimer","html_url":"https://github.com/RakanNimer","followers_url":"https://api.github.com/users/RakanNimer/followers","following_url":"https://api.github.com/users/RakanNimer/following{/other_user}","gists_url":"https://api.github.com/users/RakanNimer/gists{/gist_id}","starred_url":"https://api.github.com/users/RakanNimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RakanNimer/subscriptions","organizations_url":"https://api.github.com/users/RakanNimer/orgs","repos_url":"https://api.github.com/users/RakanNimer/repos","events_url":"https://api.github.com/users/RakanNimer/events{/privacy}","received_events_url":"https://api.github.com/users/RakanNimer/received_events","type":"User","site_admin":false},"repo":{"id":37007945,"name":"react-google-charts","full_name":"RakanNimer/react-google-charts","owner":{"login":"RakanNimer","id":1270909,"avatar_url":"https://avatars1.githubusercontent.com/u/1270909?v=4","gravatar_id":"","url":"https://api.github.com/users/RakanNimer","html_url":"https://github.com/RakanNimer","followers_url":"https://api.github.com/users/RakanNimer/followers","following_url":"https://api.github.com/users/RakanNimer/following{/other_user}","gists_url":"https://api.github.com/users/RakanNimer/gists{/gist_id}","starred_url":"https://api.github.com/users/RakanNimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RakanNimer/subscriptions","organizations_url":"https://api.github.com/users/RakanNimer/orgs","repos_url":"https://api.github.com/users/RakanNimer/repos","events_url":"https://api.github.com/users/RakanNimer/events{/privacy}","received_events_url":"https://api.github.com/users/RakanNimer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RakanNimer/react-google-charts","description":"A React Google Charts Wrapper","fork":false,"url":"https://api.github.com/repos/RakanNimer/react-google-charts","forks_url":"https://api.github.com/repos/RakanNimer/react-google-charts/forks","keys_url":"https://api.github.com/repos/RakanNimer/react-google-charts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RakanNimer/react-google-charts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RakanNimer/react-google-charts/teams","hooks_url":"https://api.github.com/repos/RakanNimer/react-google-charts/hooks","issue_events_url":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/events{/number}","events_url":"https://api.github.com/repos/RakanNimer/react-google-charts/events","assignees_url":"https://api.github.com/repos/RakanNimer/react-google-charts/assignees{/user}","branches_url":"https://api.github.com/repos/RakanNimer/react-google-charts/branches{/branch}","tags_url":"https://api.github.com/repos/RakanNimer/react-google-charts/tags","blobs_url":"https://api.github.com/repos/RakanNimer/react-google-charts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RakanNimer/react-google-charts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RakanNimer/react-google-charts/git/refs{/sha}","trees_url":"https://api.github.com/repos/RakanNimer/react-google-charts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RakanNimer/react-google-charts/statuses/{sha}","languages_url":"https://api.github.com/repos/RakanNimer/react-google-charts/languages","stargazers_url":"https://api.github.com/repos/RakanNimer/react-google-charts/stargazers","contributors_url":"https://api.github.com/repos/RakanNimer/react-google-charts/contributors","subscribers_url":"https://api.github.com/repos/RakanNimer/react-google-charts/subscribers","subscription_url":"https://api.github.com/repos/RakanNimer/react-google-charts/subscription","commits_url":"https://api.github.com/repos/RakanNimer/react-google-charts/commits{/sha}","git_commits_url":"https://api.github.com/repos/RakanNimer/react-google-charts/git/commits{/sha}","comments_url":"https://api.github.com/repos/RakanNimer/react-google-charts/comments{/number}","issue_comment_url":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/comments{/number}","contents_url":"https://api.github.com/repos/RakanNimer/react-google-charts/contents/{+path}","compare_url":"https://api.github.com/repos/RakanNimer/react-google-charts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RakanNimer/react-google-charts/merges","archive_url":"https://api.github.com/repos/RakanNimer/react-google-charts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RakanNimer/react-google-charts/downloads","issues_url":"https://api.github.com/repos/RakanNimer/react-google-charts/issues{/number}","pulls_url":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls{/number}","milestones_url":"https://api.github.com/repos/RakanNimer/react-google-charts/milestones{/number}","notifications_url":"https://api.github.com/repos/RakanNimer/react-google-charts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RakanNimer/react-google-charts/labels{/name}","releases_url":"https://api.github.com/repos/RakanNimer/react-google-charts/releases{/id}","deployments_url":"https://api.github.com/repos/RakanNimer/react-google-charts/deployments","created_at":"2015-06-07T07:16:09Z","updated_at":"2018-03-14T19:35:28Z","pushed_at":"2018-02-25T05:29:27Z","git_url":"git://github.com/RakanNimer/react-google-charts.git","ssh_url":"git@github.com:RakanNimer/react-google-charts.git","clone_url":"https://github.com/RakanNimer/react-google-charts.git","svn_url":"https://github.com/RakanNimer/react-google-charts","homepage":"http://rakannimer.github.io/react-google-charts/","size":8897,"stargazers_count":335,"watchers_count":335,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":101,"mirror_url":null,"archived":false,"open_issues_count":54,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":101,"open_issues":54,"watchers":335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167"},"html":{"href":"https://github.com/RakanNimer/react-google-charts/pull/167"},"issue":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/167"},"comments":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/RakanNimer/react-google-charts/statuses/349030834024783577cad1202bedb2f98ff9d127"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"squadette"}}