{"action":"created","comment":{"url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/comments/132878199","pull_request_review_id":56000524,"id":132878199,"diff_hunk":"@@ -0,0 +1,129 @@\n+import { Component, createElement } from \"react\";\n+\n+import * as classNames from \"classnames\";\n+import { Config, LineLayout, PlotlyStatic, ScatterData } from \"plotly.js\";\n+\n+import \"../ui/LineChart.css\";\n+\n+declare function require(name: string): string;\n+\n+interface LineChartProps {\n+    data?: ScatterData[];\n+    config?: Partial<Config>;\n+    layout?: Partial<LineLayout>;\n+    width: number;\n+    widthUnit: string;\n+    height: number;\n+    heightUnit: string;\n+    className?: string;\n+    style?: object;\n+}\n+\n+class LineChart extends Component<LineChartProps, {}> {\n+    private lineChart: HTMLDivElement;\n+    private Plotly: PlotlyStatic;\n+    private data: ScatterData[] = [\n+        {\n+            connectgaps: true,\n+            mode: \"lines+markers\",\n+            name: \"Default data points\",\n+            type: \"scatter\",\n+            x: [ 14, 20, 30, 50 ],\n+            y: [ 14, 30, 20, 40 ]\n+        }\n+    ];\n+\n+    constructor(props: LineChartProps) {\n+        super(props);\n+\n+        this.Plotly = require(\"plotly.js/dist/plotly\") as any;\n+\n+        this.getPlotlyNodeRef = this.getPlotlyNodeRef.bind(this);\n+        this.onResize = this.onResize.bind(this);\n+    }\n+\n+    render() {\n+        return createElement(\"div\", {\n+            className: classNames(\"widget-line-chart\", this.props.className),\n+            ref: this.getPlotlyNodeRef,\n+            style: {\n+                ...this.props.style,\n+                ...this.getStyle()\n+            }\n+        });\n+    }\n+\n+    componentDidMount() {\n+        this.renderChart(this.props);\n+        this.setUpEvents();\n+        this.adjustStyle();\n+    }\n+\n+    componentWillReceiveProps(newProps: LineChartProps) {\n+        this.renderChart(newProps);\n+    }\n+\n+    componentWillUnmount() {\n+        if (this.lineChart) {\n+            this.Plotly.purge(this.lineChart);\n+        }\n+        window.removeEventListener(\"resize\", this.onResize);\n+    }\n+\n+    private getPlotlyNodeRef(node: HTMLDivElement) {\n+        this.lineChart = node;\n+    }\n+\n+    private adjustStyle() {\n+        if (this.lineChart) {\n+            const wrapperElement = this.lineChart.parentElement;\n+            if (this.props.heightUnit === \"percentageOfParent\" && wrapperElement) {\n+                wrapperElement.style.height = \"100%\";\n+                wrapperElement.style.width = \"100%\";\n+            }\n+        }\n+    }\n+\n+    private setUpEvents() {\n+        // A workaround for attaching the resize event to the Iframe window because the plotly\n+        // library does not support it. This fix will be done in the web modeler preview class when the\n+        // plotly library starts supporting listening to Iframe events.\n+        const iFrame = this.getIframe();\n+        if (iFrame) {\n+            iFrame.contentWindow.addEventListener(\"resize\", this.onResize);","path":"src/LineChart/components/LineChart.ts","position":null,"original_position":93,"commit_id":"1b93f5e5e37a15a7961a67e2cc99ce4974f7b125","original_commit_id":"2b2effb141279dfa64b962978655fb784db3d820","user":{"login":"akileng56","id":20700222,"avatar_url":"https://avatars0.githubusercontent.com/u/20700222?v=4","gravatar_id":"","url":"https://api.github.com/users/akileng56","html_url":"https://github.com/akileng56","followers_url":"https://api.github.com/users/akileng56/followers","following_url":"https://api.github.com/users/akileng56/following{/other_user}","gists_url":"https://api.github.com/users/akileng56/gists{/gist_id}","starred_url":"https://api.github.com/users/akileng56/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akileng56/subscriptions","organizations_url":"https://api.github.com/users/akileng56/orgs","repos_url":"https://api.github.com/users/akileng56/repos","events_url":"https://api.github.com/users/akileng56/events{/privacy}","received_events_url":"https://api.github.com/users/akileng56/received_events","type":"User","site_admin":false},"body":"Added","created_at":"2017-08-14T06:00:42Z","updated_at":"2017-08-14T06:00:42Z","html_url":"https://github.com/FlockOfBirds/charts/pull/1#discussion_r132878199","pull_request_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/comments/132878199"},"html":{"href":"https://github.com/FlockOfBirds/charts/pull/1#discussion_r132878199"},"pull_request":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1","id":134827874,"html_url":"https://github.com/FlockOfBirds/charts/pull/1","diff_url":"https://github.com/FlockOfBirds/charts/pull/1.diff","patch_url":"https://github.com/FlockOfBirds/charts/pull/1.patch","issue_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/1","number":1,"state":"open","locked":false,"title":"Feature/linechart","user":{"login":"akileng56","id":20700222,"avatar_url":"https://avatars0.githubusercontent.com/u/20700222?v=4","gravatar_id":"","url":"https://api.github.com/users/akileng56","html_url":"https://github.com/akileng56","followers_url":"https://api.github.com/users/akileng56/followers","following_url":"https://api.github.com/users/akileng56/following{/other_user}","gists_url":"https://api.github.com/users/akileng56/gists{/gist_id}","starred_url":"https://api.github.com/users/akileng56/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akileng56/subscriptions","organizations_url":"https://api.github.com/users/akileng56/orgs","repos_url":"https://api.github.com/users/akileng56/repos","events_url":"https://api.github.com/users/akileng56/events{/privacy}","received_events_url":"https://api.github.com/users/akileng56/received_events","type":"User","site_admin":false},"body":"- Basic configurations\r\n- Different data sources\r\n- Web modeler preview\r\n","created_at":"2017-08-09T07:36:01Z","updated_at":"2017-08-14T06:00:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0737ac7b63986db57138ec593f349cb9b42c8528","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1/commits","review_comments_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1/comments","review_comment_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/1/comments","statuses_url":"https://api.github.com/repos/FlockOfBirds/charts/statuses/1b93f5e5e37a15a7961a67e2cc99ce4974f7b125","head":{"label":"FlockOfBirds:feature/linechart","ref":"feature/linechart","sha":"1b93f5e5e37a15a7961a67e2cc99ce4974f7b125","user":{"login":"FlockOfBirds","id":22542218,"avatar_url":"https://avatars2.githubusercontent.com/u/22542218?v=4","gravatar_id":"","url":"https://api.github.com/users/FlockOfBirds","html_url":"https://github.com/FlockOfBirds","followers_url":"https://api.github.com/users/FlockOfBirds/followers","following_url":"https://api.github.com/users/FlockOfBirds/following{/other_user}","gists_url":"https://api.github.com/users/FlockOfBirds/gists{/gist_id}","starred_url":"https://api.github.com/users/FlockOfBirds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlockOfBirds/subscriptions","organizations_url":"https://api.github.com/users/FlockOfBirds/orgs","repos_url":"https://api.github.com/users/FlockOfBirds/repos","events_url":"https://api.github.com/users/FlockOfBirds/events{/privacy}","received_events_url":"https://api.github.com/users/FlockOfBirds/received_events","type":"Organization","site_admin":false},"repo":{"id":96753219,"name":"charts","full_name":"FlockOfBirds/charts","owner":{"login":"FlockOfBirds","id":22542218,"avatar_url":"https://avatars2.githubusercontent.com/u/22542218?v=4","gravatar_id":"","url":"https://api.github.com/users/FlockOfBirds","html_url":"https://github.com/FlockOfBirds","followers_url":"https://api.github.com/users/FlockOfBirds/followers","following_url":"https://api.github.com/users/FlockOfBirds/following{/other_user}","gists_url":"https://api.github.com/users/FlockOfBirds/gists{/gist_id}","starred_url":"https://api.github.com/users/FlockOfBirds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlockOfBirds/subscriptions","organizations_url":"https://api.github.com/users/FlockOfBirds/orgs","repos_url":"https://api.github.com/users/FlockOfBirds/repos","events_url":"https://api.github.com/users/FlockOfBirds/events{/privacy}","received_events_url":"https://api.github.com/users/FlockOfBirds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FlockOfBirds/charts","description":null,"fork":true,"url":"https://api.github.com/repos/FlockOfBirds/charts","forks_url":"https://api.github.com/repos/FlockOfBirds/charts/forks","keys_url":"https://api.github.com/repos/FlockOfBirds/charts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FlockOfBirds/charts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FlockOfBirds/charts/teams","hooks_url":"https://api.github.com/repos/FlockOfBirds/charts/hooks","issue_events_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/events{/number}","events_url":"https://api.github.com/repos/FlockOfBirds/charts/events","assignees_url":"https://api.github.com/repos/FlockOfBirds/charts/assignees{/user}","branches_url":"https://api.github.com/repos/FlockOfBirds/charts/branches{/branch}","tags_url":"https://api.github.com/repos/FlockOfBirds/charts/tags","blobs_url":"https://api.github.com/repos/FlockOfBirds/charts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FlockOfBirds/charts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FlockOfBirds/charts/git/refs{/sha}","trees_url":"https://api.github.com/repos/FlockOfBirds/charts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FlockOfBirds/charts/statuses/{sha}","languages_url":"https://api.github.com/repos/FlockOfBirds/charts/languages","stargazers_url":"https://api.github.com/repos/FlockOfBirds/charts/stargazers","contributors_url":"https://api.github.com/repos/FlockOfBirds/charts/contributors","subscribers_url":"https://api.github.com/repos/FlockOfBirds/charts/subscribers","subscription_url":"https://api.github.com/repos/FlockOfBirds/charts/subscription","commits_url":"https://api.github.com/repos/FlockOfBirds/charts/commits{/sha}","git_commits_url":"https://api.github.com/repos/FlockOfBirds/charts/git/commits{/sha}","comments_url":"https://api.github.com/repos/FlockOfBirds/charts/comments{/number}","issue_comment_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/comments{/number}","contents_url":"https://api.github.com/repos/FlockOfBirds/charts/contents/{+path}","compare_url":"https://api.github.com/repos/FlockOfBirds/charts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FlockOfBirds/charts/merges","archive_url":"https://api.github.com/repos/FlockOfBirds/charts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FlockOfBirds/charts/downloads","issues_url":"https://api.github.com/repos/FlockOfBirds/charts/issues{/number}","pulls_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls{/number}","milestones_url":"https://api.github.com/repos/FlockOfBirds/charts/milestones{/number}","notifications_url":"https://api.github.com/repos/FlockOfBirds/charts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FlockOfBirds/charts/labels{/name}","releases_url":"https://api.github.com/repos/FlockOfBirds/charts/releases{/id}","deployments_url":"https://api.github.com/repos/FlockOfBirds/charts/deployments","created_at":"2017-07-10T08:17:48Z","updated_at":"2017-07-10T08:17:03Z","pushed_at":"2017-08-14T05:49:51Z","git_url":"git://github.com/FlockOfBirds/charts.git","ssh_url":"git@github.com:FlockOfBirds/charts.git","clone_url":"https://github.com/FlockOfBirds/charts.git","svn_url":"https://github.com/FlockOfBirds/charts","homepage":null,"size":510,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"FlockOfBirds:master","ref":"master","sha":"f1f3c9540e7cada8e393925070ff9b877245bc96","user":{"login":"FlockOfBirds","id":22542218,"avatar_url":"https://avatars2.githubusercontent.com/u/22542218?v=4","gravatar_id":"","url":"https://api.github.com/users/FlockOfBirds","html_url":"https://github.com/FlockOfBirds","followers_url":"https://api.github.com/users/FlockOfBirds/followers","following_url":"https://api.github.com/users/FlockOfBirds/following{/other_user}","gists_url":"https://api.github.com/users/FlockOfBirds/gists{/gist_id}","starred_url":"https://api.github.com/users/FlockOfBirds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlockOfBirds/subscriptions","organizations_url":"https://api.github.com/users/FlockOfBirds/orgs","repos_url":"https://api.github.com/users/FlockOfBirds/repos","events_url":"https://api.github.com/users/FlockOfBirds/events{/privacy}","received_events_url":"https://api.github.com/users/FlockOfBirds/received_events","type":"Organization","site_admin":false},"repo":{"id":96753219,"name":"charts","full_name":"FlockOfBirds/charts","owner":{"login":"FlockOfBirds","id":22542218,"avatar_url":"https://avatars2.githubusercontent.com/u/22542218?v=4","gravatar_id":"","url":"https://api.github.com/users/FlockOfBirds","html_url":"https://github.com/FlockOfBirds","followers_url":"https://api.github.com/users/FlockOfBirds/followers","following_url":"https://api.github.com/users/FlockOfBirds/following{/other_user}","gists_url":"https://api.github.com/users/FlockOfBirds/gists{/gist_id}","starred_url":"https://api.github.com/users/FlockOfBirds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlockOfBirds/subscriptions","organizations_url":"https://api.github.com/users/FlockOfBirds/orgs","repos_url":"https://api.github.com/users/FlockOfBirds/repos","events_url":"https://api.github.com/users/FlockOfBirds/events{/privacy}","received_events_url":"https://api.github.com/users/FlockOfBirds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FlockOfBirds/charts","description":null,"fork":true,"url":"https://api.github.com/repos/FlockOfBirds/charts","forks_url":"https://api.github.com/repos/FlockOfBirds/charts/forks","keys_url":"https://api.github.com/repos/FlockOfBirds/charts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FlockOfBirds/charts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FlockOfBirds/charts/teams","hooks_url":"https://api.github.com/repos/FlockOfBirds/charts/hooks","issue_events_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/events{/number}","events_url":"https://api.github.com/repos/FlockOfBirds/charts/events","assignees_url":"https://api.github.com/repos/FlockOfBirds/charts/assignees{/user}","branches_url":"https://api.github.com/repos/FlockOfBirds/charts/branches{/branch}","tags_url":"https://api.github.com/repos/FlockOfBirds/charts/tags","blobs_url":"https://api.github.com/repos/FlockOfBirds/charts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FlockOfBirds/charts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FlockOfBirds/charts/git/refs{/sha}","trees_url":"https://api.github.com/repos/FlockOfBirds/charts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FlockOfBirds/charts/statuses/{sha}","languages_url":"https://api.github.com/repos/FlockOfBirds/charts/languages","stargazers_url":"https://api.github.com/repos/FlockOfBirds/charts/stargazers","contributors_url":"https://api.github.com/repos/FlockOfBirds/charts/contributors","subscribers_url":"https://api.github.com/repos/FlockOfBirds/charts/subscribers","subscription_url":"https://api.github.com/repos/FlockOfBirds/charts/subscription","commits_url":"https://api.github.com/repos/FlockOfBirds/charts/commits{/sha}","git_commits_url":"https://api.github.com/repos/FlockOfBirds/charts/git/commits{/sha}","comments_url":"https://api.github.com/repos/FlockOfBirds/charts/comments{/number}","issue_comment_url":"https://api.github.com/repos/FlockOfBirds/charts/issues/comments{/number}","contents_url":"https://api.github.com/repos/FlockOfBirds/charts/contents/{+path}","compare_url":"https://api.github.com/repos/FlockOfBirds/charts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FlockOfBirds/charts/merges","archive_url":"https://api.github.com/repos/FlockOfBirds/charts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FlockOfBirds/charts/downloads","issues_url":"https://api.github.com/repos/FlockOfBirds/charts/issues{/number}","pulls_url":"https://api.github.com/repos/FlockOfBirds/charts/pulls{/number}","milestones_url":"https://api.github.com/repos/FlockOfBirds/charts/milestones{/number}","notifications_url":"https://api.github.com/repos/FlockOfBirds/charts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FlockOfBirds/charts/labels{/name}","releases_url":"https://api.github.com/repos/FlockOfBirds/charts/releases{/id}","deployments_url":"https://api.github.com/repos/FlockOfBirds/charts/deployments","created_at":"2017-07-10T08:17:48Z","updated_at":"2017-07-10T08:17:03Z","pushed_at":"2017-08-14T05:49:51Z","git_url":"git://github.com/FlockOfBirds/charts.git","ssh_url":"git@github.com:FlockOfBirds/charts.git","clone_url":"https://github.com/FlockOfBirds/charts.git","svn_url":"https://github.com/FlockOfBirds/charts","homepage":null,"size":510,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1"},"html":{"href":"https://github.com/FlockOfBirds/charts/pull/1"},"issue":{"href":"https://api.github.com/repos/FlockOfBirds/charts/issues/1"},"comments":{"href":"https://api.github.com/repos/FlockOfBirds/charts/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FlockOfBirds/charts/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/FlockOfBirds/charts/statuses/1b93f5e5e37a15a7961a67e2cc99ce4974f7b125"}}}}
{"actor":{"display_login":"akileng56"}}