{"action":"created","comment":{"url":"https://api.github.com/repos/bloomberg/bqplot/pulls/comments/46632224","id":46632224,"diff_hunk":"@@ -121,6 +122,73 @@ define([\"./components/d3/d3\", \"./Mark\", \"./utils\"], function(d3, MarkViewModule,\n             this.listenTo(this.model, \"change:selected\", this.update_selected);\n             this.listenTo(this.model, \"change:interactions\", this.process_interactions);\n         },\n+        click_handler: function (args) {\n+            var data = args.data;\n+            var num_cols = this.model.colors[0].length;\n+            var index = args.row_num * num_cols + args.column_num;\n+            var row = args.row_num;\n+            var column = args.column_num;\n+            var that = this;\n+            var idx = this.model.get(\"selected\") ? utils.deepCopy(this.model.get(\"selected\")) : [];\n+            var selected = utils.deepCopy(this._cell_nums_from_indices(idx));\n+            var elem_index = selected.indexOf(index);\n+            // index of slice i. Checking if it is already present in the\n+            // list\n+            if(elem_index > -1 && d3.event.ctrlKey) {\n+            // if the index is already selected and if ctrl key is\n+            // pressed, remove the element from the list\n+                idx.splice(elem_index, 1);\n+            } else {\n+                if(d3.event.shiftKey) {\n+                    //If shift is pressed and the element is already\n+                    //selected, do not do anything\n+                    if(elem_index > -1) {\n+                        return;\n+                    }\n+                    //Add elements before or after the index of the current\n+                    //slice which has been clicked\n+                    var row_index = (selected.length !== 0) ?\n+                        idx[idx.length - 1][0] : row;\n+                    var col_index = (selected.length !== 0) ?\n+                        idx[idx.length - 1][1] : column;\n+                    _.range(Math.min(row, row_index), Math.max(row, row_index)+1).forEach(function(i) {\n+                        _.range(Math.min(column, col_index), Math.max(column, col_index)+1).forEach(function(j) {\n+                            var cell_num = that._cell_nums_from_indices([[i, j]])[0];\n+                            if (selected.indexOf(cell_num) === -1) {\n+                                selected.push(cell_num);\n+                                idx.push([i, j]);\n+                            }\n+                        })\n+                    });\n+                } else if(!(d3.event.ctrlKey)) {","path":"bqplot/nbextension/GridHeatMap.js","position":50,"original_position":50,"commit_id":"7c8a0dfcc9d6ae258bb7bdbfc2a3e8512ec9db33","original_commit_id":"7c8a0dfcc9d6ae258bb7bdbfc2a3e8512ec9db33","user":{"login":"dmadeka","id":7892382,"avatar_url":"https://avatars.githubusercontent.com/u/7892382?v=3","gravatar_id":"","url":"https://api.github.com/users/dmadeka","html_url":"https://github.com/dmadeka","followers_url":"https://api.github.com/users/dmadeka/followers","following_url":"https://api.github.com/users/dmadeka/following{/other_user}","gists_url":"https://api.github.com/users/dmadeka/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadeka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadeka/subscriptions","organizations_url":"https://api.github.com/users/dmadeka/orgs","repos_url":"https://api.github.com/users/dmadeka/repos","events_url":"https://api.github.com/users/dmadeka/events{/privacy}","received_events_url":"https://api.github.com/users/dmadeka/received_events","type":"User","site_admin":false},"body":"@rmenegaux if we move this to the top and make the next if statement an else. This will replicate Excels behaviour exactly, in that the `Shift` key will create a new block and the double `Shift` will have no effect. \r\n\r\nWhat does everyone else think?","created_at":"2015-12-04T00:06:37Z","updated_at":"2015-12-04T00:06:37Z","html_url":"https://github.com/bloomberg/bqplot/pull/67#discussion_r46632224","pull_request_url":"https://api.github.com/repos/bloomberg/bqplot/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/comments/46632224"},"html":{"href":"https://github.com/bloomberg/bqplot/pull/67#discussion_r46632224"},"pull_request":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/bloomberg/bqplot/pulls/67","id":52595506,"html_url":"https://github.com/bloomberg/bqplot/pull/67","diff_url":"https://github.com/bloomberg/bqplot/pull/67.diff","patch_url":"https://github.com/bloomberg/bqplot/pull/67.patch","issue_url":"https://api.github.com/repos/bloomberg/bqplot/issues/67","number":67,"state":"open","locked":false,"title":"First pass at Selection on GridHeatMap","user":{"login":"dmadeka","id":7892382,"avatar_url":"https://avatars.githubusercontent.com/u/7892382?v=3","gravatar_id":"","url":"https://api.github.com/users/dmadeka","html_url":"https://github.com/dmadeka","followers_url":"https://api.github.com/users/dmadeka/followers","following_url":"https://api.github.com/users/dmadeka/following{/other_user}","gists_url":"https://api.github.com/users/dmadeka/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadeka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadeka/subscriptions","organizations_url":"https://api.github.com/users/dmadeka/orgs","repos_url":"https://api.github.com/users/dmadeka/repos","events_url":"https://api.github.com/users/dmadeka/events{/privacy}","received_events_url":"https://api.github.com/users/dmadeka/received_events","type":"User","site_admin":false},"body":"This PR enables a click interaction for selection on the GridHeatMap. The selection works as in other marks but mimics Excel in that, the `ctrl` key allows additional selection, while the `Shift` key selects the entire range from the last selected cell to the current clicked cell.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/7892382/11574682/17891048-99db-11e5-9170-5d81142a2320.png)\r\n\r\nThe range selection allows arbitrary ranges to be selected with the `Shift` key. \r\n\r\n![image](https://cloud.githubusercontent.com/assets/7892382/11574723/477cf706-99db-11e5-888a-0d561da2cf1f.png)\r\n\r\nThe `grid_map.selected` trait returns a list of list containing the row index and the column index of each selected cell.","created_at":"2015-12-03T21:31:32Z","updated_at":"2015-12-04T00:06:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e10c5ab0814e5261ba28122426b982b64a6a26b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bloomberg/bqplot/pulls/67/commits","review_comments_url":"https://api.github.com/repos/bloomberg/bqplot/pulls/67/comments","review_comment_url":"https://api.github.com/repos/bloomberg/bqplot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bloomberg/bqplot/issues/67/comments","statuses_url":"https://api.github.com/repos/bloomberg/bqplot/statuses/7c8a0dfcc9d6ae258bb7bdbfc2a3e8512ec9db33","head":{"label":"dmadeka:GridSelect","ref":"GridSelect","sha":"7c8a0dfcc9d6ae258bb7bdbfc2a3e8512ec9db33","user":{"login":"dmadeka","id":7892382,"avatar_url":"https://avatars.githubusercontent.com/u/7892382?v=3","gravatar_id":"","url":"https://api.github.com/users/dmadeka","html_url":"https://github.com/dmadeka","followers_url":"https://api.github.com/users/dmadeka/followers","following_url":"https://api.github.com/users/dmadeka/following{/other_user}","gists_url":"https://api.github.com/users/dmadeka/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadeka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadeka/subscriptions","organizations_url":"https://api.github.com/users/dmadeka/orgs","repos_url":"https://api.github.com/users/dmadeka/repos","events_url":"https://api.github.com/users/dmadeka/events{/privacy}","received_events_url":"https://api.github.com/users/dmadeka/received_events","type":"User","site_admin":false},"repo":{"id":43325201,"name":"bqplot","full_name":"dmadeka/bqplot","owner":{"login":"dmadeka","id":7892382,"avatar_url":"https://avatars.githubusercontent.com/u/7892382?v=3","gravatar_id":"","url":"https://api.github.com/users/dmadeka","html_url":"https://github.com/dmadeka","followers_url":"https://api.github.com/users/dmadeka/followers","following_url":"https://api.github.com/users/dmadeka/following{/other_user}","gists_url":"https://api.github.com/users/dmadeka/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadeka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadeka/subscriptions","organizations_url":"https://api.github.com/users/dmadeka/orgs","repos_url":"https://api.github.com/users/dmadeka/repos","events_url":"https://api.github.com/users/dmadeka/events{/privacy}","received_events_url":"https://api.github.com/users/dmadeka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmadeka/bqplot","description":"Plotting library for IPython/Jupyter Notebooks","fork":true,"url":"https://api.github.com/repos/dmadeka/bqplot","forks_url":"https://api.github.com/repos/dmadeka/bqplot/forks","keys_url":"https://api.github.com/repos/dmadeka/bqplot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmadeka/bqplot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmadeka/bqplot/teams","hooks_url":"https://api.github.com/repos/dmadeka/bqplot/hooks","issue_events_url":"https://api.github.com/repos/dmadeka/bqplot/issues/events{/number}","events_url":"https://api.github.com/repos/dmadeka/bqplot/events","assignees_url":"https://api.github.com/repos/dmadeka/bqplot/assignees{/user}","branches_url":"https://api.github.com/repos/dmadeka/bqplot/branches{/branch}","tags_url":"https://api.github.com/repos/dmadeka/bqplot/tags","blobs_url":"https://api.github.com/repos/dmadeka/bqplot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmadeka/bqplot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmadeka/bqplot/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmadeka/bqplot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmadeka/bqplot/statuses/{sha}","languages_url":"https://api.github.com/repos/dmadeka/bqplot/languages","stargazers_url":"https://api.github.com/repos/dmadeka/bqplot/stargazers","contributors_url":"https://api.github.com/repos/dmadeka/bqplot/contributors","subscribers_url":"https://api.github.com/repos/dmadeka/bqplot/subscribers","subscription_url":"https://api.github.com/repos/dmadeka/bqplot/subscription","commits_url":"https://api.github.com/repos/dmadeka/bqplot/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmadeka/bqplot/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmadeka/bqplot/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmadeka/bqplot/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmadeka/bqplot/contents/{+path}","compare_url":"https://api.github.com/repos/dmadeka/bqplot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmadeka/bqplot/merges","archive_url":"https://api.github.com/repos/dmadeka/bqplot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmadeka/bqplot/downloads","issues_url":"https://api.github.com/repos/dmadeka/bqplot/issues{/number}","pulls_url":"https://api.github.com/repos/dmadeka/bqplot/pulls{/number}","milestones_url":"https://api.github.com/repos/dmadeka/bqplot/milestones{/number}","notifications_url":"https://api.github.com/repos/dmadeka/bqplot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmadeka/bqplot/labels{/name}","releases_url":"https://api.github.com/repos/dmadeka/bqplot/releases{/id}","created_at":"2015-09-28T20:29:48Z","updated_at":"2015-09-28T20:29:50Z","pushed_at":"2015-12-03T21:50:51Z","git_url":"git://github.com/dmadeka/bqplot.git","ssh_url":"git@github.com:dmadeka/bqplot.git","clone_url":"https://github.com/dmadeka/bqplot.git","svn_url":"https://github.com/dmadeka/bqplot","homepage":null,"size":6602,"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":"master"}},"base":{"label":"bloomberg:master","ref":"master","sha":"fac0c65956321d5d8b228a900520dd8d8e6bfa28","user":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"repo":{"id":43191201,"name":"bqplot","full_name":"bloomberg/bqplot","owner":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bloomberg/bqplot","description":"Plotting library for IPython/Jupyter Notebooks","fork":false,"url":"https://api.github.com/repos/bloomberg/bqplot","forks_url":"https://api.github.com/repos/bloomberg/bqplot/forks","keys_url":"https://api.github.com/repos/bloomberg/bqplot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bloomberg/bqplot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bloomberg/bqplot/teams","hooks_url":"https://api.github.com/repos/bloomberg/bqplot/hooks","issue_events_url":"https://api.github.com/repos/bloomberg/bqplot/issues/events{/number}","events_url":"https://api.github.com/repos/bloomberg/bqplot/events","assignees_url":"https://api.github.com/repos/bloomberg/bqplot/assignees{/user}","branches_url":"https://api.github.com/repos/bloomberg/bqplot/branches{/branch}","tags_url":"https://api.github.com/repos/bloomberg/bqplot/tags","blobs_url":"https://api.github.com/repos/bloomberg/bqplot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bloomberg/bqplot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bloomberg/bqplot/git/refs{/sha}","trees_url":"https://api.github.com/repos/bloomberg/bqplot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bloomberg/bqplot/statuses/{sha}","languages_url":"https://api.github.com/repos/bloomberg/bqplot/languages","stargazers_url":"https://api.github.com/repos/bloomberg/bqplot/stargazers","contributors_url":"https://api.github.com/repos/bloomberg/bqplot/contributors","subscribers_url":"https://api.github.com/repos/bloomberg/bqplot/subscribers","subscription_url":"https://api.github.com/repos/bloomberg/bqplot/subscription","commits_url":"https://api.github.com/repos/bloomberg/bqplot/commits{/sha}","git_commits_url":"https://api.github.com/repos/bloomberg/bqplot/git/commits{/sha}","comments_url":"https://api.github.com/repos/bloomberg/bqplot/comments{/number}","issue_comment_url":"https://api.github.com/repos/bloomberg/bqplot/issues/comments{/number}","contents_url":"https://api.github.com/repos/bloomberg/bqplot/contents/{+path}","compare_url":"https://api.github.com/repos/bloomberg/bqplot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bloomberg/bqplot/merges","archive_url":"https://api.github.com/repos/bloomberg/bqplot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bloomberg/bqplot/downloads","issues_url":"https://api.github.com/repos/bloomberg/bqplot/issues{/number}","pulls_url":"https://api.github.com/repos/bloomberg/bqplot/pulls{/number}","milestones_url":"https://api.github.com/repos/bloomberg/bqplot/milestones{/number}","notifications_url":"https://api.github.com/repos/bloomberg/bqplot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bloomberg/bqplot/labels{/name}","releases_url":"https://api.github.com/repos/bloomberg/bqplot/releases{/id}","created_at":"2015-09-26T04:02:18Z","updated_at":"2015-12-03T16:38:59Z","pushed_at":"2015-12-03T21:50:51Z","git_url":"git://github.com/bloomberg/bqplot.git","ssh_url":"git@github.com:bloomberg/bqplot.git","clone_url":"https://github.com/bloomberg/bqplot.git","svn_url":"https://github.com/bloomberg/bqplot","homepage":null,"size":6668,"stargazers_count":807,"watchers_count":807,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":17,"forks":48,"open_issues":17,"watchers":807,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/67"},"html":{"href":"https://github.com/bloomberg/bqplot/pull/67"},"issue":{"href":"https://api.github.com/repos/bloomberg/bqplot/issues/67"},"comments":{"href":"https://api.github.com/repos/bloomberg/bqplot/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bloomberg/bqplot/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/bloomberg/bqplot/statuses/7c8a0dfcc9d6ae258bb7bdbfc2a3e8512ec9db33"}}}}