{"action":"created","comment":{"url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/comments/63295879","id":63295879,"diff_hunk":"@@ -57,54 +57,111 @@\n         properties: {\n           table: {\n             type: Object,\n-            value: function() {\n+            value: function () {\n               return null;\n             },\n             observer: '_tableChanged',\n             notify: true\n           },\n+          colors: {\n+            type: Array,\n+            value: [\n+              \"#ec407a\", // Pink 400\n+              \"#ef5350\", // Red 400\n+              \"#ab47bc\", // Purple 400\n+              \"#7e57c2\", // Deep Purple 400\n+              \"#5c6bc0\", // Indigo 400\n+              \"#2196f3\", // Blue 500\n+              \"#039be5\", // Light Blue 600\n+              \"#0097a7\", // Cyan 700\n+              \"#009688\", // Teal 500\n+              \"#43a047\", // Green 600\n+              \"#689f38\", // Light Green 700\n+              \"#cddc39\", // Lime 500\n+              \"#ffeb3b\", // Yellow 500\n+              \"#ffc107\", // Amber 500\n+              \"#ff9800\"  // Orange 500\n+            ]\n+          },\n           chart: Object\n         },\n \n-        _tableChanged: function(newTable) {\n+        _tableChanged: function (newTable) {\n           if (!newTable) {\n-            console.log('Empty table');\n             return;\n           }\n-          console.log(newTable);\n \n-          if(this.chart){\n+          // Clear old chart to avoid overdrawing\n+          if (this.chart) {\n             this.chart.clear();\n             this.chart.destroy();\n           }\n \n+          // Create all datasets for the chart\n+          var datasets = this._createDatasets(newTable);\n+\n+          var labels;\n+          if (newTable.z === \"Time\") {\n+            var days = [];\n+            for (var day in newTable.data) {\n+              days.push(day)\n+            }\n+            labels = days;\n+          } else {\n+            labels = newTable.x;\n+          }\n+\n           var ctx = this.$.chart.getContext(\"2d\");\n           this.chart = new Chart(ctx, {\n             type: 'bar',\n             data: {\n-              labels: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n-              datasets: [\n-                {\n-                  label: \"Flight-Data\",\n-                  backgroundColor: \"#ec407a\",\n-                  data: [newTable.January,\n-                  newTable.February,\n-                  newTable.March,\n-                  newTable.April,\n-                  newTable.May,\n-                  newTable.June,\n-                  newTable.July,\n-                  newTable.August,\n-                  newTable.September,\n-                  newTable.October,\n-                  newTable.November,\n-                  newTable.December]\n+              labels: labels,\n+              options: {\n+                scales: {\n+                  yAxes: [{\n+                    ticks: {\n+                      beginAtZero: true\n+                    },\n+                    scaleLabel: {\n+                      display: true,\n+                      labelString: newTable.y\n+                    }\n+                  }],\n+                  xAxes: [{\n+                    scaleLabel: {\n+                      display: true,\n+                      labelString: \"Time\"\n+                    }\n+                  }]\n                 }\n-              ]\n-\n+              },\n+              datasets: datasets\n             }\n           });\n+        },\n+\n+        _createDatasets: function (data) {\n+          var dataset = [];\n+\n+          if (data.data.length > 15) {\n+            this.fire(\"show-toast\", \"More than 15 selectors active. Only first 15 can be shown.\");\n+          }\n+\n+          var counter = 0;\n+          for (var dataElement in data.data) {\n+            if (counter <= 15) {\n+              dataset.push({\n+                label: dataElement,\n+                backgroundColor: this.colors[counter],","path":"app/elements/flight-graph/flight-graph.html","position":123,"original_position":123,"commit_id":"27d2dacfd4051a4a7769ea2adc07f84483d90e1f","original_commit_id":"27d2dacfd4051a4a7769ea2adc07f84483d90e1f","user":{"login":"peter-mueller","id":9094815,"avatar_url":"https://avatars.githubusercontent.com/u/9094815?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-mueller","html_url":"https://github.com/peter-mueller","followers_url":"https://api.github.com/users/peter-mueller/followers","following_url":"https://api.github.com/users/peter-mueller/following{/other_user}","gists_url":"https://api.github.com/users/peter-mueller/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-mueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-mueller/subscriptions","organizations_url":"https://api.github.com/users/peter-mueller/orgs","repos_url":"https://api.github.com/users/peter-mueller/repos","events_url":"https://api.github.com/users/peter-mueller/events{/privacy}","received_events_url":"https://api.github.com/users/peter-mueller/received_events","type":"User","site_admin":false},"body":"Das evtl als getNextColor() oder getColor(POS), dann könnte man das schon mal extra testen?","created_at":"2016-05-15T18:25:23Z","updated_at":"2016-05-15T18:25:23Z","html_url":"https://github.com/ORFAP/flight-analyzer/pull/23#discussion_r63295879","pull_request_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/comments/63295879"},"html":{"href":"https://github.com/ORFAP/flight-analyzer/pull/23#discussion_r63295879"},"pull_request":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23","id":70127908,"html_url":"https://github.com/ORFAP/flight-analyzer/pull/23","diff_url":"https://github.com/ORFAP/flight-analyzer/pull/23.diff","patch_url":"https://github.com/ORFAP/flight-analyzer/pull/23.patch","issue_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/23","number":23,"state":"open","locked":false,"title":"#22 apply graph data","user":{"login":"FabianHoltkoetter","id":10800158,"avatar_url":"https://avatars.githubusercontent.com/u/10800158?v=3","gravatar_id":"","url":"https://api.github.com/users/FabianHoltkoetter","html_url":"https://github.com/FabianHoltkoetter","followers_url":"https://api.github.com/users/FabianHoltkoetter/followers","following_url":"https://api.github.com/users/FabianHoltkoetter/following{/other_user}","gists_url":"https://api.github.com/users/FabianHoltkoetter/gists{/gist_id}","starred_url":"https://api.github.com/users/FabianHoltkoetter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FabianHoltkoetter/subscriptions","organizations_url":"https://api.github.com/users/FabianHoltkoetter/orgs","repos_url":"https://api.github.com/users/FabianHoltkoetter/repos","events_url":"https://api.github.com/users/FabianHoltkoetter/events{/privacy}","received_events_url":"https://api.github.com/users/FabianHoltkoetter/received_events","type":"User","site_admin":false},"body":"Kannst du dir ja schonmal anschauen ob du schon irgendwo irgendwelche flaws siehst. ich merge erst wenn ich es mit live-daten getestet habe.\r\n\r\n- [ ] @peter-mueller ","created_at":"2016-05-15T17:51:35Z","updated_at":"2016-05-15T18:25:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"061ce8128ba9abc4c395ce475efab8b2a934d2d7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23/commits","review_comments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23/comments","review_comment_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/23/comments","statuses_url":"https://api.github.com/repos/ORFAP/flight-analyzer/statuses/27d2dacfd4051a4a7769ea2adc07f84483d90e1f","head":{"label":"ORFAP:#22-apply-graph-data","ref":"#22-apply-graph-data","sha":"27d2dacfd4051a4a7769ea2adc07f84483d90e1f","user":{"login":"ORFAP","id":18229588,"avatar_url":"https://avatars.githubusercontent.com/u/18229588?v=3","gravatar_id":"","url":"https://api.github.com/users/ORFAP","html_url":"https://github.com/ORFAP","followers_url":"https://api.github.com/users/ORFAP/followers","following_url":"https://api.github.com/users/ORFAP/following{/other_user}","gists_url":"https://api.github.com/users/ORFAP/gists{/gist_id}","starred_url":"https://api.github.com/users/ORFAP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORFAP/subscriptions","organizations_url":"https://api.github.com/users/ORFAP/orgs","repos_url":"https://api.github.com/users/ORFAP/repos","events_url":"https://api.github.com/users/ORFAP/events{/privacy}","received_events_url":"https://api.github.com/users/ORFAP/received_events","type":"Organization","site_admin":false},"repo":{"id":55291516,"name":"flight-analyzer","full_name":"ORFAP/flight-analyzer","owner":{"login":"ORFAP","id":18229588,"avatar_url":"https://avatars.githubusercontent.com/u/18229588?v=3","gravatar_id":"","url":"https://api.github.com/users/ORFAP","html_url":"https://github.com/ORFAP","followers_url":"https://api.github.com/users/ORFAP/followers","following_url":"https://api.github.com/users/ORFAP/following{/other_user}","gists_url":"https://api.github.com/users/ORFAP/gists{/gist_id}","starred_url":"https://api.github.com/users/ORFAP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORFAP/subscriptions","organizations_url":"https://api.github.com/users/ORFAP/orgs","repos_url":"https://api.github.com/users/ORFAP/repos","events_url":"https://api.github.com/users/ORFAP/events{/privacy}","received_events_url":"https://api.github.com/users/ORFAP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ORFAP/flight-analyzer","description":"GUI for FAP","fork":false,"url":"https://api.github.com/repos/ORFAP/flight-analyzer","forks_url":"https://api.github.com/repos/ORFAP/flight-analyzer/forks","keys_url":"https://api.github.com/repos/ORFAP/flight-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ORFAP/flight-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ORFAP/flight-analyzer/teams","hooks_url":"https://api.github.com/repos/ORFAP/flight-analyzer/hooks","issue_events_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/ORFAP/flight-analyzer/events","assignees_url":"https://api.github.com/repos/ORFAP/flight-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/ORFAP/flight-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/ORFAP/flight-analyzer/tags","blobs_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ORFAP/flight-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/ORFAP/flight-analyzer/languages","stargazers_url":"https://api.github.com/repos/ORFAP/flight-analyzer/stargazers","contributors_url":"https://api.github.com/repos/ORFAP/flight-analyzer/contributors","subscribers_url":"https://api.github.com/repos/ORFAP/flight-analyzer/subscribers","subscription_url":"https://api.github.com/repos/ORFAP/flight-analyzer/subscription","commits_url":"https://api.github.com/repos/ORFAP/flight-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ORFAP/flight-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/ORFAP/flight-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ORFAP/flight-analyzer/merges","archive_url":"https://api.github.com/repos/ORFAP/flight-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ORFAP/flight-analyzer/downloads","issues_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/ORFAP/flight-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/ORFAP/flight-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ORFAP/flight-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/ORFAP/flight-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/deployments","created_at":"2016-04-02T11:38:50Z","updated_at":"2016-04-14T07:11:14Z","pushed_at":"2016-05-15T17:51:36Z","git_url":"git://github.com/ORFAP/flight-analyzer.git","ssh_url":"git@github.com:ORFAP/flight-analyzer.git","clone_url":"https://github.com/ORFAP/flight-analyzer.git","svn_url":"https://github.com/ORFAP/flight-analyzer","homepage":"http://10.28.2.166","size":10656,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"ORFAP:master","ref":"master","sha":"95111d5c5697c9ddc05acb8f95ebc853ea344031","user":{"login":"ORFAP","id":18229588,"avatar_url":"https://avatars.githubusercontent.com/u/18229588?v=3","gravatar_id":"","url":"https://api.github.com/users/ORFAP","html_url":"https://github.com/ORFAP","followers_url":"https://api.github.com/users/ORFAP/followers","following_url":"https://api.github.com/users/ORFAP/following{/other_user}","gists_url":"https://api.github.com/users/ORFAP/gists{/gist_id}","starred_url":"https://api.github.com/users/ORFAP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORFAP/subscriptions","organizations_url":"https://api.github.com/users/ORFAP/orgs","repos_url":"https://api.github.com/users/ORFAP/repos","events_url":"https://api.github.com/users/ORFAP/events{/privacy}","received_events_url":"https://api.github.com/users/ORFAP/received_events","type":"Organization","site_admin":false},"repo":{"id":55291516,"name":"flight-analyzer","full_name":"ORFAP/flight-analyzer","owner":{"login":"ORFAP","id":18229588,"avatar_url":"https://avatars.githubusercontent.com/u/18229588?v=3","gravatar_id":"","url":"https://api.github.com/users/ORFAP","html_url":"https://github.com/ORFAP","followers_url":"https://api.github.com/users/ORFAP/followers","following_url":"https://api.github.com/users/ORFAP/following{/other_user}","gists_url":"https://api.github.com/users/ORFAP/gists{/gist_id}","starred_url":"https://api.github.com/users/ORFAP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORFAP/subscriptions","organizations_url":"https://api.github.com/users/ORFAP/orgs","repos_url":"https://api.github.com/users/ORFAP/repos","events_url":"https://api.github.com/users/ORFAP/events{/privacy}","received_events_url":"https://api.github.com/users/ORFAP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ORFAP/flight-analyzer","description":"GUI for FAP","fork":false,"url":"https://api.github.com/repos/ORFAP/flight-analyzer","forks_url":"https://api.github.com/repos/ORFAP/flight-analyzer/forks","keys_url":"https://api.github.com/repos/ORFAP/flight-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ORFAP/flight-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ORFAP/flight-analyzer/teams","hooks_url":"https://api.github.com/repos/ORFAP/flight-analyzer/hooks","issue_events_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/ORFAP/flight-analyzer/events","assignees_url":"https://api.github.com/repos/ORFAP/flight-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/ORFAP/flight-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/ORFAP/flight-analyzer/tags","blobs_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ORFAP/flight-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/ORFAP/flight-analyzer/languages","stargazers_url":"https://api.github.com/repos/ORFAP/flight-analyzer/stargazers","contributors_url":"https://api.github.com/repos/ORFAP/flight-analyzer/contributors","subscribers_url":"https://api.github.com/repos/ORFAP/flight-analyzer/subscribers","subscription_url":"https://api.github.com/repos/ORFAP/flight-analyzer/subscription","commits_url":"https://api.github.com/repos/ORFAP/flight-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ORFAP/flight-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ORFAP/flight-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/ORFAP/flight-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ORFAP/flight-analyzer/merges","archive_url":"https://api.github.com/repos/ORFAP/flight-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ORFAP/flight-analyzer/downloads","issues_url":"https://api.github.com/repos/ORFAP/flight-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/ORFAP/flight-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/ORFAP/flight-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ORFAP/flight-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/ORFAP/flight-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/ORFAP/flight-analyzer/deployments","created_at":"2016-04-02T11:38:50Z","updated_at":"2016-04-14T07:11:14Z","pushed_at":"2016-05-15T17:51:36Z","git_url":"git://github.com/ORFAP/flight-analyzer.git","ssh_url":"git@github.com:ORFAP/flight-analyzer.git","clone_url":"https://github.com/ORFAP/flight-analyzer.git","svn_url":"https://github.com/ORFAP/flight-analyzer","homepage":"http://10.28.2.166","size":10656,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23"},"html":{"href":"https://github.com/ORFAP/flight-analyzer/pull/23"},"issue":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/23"},"comments":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/ORFAP/flight-analyzer/statuses/27d2dacfd4051a4a7769ea2adc07f84483d90e1f"}}}}