Commit d75438e8 authored by Joshua Gould's avatar Joshua Gould

scroll lens updates

parent db2d4b78
...@@ -2316,9 +2316,10 @@ morpheus.HeatMap.prototype = { ...@@ -2316,9 +2316,10 @@ morpheus.HeatMap.prototype = {
} else if (this.tooltipMode === 1) { } else if (this.tooltipMode === 1) {
this.$tipInfoWindow.html(tipText); this.$tipInfoWindow.html(tipText);
} }
if (tipFollowText !== '') { if (tipFollowText !== '') {
this.tipFollowHidden = false; this.tipFollowHidden = false;
this.$tipFollow.css('class', 'morpheus-tip-inline morpheus-padding-ver').html('<span style="max-width:400px;">' + tipFollowText + '</span>'); this.$tipFollow.html('<span style="max-width:400px;">' + tipFollowText + '</span>');
this._updateTipFollowPosition(options); this._updateTipFollowPosition(options);
} else { } else {
this.tipFollowHidden = true; this.tipFollowHidden = true;
......
morpheus.HeatMapToolBar = function(controller) { morpheus.HeatMapToolBar = function (controller) {
this.controller = controller; this.controller = controller;
this.rowSearchResultModelIndices = []; this.rowSearchResultModelIndices = [];
this.columnSearchResultModelIndices = []; this.columnSearchResultModelIndices = [];
var _this = this; var _this = this;
var $el = $('<div name="toolbar" class=" hidden-print container-fluid">' var $el = $('<div name="toolbar" class=" hidden-print container-fluid">'
+ '<div class="row"><div name="toolbarSearch" class="col-xs-12"></div></div>' + '<div class="row"><div name="lineOneColumn" class="col-xs-12"></div></div>'
+ '<div class="row"><div name="toolbarButtons" class="col-xs-12" style="border-bottom: 1px solid #e7e7e7;padding-bottom:4px; margin-bottom:14px;"></div></div>' + '<div class="row"><div name="lineTwoColumn" class="col-xs-12" style="border-bottom: 1px solid #e7e7e7;padding-bottom:4px; margin-bottom:14px;"></div></div>'
+ '</div>'); + '</div>');
var searchHtml = []; var searchHtml = [];
var $search = $('<form name="searchForm" class="form form-inline" role="search"></form>'); var $search = $('<form name="searchForm" class="form form-inline" role="search"></form>');
$search.on('submit', function(e) { $search.on('submit', function (e) {
e.preventDefault(); e.preventDefault();
}); });
// search rows // search rows
if (controller.options.toolbar.searchRows) { if (controller.options.toolbar.searchRows) {
searchHtml.push('<div class="form-group">'); searchHtml.push('<div class="form-group">');
searchHtml.push('<div class="input-group input-group-sm">'); // group searchHtml.push('<div class="input-group input-group-sm">');
searchHtml.push('<div class="input-group-btn">'); searchHtml.push('<div class="input-group-btn">');
searchHtml searchHtml
.push('<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span data-toggle="tooltip" title="Search rows. Quote search term for exact match. Narrow search with field: modifier. Exclude matches using - modifier. Use min..max to perform a range search.">Rows</span> <span class="caret"></span></button>'); .push('<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span data-toggle="tooltip" title="Search rows. Quote search term for exact match. Narrow search with field: modifier. Exclude matches using - modifier. Use min..max to perform a range search.">Rows</span> <span class="caret"></span></button>');
...@@ -26,7 +26,8 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -26,7 +26,8 @@ morpheus.HeatMapToolBar = function(controller) {
searchHtml.push('</ul>'); searchHtml.push('</ul>');
searchHtml.push('</div>'); // input-group-btn searchHtml.push('</div>'); // input-group-btn
searchHtml searchHtml
.push('<input type="text" style="width:240px;padding-right:25px;" class="form-control input-sm" autocomplete="off" name="searchRows">'); .push('<input type="text" style="border-top:3px solid rgb(127,127,127);width:240px;padding-buttons:25px;" class="form-control input-sm" autocomplete="off" name="searchRows">');
searchHtml.push('</div>');
searchHtml.push('</div>'); searchHtml.push('</div>');
searchHtml.push('<div class="form-group">'); searchHtml.push('<div class="form-group">');
searchHtml.push('<span name="rowSearchDiv" style="display:none;">'); searchHtml.push('<span name="rowSearchDiv" style="display:none;">');
...@@ -44,7 +45,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -44,7 +45,7 @@ morpheus.HeatMapToolBar = function(controller) {
} }
if (controller.options.toolbar.searchColumns) { if (controller.options.toolbar.searchColumns) {
searchHtml searchHtml
.push('<div class="form-group" style="margin-right:18px;"></div>'); // spacer .push('<div class="form-group" style="margin-buttons:18px;"></div>'); // spacer
// search columns // search columns
searchHtml.push('<div class="form-group">'); searchHtml.push('<div class="form-group">');
searchHtml.push('<div class="input-group input-group-sm">'); // group searchHtml.push('<div class="input-group input-group-sm">'); // group
...@@ -60,7 +61,8 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -60,7 +61,8 @@ morpheus.HeatMapToolBar = function(controller) {
searchHtml.push('</div>'); // input-group-btn searchHtml.push('</div>'); // input-group-btn
searchHtml searchHtml
.push('<input type="text" style="width:240px;padding-right:25px;" class="form-control input-sm" autocapitalize="off" autocomplete="off" name="searchColumns"></div>'); .push('<input type="text" style="border-buttons:4px solid rgb(127,127,127);width:240px;padding-buttons:25px;" class="form-control input-sm" autocapitalize="off" autocomplete="off" name="searchColumns"></div>');
searchHtml.push('</div>');
searchHtml.push('</div>'); searchHtml.push('</div>');
searchHtml.push('<div class="form-group" style="margin-left:4px;">'); searchHtml.push('<div class="form-group" style="margin-left:4px;">');
searchHtml searchHtml
...@@ -80,7 +82,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -80,7 +82,7 @@ morpheus.HeatMapToolBar = function(controller) {
searchHtml searchHtml
.push('<div name="searchValuesDiv" class="form-group" style="margin-left:18px;">'); .push('<div name="searchValuesDiv" class="form-group" style="margin-left:18px;">');
searchHtml searchHtml
.push('<div class="input-group input-group-sm"><span class="input-group-addon">Values</span><input type="text" style="width:240px;padding-right:25px;" class="form-control input-sm" autocapitalize="off" autocomplete="off" name="searchValues"></div>'); .push('<div class="input-group input-group-sm"><span class="input-group-addon">Values</span><input type="text" style="width:240px;padding-buttons:25px;" class="form-control input-sm" autocapitalize="off" autocomplete="off" name="searchValues"></div>');
searchHtml.push('</div>'); searchHtml.push('</div>');
searchHtml.push('<div class="form-group" style="margin-left:4px;">'); searchHtml.push('<div class="form-group" style="margin-left:4px;">');
searchHtml searchHtml
...@@ -110,48 +112,22 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -110,48 +112,22 @@ morpheus.HeatMapToolBar = function(controller) {
searchHtml searchHtml
.push('<h6 style="display: inline; margin-left:30px;" name="selection"></h6>'); .push('<h6 style="display: inline; margin-left:30px;" name="selection"></h6>');
searchHtml.push('</div>'); searchHtml.push('</div>');
searchHtml.push('<div name="right" class="form-group pull-right">'); searchHtml.push('<div name="buttons" style="margin-left:18px;" class="form-group"></div>');
// searchHtml
// .push('<div id="hangout-div"></div>');
// searchHtml
// .push('<button onclick="TogetherJS(this); return false;" type="button"
// class="btn btn-default btn-xs" title="Collaboration"><i class="fa
// fa-users"></button></i>');
// searchHtml.push('<span style="margin-left:6px;"></span>');
// searchHtml
// .push('<button name="tutorial" type="button" class="btn btn-default
// btn-xs" title="Tutorial"><i class="fa
// fa-question-circle"></button></i>');
searchHtml.push('</div>');
$(searchHtml.join('')).appendTo($search); $(searchHtml.join('')).appendTo($search);
if (!controller.options.toolbar.searchValues) { if (!controller.options.toolbar.searchValues) {
$search.find('[name=searchValuesDiv]').css('display', 'none'); $search.find('[name=searchValuesDiv]').css('display', 'none');
} }
if (controller.options.tour) { var $buttons = $search.find('[name=buttons]');
var $tour = $('<button type="button" class="btn btn-default btn-xs" data-toggle="tooltip" title="Take a tour"><i class="fa fa-plane"></i></button>');
$tour.prependTo($search.find('[name=right]'));
$tour.on('click', function(e) {
e.preventDefault();
controller.options.tour(controller);
});
}
if (controller.options.$help) {
controller.options.$help.appendTo($search.find('[name=right]'));
}
var $tools = $('<form name="tools" class="form-inline" role="form"></form>'); var $tools = $('<form name="tools" class="form-inline" role="form"></form>');
$tools.on('submit', function(e) { $tools.on('submit', function (e) {
e.preventDefault(); e.preventDefault();
}); });
var $toolbarForm = $('<form name="view" class="form-inline" role="form"></form>');
$toolbarForm.on('submit', function(e) {
e.preventDefault();
});
var toolbarHtml = []; var toolbarHtml = [];
// zoom // zoom
if (controller.options.toolbar.zoom) { if (controller.options.toolbar.zoom) {
toolbarHtml.push('<div class="form-group">');
toolbarHtml toolbarHtml
.push('<button type="button" class="btn btn-default btn-xs" data-toggle="tooltip" title="Zoom Out (-)" name="out"><span class="fa fa-minus"></span></button>'); .push('<button type="button" class="btn btn-default btn-xs" data-toggle="tooltip" title="Zoom Out (-)" name="out"><span class="fa fa-minus"></span></button>');
toolbarHtml toolbarHtml
...@@ -201,28 +177,28 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -201,28 +177,28 @@ morpheus.HeatMapToolBar = function(controller) {
.push('<button name="chart" data-toggle="tooltip" title="Chart" type="button" class="btn btn-default btn-xs"><span class="fa fa-line-chart"></span></button>'); .push('<button name="chart" data-toggle="tooltip" title="Chart" type="button" class="btn btn-default btn-xs"><span class="fa fa-line-chart"></span></button>');
} }
var tools = [ { var tools = [{
tool : new morpheus.HClusterTool() tool: new morpheus.HClusterTool()
}, { }, {
tool : new morpheus.MarkerSelection() tool: new morpheus.MarkerSelection()
}, { }, {
tool : new morpheus.NearestNeighbors() tool: new morpheus.NearestNeighbors()
}, { }, {
tool : new morpheus.NewHeatMapTool(), tool: new morpheus.NewHeatMapTool(),
}, null, { }, null, {
tool : new morpheus.AdjustDataTool() tool: new morpheus.AdjustDataTool()
}, { }, {
tool : new morpheus.CollapseDatasetTool() tool: new morpheus.CollapseDatasetTool()
}, { }, {
tool : new morpheus.CreateAnnotation() tool: new morpheus.CreateAnnotation()
}, { }, {
tool : new morpheus.SimilarityMatrixTool() tool: new morpheus.SimilarityMatrixTool()
}, { }, {
tool : new morpheus.TransposeTool() tool: new morpheus.TransposeTool()
}, { }, {
tool : new morpheus.WordCloudTool() tool: new morpheus.WordCloudTool()
} ]; // DevAPI, { }]; // DevAPI, {
this.getToolByName = function(name) { this.getToolByName = function (name) {
for (var i = 0; i < tools.length; i++) { for (var i = 0; i < tools.length; i++) {
if (tools[i] && tools[i].tool.toString if (tools[i] && tools[i].tool.toString
&& tools[i].tool.toString() === name) { && tools[i].tool.toString() === name) {
...@@ -265,20 +241,18 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -265,20 +241,18 @@ morpheus.HeatMapToolBar = function(controller) {
toolbarHtml.push('</div>'); toolbarHtml.push('</div>');
} }
toolbarHtml $search.appendTo($el.find('[name=lineOneColumn]'));
.push('<div style="position:relative;display:inline;margin-left:12px;"><div name="tip" class="morpheus-tip" style="overflow:hidden;"></div></div>'); var $toolbarForm = $(toolbarHtml.join(''));
toolbarHtml.push('</div>'); $toolbarForm.appendTo($buttons);
$search.appendTo($el.find('[name=toolbarSearch]')); if (controller.options.$help) {
$(toolbarHtml.join('')).appendTo($toolbarForm); controller.options.$help.appendTo($buttons);
$toolbarForm.appendTo($el.find('[name=toolbarButtons]')); }
$('<div name="tip" style="height: 14px; font-size: 12px;overflow:hidden;"></div>').appendTo($el.find('[name=lineTwoColumn]'));
$el.prependTo(controller.$content); $el.prependTo(controller.$content);
// gapi.hangout.render('hangout-div', {
// 'widget_size' : '72',
// 'render' : 'createhangout'
// });
var $tools = $el.find('[name=tools]'); var $tools = $el.find('[name=tools]');
this.$tip = $el.find('[name=tip]'); this.$tip = $el.find('[name=tip]');
$tools.on('click', 'li > a', function(e) { $tools.on('click', 'li > a', function (e) {
e.preventDefault(); e.preventDefault();
var index = parseInt($(this).attr('name')); var index = parseInt($(this).attr('name'));
if (tools[index].tool) { if (tools[index].tool) {
...@@ -290,27 +264,27 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -290,27 +264,27 @@ morpheus.HeatMapToolBar = function(controller) {
this.defaultRowMatchMode = 'contains'; this.defaultRowMatchMode = 'contains';
this.defaultColumnMatchMode = 'contains'; this.defaultColumnMatchMode = 'contains';
var $rowSearchOptions = $el.find('[name=rowSearchOptions]'); var $rowSearchOptions = $el.find('[name=rowSearchOptions]');
$rowSearchOptions.on('click', 'li > a', function(e) { $rowSearchOptions.on('click', 'li > a', function (e) {
e.preventDefault(); e.preventDefault();
_this.defaultRowMatchMode = $(this).attr('name'); _this.defaultRowMatchMode = $(this).attr('name');
$rowSearchOptions.find('li').removeClass('active'); $rowSearchOptions.find('li').removeClass('active');
$(this).parent('li').addClass('active'); $(this).parent('li').addClass('active');
_this.search(true); _this.search(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'rowSearchMatchMode' eventAction: 'rowSearchMatchMode'
}); });
}); });
var $columnSearchOptions = $el.find('[name=columnSearchOptions]'); var $columnSearchOptions = $el.find('[name=columnSearchOptions]');
$columnSearchOptions.on('click', 'li > a', function(e) { $columnSearchOptions.on('click', 'li > a', function (e) {
e.preventDefault(); e.preventDefault();
_this.defaultColumnMatchMode = $(this).attr('name'); _this.defaultColumnMatchMode = $(this).attr('name');
$columnSearchOptions.find('li').removeClass('active'); $columnSearchOptions.find('li').removeClass('active');
$(this).parent('li').addClass('active'); $(this).parent('li').addClass('active');
_this.search(false); _this.search(false);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'columnSearchMatchMode' eventAction: 'columnSearchMatchMode'
}); });
}); });
...@@ -334,7 +308,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -334,7 +308,7 @@ morpheus.HeatMapToolBar = function(controller) {
filterModal.push('</div>'); filterModal.push('</div>');
filterModal.push('</div>'); filterModal.push('</div>');
var $filterModal = $(filterModal.join('')); var $filterModal = $(filterModal.join(''));
$filterModal.on('mousewheel', function(e) { $filterModal.on('mousewheel', function (e) {
e.stopPropagation(); e.stopPropagation();
}); });
var $filter = $('<div></div>'); var $filter = $('<div></div>');
...@@ -350,32 +324,32 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -350,32 +324,32 @@ morpheus.HeatMapToolBar = function(controller) {
$filterChooser.appendTo($filter); $filterChooser.appendTo($filter);
var columnFilterUI = new morpheus.FilterUI(controller.getProject(), true); var columnFilterUI = new morpheus.FilterUI(controller.getProject(), true);
var rowFilterUI = new morpheus.FilterUI(controller.getProject(), false); var rowFilterUI = new morpheus.FilterUI(controller.getProject(), false);
controller.getProject().getRowFilter().on('focus', function(e) { controller.getProject().getRowFilter().on('focus', function (e) {
$filterChooser.find('[value=rows]').prop('checked', true); $filterChooser.find('[value=rows]').prop('checked', true);
columnFilterUI.$div.hide(); columnFilterUI.$div.hide();
rowFilterUI.$div.show(); rowFilterUI.$div.show();
$filterModal.modal('show'); $filterModal.modal('show');
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'rowFilter' eventAction: 'rowFilter'
}); });
}); });
controller.getProject().getColumnFilter().on('focus', function(e) { controller.getProject().getColumnFilter().on('focus', function (e) {
$filterChooser.find('[value=columns]').prop('checked', true); $filterChooser.find('[value=columns]').prop('checked', true);
columnFilterUI.$div.show(); columnFilterUI.$div.show();
rowFilterUI.$div.hide(); rowFilterUI.$div.hide();
$filterModal.modal('show'); $filterModal.modal('show');
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'columnFilter' eventAction: 'columnFilter'
}); });
}); });
rowFilterUI.$div.appendTo($filter); rowFilterUI.$div.appendTo($filter);
columnFilterUI.$div.appendTo($filter); columnFilterUI.$div.appendTo($filter);
columnFilterUI.$div.css('display', 'none'); columnFilterUI.$div.css('display', 'none');
var $filterRadio = $filterChooser.find('[name=rowsOrColumns]'); var $filterRadio = $filterChooser.find('[name=rowsOrColumns]');
$filterRadio.on('change', function(e) { $filterRadio.on('change', function (e) {
var val = $filterRadio.filter(':checked').val(); var val = $filterRadio.filter(':checked').val();
if (val === 'columns') { if (val === 'columns') {
columnFilterUI.$div.show(); columnFilterUI.$div.show();
...@@ -386,51 +360,51 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -386,51 +360,51 @@ morpheus.HeatMapToolBar = function(controller) {
} }
e.preventDefault(); e.preventDefault();
}); });
$el.find('[name=filterButton]').on('click', function() { $el.find('[name=filterButton]').on('click', function () {
$filterModal.modal('show'); $filterModal.modal('show');
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'filter' eventAction: 'filter'
}); });
}); });
$el.find('[data-toggle="tooltip"]').tooltip({ $el.find('[data-toggle="tooltip"]').tooltip({
placement : 'bottom', placement: 'bottom',
container : 'body', container: 'body',
trigger : 'hover' trigger: 'hover'
}).on('click', function() { }).on('click', function () {
$(this).tooltip('hide'); $(this).tooltip('hide');
}); });
var $key = $el.find('[name=key]'); var $key = $el.find('[name=key]');
var $keyContent = $el.find('[name=keyContent]'); var $keyContent = $el.find('[name=keyContent]');
$key.dropdown().parent().on('show.bs.dropdown', function() { $key.dropdown().parent().on('show.bs.dropdown', function () {
new morpheus.HeatMapColorSchemeLegend(controller, $keyContent); new morpheus.HeatMapColorSchemeLegend(controller, $keyContent);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'colorKey' eventAction: 'colorKey'
}); });
}); });
$el.find('[name=openFile]').on('click', function() { $el.find('[name=openFile]').on('click', function () {
morpheus.HeatMap.showTool(new morpheus.OpenFileTool({ morpheus.HeatMap.showTool(new morpheus.OpenFileTool({
customUrls : controller._customUrls customUrls: controller._customUrls
}), controller); }), controller);
}); });
$el.find('[name=saveImage]').on('click', function() { $el.find('[name=saveImage]').on('click', function () {
morpheus.HeatMap.showTool(new morpheus.SaveImageTool(), controller); morpheus.HeatMap.showTool(new morpheus.SaveImageTool(), controller);
}); });
$el.find('[name=saveDataset]').on('click', function() { $el.find('[name=saveDataset]').on('click', function () {
morpheus.HeatMap.showTool(new morpheus.SaveDatasetTool(), controller); morpheus.HeatMap.showTool(new morpheus.SaveDatasetTool(), controller);
}); });
$el.find('[name=chart]').on( $el.find('[name=chart]').on(
'click', 'click',
function() { function () {
new morpheus.ChartTool2({ new morpheus.ChartTool2({
project : controller.getProject(), project: controller.getProject(),
getVisibleTrackNames : _.bind( getVisibleTrackNames: _.bind(
controller.getVisibleTrackNames, controller) controller.getVisibleTrackNames, controller)
}); });
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'chart' eventAction: 'chart'
}); });
}); });
...@@ -439,12 +413,12 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -439,12 +413,12 @@ morpheus.HeatMapToolBar = function(controller) {
.find('[name=tutorial]') .find('[name=tutorial]')
.on( .on(
'click', 'click',
function() { function () {
window window
.open('http://www.broadinstitute.org/cancer/software/morpheus/tutorial.html'); .open('http://www.broadinstitute.org/cancer/software/morpheus/tutorial.html');
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'tutorial' eventAction: 'tutorial'
}); });
}); });
...@@ -471,89 +445,89 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -471,89 +445,89 @@ morpheus.HeatMapToolBar = function(controller) {
this.$searchColumnDendrogram = $el.find('[name=searchColumnDendrogram]'); this.$searchColumnDendrogram = $el.find('[name=searchColumnDendrogram]');
this.$searchResultsColumnDendrogram = $el this.$searchResultsColumnDendrogram = $el
.find('[name=searchResultsColumnDendrogram]'); .find('[name=searchResultsColumnDendrogram]');
controller.on('dendrogramAnnotated', function(e) { controller.on('dendrogramAnnotated', function (e) {
(e.isColumns ? _this.$searchColumnDendrogramWrapper (e.isColumns ? _this.$searchColumnDendrogramWrapper
: _this.$searchRowDendrogramWrapper).show(); : _this.$searchRowDendrogramWrapper).show();
}); });
controller.on('dendrogramChanged', function(e) { controller.on('dendrogramChanged', function (e) {
(e.isColumns ? _this.$searchColumnDendrogramWrapper (e.isColumns ? _this.$searchColumnDendrogramWrapper
: _this.$searchRowDendrogramWrapper).hide(); : _this.$searchRowDendrogramWrapper).hide();
}); });
var project = controller.getProject(); var project = controller.getProject();
morpheus.Util.autosuggest({ morpheus.Util.autosuggest({
$el : this.$rowTextField, $el: this.$rowTextField,
filter : function(terms, cb) { filter: function (terms, cb) {
var indices = []; var indices = [];
var meta = project.getSortedFilteredDataset().getRowMetadata(); var meta = project.getSortedFilteredDataset().getRowMetadata();
controller.getVisibleTrackNames(false).forEach(function(name) { controller.getVisibleTrackNames(false).forEach(function (name) {
indices.push(morpheus.MetadataUtil.indexOf(meta, name)); indices.push(morpheus.MetadataUtil.indexOf(meta, name));
}); });
meta = new morpheus.MetadataModelColumnView(meta, indices); meta = new morpheus.MetadataModelColumnView(meta, indices);
morpheus.MetadataUtil.autocomplete(meta)(terms, cb); morpheus.MetadataUtil.autocomplete(meta)(terms, cb);
}, },
select : function() { select: function () {
_this.search(true); _this.search(true);
} }
}); });
this.$rowTextField.on('keyup', _.debounce(function(e) { this.$rowTextField.on('keyup', _.debounce(function (e) {
if (e.which === 13) { if (e.which === 13) {
e.preventDefault(); e.preventDefault();
} }
_this.search(true); _this.search(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'searchRows' eventAction: 'searchRows'
}); });
}, 500)); }, 500));
morpheus.Util.autosuggest({ morpheus.Util.autosuggest({
$el : this.$columnTextField, $el: this.$columnTextField,
filter : function(terms, cb) { filter: function (terms, cb) {
var indices = []; var indices = [];
var meta = project.getSortedFilteredDataset().getColumnMetadata(); var meta = project.getSortedFilteredDataset().getColumnMetadata();
controller.getVisibleTrackNames(true).forEach(function(name) { controller.getVisibleTrackNames(true).forEach(function (name) {
indices.push(morpheus.MetadataUtil.indexOf(meta, name)); indices.push(morpheus.MetadataUtil.indexOf(meta, name));
}); });
meta = new morpheus.MetadataModelColumnView(meta, indices); meta = new morpheus.MetadataModelColumnView(meta, indices);
morpheus.MetadataUtil.autocomplete(meta)(terms, cb); morpheus.MetadataUtil.autocomplete(meta)(terms, cb);
}, },
select : function() { select: function () {
_this.search(false); _this.search(false);
} }
}); });
this.$columnTextField.on('keyup', _.debounce(function(e) { this.$columnTextField.on('keyup', _.debounce(function (e) {
if (e.which === 13) { if (e.which === 13) {
e.preventDefault(); e.preventDefault();
} }
_this.search(false); _this.search(false);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'searchColumns' eventAction: 'searchColumns'
}); });
}, 500)); }, 500));
// TODO combine search with autocomplete // TODO combine search with autocomplete
this.$searchRowDendrogram.on('keyup', _.debounce(function(e) { this.$searchRowDendrogram.on('keyup', _.debounce(function (e) {
if (e.which === 13) { if (e.which === 13) {
// _this.$searchRowDendrogram.autocomplete('close'); // _this.$searchRowDendrogram.autocomplete('close');
e.preventDefault(); e.preventDefault();
} }
_this.searchDendrogram(false); _this.searchDendrogram(false);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'searchRowDendrogram' eventAction: 'searchRowDendrogram'
}); });
}, 500)); }, 500));
this.$searchColumnDendrogram.on('keyup', _.debounce(function(e) { this.$searchColumnDendrogram.on('keyup', _.debounce(function (e) {
if (e.which === 13) { if (e.which === 13) {
// _this.$searchColumnDendrogram.autocomplete('close'); // _this.$searchColumnDendrogram.autocomplete('close');
e.preventDefault(); e.preventDefault();
} }
_this.searchDendrogram(true); _this.searchDendrogram(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'searchColumnDendrogram' eventAction: 'searchColumnDendrogram'
}); });
}, 500)); }, 500));
...@@ -566,26 +540,27 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -566,26 +540,27 @@ morpheus.HeatMapToolBar = function(controller) {
} else { } else {
var viewIndices = new morpheus.Set(); var viewIndices = new morpheus.Set();
morpheus.DatasetUtil.searchValues(project morpheus.DatasetUtil.searchValues(project
.getSortedFilteredDataset(), text, function(value, i, j) { .getSortedFilteredDataset(), text, function (value, i, j) {
viewIndices.add(new morpheus.Identifier([ i, j ])); viewIndices.add(new morpheus.Identifier([i, j]));
}); });
project.getElementSelectionModel().setViewIndices(viewIndices); project.getElementSelectionModel().setViewIndices(viewIndices);
$searchResultsLabel.html(viewIndices.size() + ' match' $searchResultsLabel.html(viewIndices.size() + ' match'
+ (viewIndices.size() === 1 ? '' : 'es')); + (viewIndices.size() === 1 ? '' : 'es'));
} }
} }
morpheus.Util.autosuggest({ morpheus.Util.autosuggest({
$el : this.$valueTextField, $el: this.$valueTextField,
filter : function(terms, cb) { filter: function (terms, cb) {
morpheus.DatasetUtil.autocompleteValues( morpheus.DatasetUtil.autocompleteValues(
project.getSortedFilteredDataset())(terms, cb); project.getSortedFilteredDataset())(terms, cb);
}, },
select : function() { select: function () {
searchValues(); searchValues();
} }
}); });
this.$valueTextField.on('keyup', _.debounce(function(e) { this.$valueTextField.on('keyup', _.debounce(function (e) {
if (e.which === 13) { if (e.which === 13) {
_this.$valueTextField.autocomplete('close'); _this.$valueTextField.autocomplete('close');
e.preventDefault(); e.preventDefault();
...@@ -593,59 +568,59 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -593,59 +568,59 @@ morpheus.HeatMapToolBar = function(controller) {
searchValues(); searchValues();
}, 500)); }, 500));
$toolbarForm.on('submit', function(e) { $toolbarForm.on('submit', function (e) {
e.preventDefault(); e.preventDefault();
}); });
$toolbarForm.on('click', '[name=in]', function(e) { $toolbarForm.on('click', '[name=in]', function (e) {
e.preventDefault(); e.preventDefault();
controller.zoom(true); controller.zoom(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'zoomIn' eventAction: 'zoomIn'
}); });
}); });
$toolbarForm.on('click', '[name=out]', function(e) { $toolbarForm.on('click', '[name=out]', function (e) {
e.preventDefault(); e.preventDefault();
controller.zoom(false); controller.zoom(false);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'zoomOut' eventAction: 'zoomOut'
}); });
}); });
$toolbarForm.on('click', '[name=options]', function(e) { $toolbarForm.on('click', '[name=options]', function (e) {
e.preventDefault(); e.preventDefault();
controller.showOptions(); controller.showOptions();
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'options' eventAction: 'options'
}); });
}); });
$toolbarForm.on('click', '[name=sort]', function(e) { $toolbarForm.on('click', '[name=sort]', function (e) {
e.preventDefault(); e.preventDefault();
new morpheus.SortDialog(project); new morpheus.SortDialog(project);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'sort' eventAction: 'sort'
}); });
}); });
$toolbarForm.on('click', '[name=fit]', function(e) { $toolbarForm.on('click', '[name=fit]', function (e) {
e.preventDefault(); e.preventDefault();
controller.fitToWindow(true); controller.fitToWindow(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'fit' eventAction: 'fit'
}); });
}); });
$toolbarForm.on('click', '[name=resetZoom]', function(e) { $toolbarForm.on('click', '[name=resetZoom]', function (e) {
e.preventDefault(); e.preventDefault();
controller.resetZoom(); controller.resetZoom();
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'resetZoom' eventAction: 'resetZoom'
}); });
}); });
this.$el = $el; this.$el = $el;
var updateFilterStatus = function() { var updateFilterStatus = function () {
if (controller.getProject().getRowFilter().isEnabled() if (controller.getProject().getRowFilter().isEnabled()
|| controller.getProject().getColumnFilter().isEnabled()) { || controller.getProject().getColumnFilter().isEnabled()) {
_this.$el.find('[name=filterButton]').addClass('btn-primary'); _this.$el.find('[name=filterButton]').addClass('btn-primary');
...@@ -659,14 +634,14 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -659,14 +634,14 @@ morpheus.HeatMapToolBar = function(controller) {
this.$columnMatchesToTop this.$columnMatchesToTop
.on( .on(
'click', 'click',
function(e) { function (e) {
e.preventDefault(); e.preventDefault();
var $this = $(this); var $this = $(this);
$this.toggleClass('btn-primary'); $this.toggleClass('btn-primary');
var sortKeys = project.getColumnSortKeys(); var sortKeys = project.getColumnSortKeys();
// clear existing sort keys except dendrogram // clear existing sort keys except dendrogram
sortKeys = sortKeys sortKeys = sortKeys
.filter(function(key) { .filter(function (key) {
return (key instanceof morpheus.SpecifiedModelSortOrder && key.name === 'dendrogram'); return (key instanceof morpheus.SpecifiedModelSortOrder && key.name === 'dendrogram');
}); });
if ($this.hasClass('btn-primary')) { if ($this.hasClass('btn-primary')) {
...@@ -681,14 +656,14 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -681,14 +656,14 @@ morpheus.HeatMapToolBar = function(controller) {
_this._updateSearchIndices(true); _this._updateSearchIndices(true);
_this.searching = false; _this.searching = false;
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'columnMatchesToTop' eventAction: 'columnMatchesToTop'
}); });
}); });
this.$rowMatchesToTop this.$rowMatchesToTop
.on( .on(
'click', 'click',
function(e) { function (e) {
e.preventDefault(); e.preventDefault();
var $this = $(this); var $this = $(this);
$this.toggleClass('btn-primary'); $this.toggleClass('btn-primary');
...@@ -696,7 +671,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -696,7 +671,7 @@ morpheus.HeatMapToolBar = function(controller) {
// clear existing sort keys except // clear existing sort keys except
// dendrogram // dendrogram
sortKeys = sortKeys sortKeys = sortKeys
.filter(function(key) { .filter(function (key) {
return (key instanceof morpheus.SpecifiedModelSortOrder && key.name === 'dendrogram'); return (key instanceof morpheus.SpecifiedModelSortOrder && key.name === 'dendrogram');
}); });
if ($this.hasClass('btn-primary')) { if ($this.hasClass('btn-primary')) {
...@@ -711,11 +686,11 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -711,11 +686,11 @@ morpheus.HeatMapToolBar = function(controller) {
_this._updateSearchIndices(false); _this._updateSearchIndices(false);
_this.searching = false; _this.searching = false;
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'rowMatchesToTop' eventAction: 'rowMatchesToTop'
}); });
}); });
project.on('rowSortOrderChanged.morpheus', function(e) { project.on('rowSortOrderChanged.morpheus', function (e) {
if (_this.searching) { if (_this.searching) {
return; return;
} }
...@@ -723,7 +698,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -723,7 +698,7 @@ morpheus.HeatMapToolBar = function(controller) {
_this.$rowMatchesToTop.removeClass('btn-primary'); _this.$rowMatchesToTop.removeClass('btn-primary');
}); });
project.on('columnSortOrderChanged.morpheus', function(e) { project.on('columnSortOrderChanged.morpheus', function (e) {
if (_this.searching) { if (_this.searching) {
return; return;
} }
...@@ -731,25 +706,25 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -731,25 +706,25 @@ morpheus.HeatMapToolBar = function(controller) {
_this.$columnMatchesToTop.removeClass('btn-primary'); _this.$columnMatchesToTop.removeClass('btn-primary');
}); });
controller.getProject().on('rowFilterChanged.morpheus', function(e) { controller.getProject().on('rowFilterChanged.morpheus', function (e) {
_this.search(true); _this.search(true);
updateFilterStatus(); updateFilterStatus();
}); });
controller.getProject().on('columnFilterChanged.morpheus', function(e) { controller.getProject().on('columnFilterChanged.morpheus', function (e) {
_this.search(false); _this.search(false);
updateFilterStatus(); updateFilterStatus();
}); });
controller.getProject().on('datasetChanged.morpheus', function() { controller.getProject().on('datasetChanged.morpheus', function () {
_this.search(true); _this.search(true);
_this.search(false); _this.search(false);
updateFilterStatus(); updateFilterStatus();
}); });
controller.getProject().getRowSelectionModel().on( controller.getProject().getRowSelectionModel().on(
'selectionChanged.morpheus', function() { 'selectionChanged.morpheus', function () {
_this.updateSelectionLabel(); _this.updateSelectionLabel();
}); });
controller.getProject().getColumnSelectionModel().on( controller.getProject().getColumnSelectionModel().on(
'selectionChanged.morpheus', function() { 'selectionChanged.morpheus', function () {
_this.updateSelectionLabel(); _this.updateSelectionLabel();
}); });
this.rowSearchResultViewIndicesSorted = null; this.rowSearchResultViewIndicesSorted = null;
...@@ -759,7 +734,7 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -759,7 +734,7 @@ morpheus.HeatMapToolBar = function(controller) {
this.$previousColumnMatch this.$previousColumnMatch
.on( .on(
'click', 'click',
function() { function () {
_this.currentColumnSearchIndex--; _this.currentColumnSearchIndex--;
if (_this.currentColumnSearchIndex < 0) { if (_this.currentColumnSearchIndex < 0) {
_this.currentColumnSearchIndex = _this.columnSearchResultViewIndicesSorted.length - 1; _this.currentColumnSearchIndex = _this.columnSearchResultViewIndicesSorted.length - 1;
...@@ -771,14 +746,14 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -771,14 +746,14 @@ morpheus.HeatMapToolBar = function(controller) {
.getPosition( .getPosition(
_this.columnSearchResultViewIndicesSorted[_this.currentColumnSearchIndex])); _this.columnSearchResultViewIndicesSorted[_this.currentColumnSearchIndex]));
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'previousColumnMatch' eventAction: 'previousColumnMatch'
}); });
}); });
this.$previousRowMatch this.$previousRowMatch
.on( .on(
'click', 'click',
function() { function () {
_this.currentRowSearchIndex--; _this.currentRowSearchIndex--;
if (_this.currentRowSearchIndex < 0) { if (_this.currentRowSearchIndex < 0) {
_this.currentRowSearchIndex = _this.rowSearchResultViewIndicesSorted.length - 1; _this.currentRowSearchIndex = _this.rowSearchResultViewIndicesSorted.length - 1;
...@@ -790,23 +765,23 @@ morpheus.HeatMapToolBar = function(controller) { ...@@ -790,23 +765,23 @@ morpheus.HeatMapToolBar = function(controller) {
.getPosition( .getPosition(
_this.rowSearchResultViewIndicesSorted[_this.currentRowSearchIndex])); _this.rowSearchResultViewIndicesSorted[_this.currentRowSearchIndex]));
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'previousRowMatch' eventAction: 'previousRowMatch'
}); });
}); });
this.$nextColumnMatch.on('click', function() { this.$nextColumnMatch.on('click', function () {
_this.next(true); _this.next(true);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'nextColumnMatch' eventAction: 'nextColumnMatch'
}); });
}); });
this.$nextRowMatch.on('click', function() { this.$nextRowMatch.on('click', function () {
_this.next(false); _this.next(false);
morpheus.Util.trackEvent({ morpheus.Util.trackEvent({
eventCategory : 'ToolBar', eventCategory: 'ToolBar',
eventAction : 'nextRowMatch' eventAction: 'nextRowMatch'
}); });
}); });
this.updateDimensionsLabel(); this.updateDimensionsLabel();
...@@ -817,11 +792,11 @@ morpheus.HeatMapToolBar.FILTER_SEARCH_MODE = 1; ...@@ -817,11 +792,11 @@ morpheus.HeatMapToolBar.FILTER_SEARCH_MODE = 1;
morpheus.HeatMapToolBar.MATCHES_TO_TOP_SEARCH_MODE = 2; morpheus.HeatMapToolBar.MATCHES_TO_TOP_SEARCH_MODE = 2;
morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE = 3; morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE = 3;
morpheus.HeatMapToolBar.prototype = { morpheus.HeatMapToolBar.prototype = {
quickColumnFilter : false, quickColumnFilter: false,
searching : false, searching: false,
rowSearchMode : morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE, rowSearchMode: morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE,
columnSearchMode : morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE, columnSearchMode: morpheus.HeatMapToolBar.SELECT_MATCHES_SEARCH_MODE,
_updateSearchIndices : function(isColumns) { _updateSearchIndices: function (isColumns) {
var project = this.controller.getProject(); var project = this.controller.getProject();
if (isColumns) { if (isColumns) {
var viewIndices = []; var viewIndices = [];
...@@ -833,7 +808,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -833,7 +808,7 @@ morpheus.HeatMapToolBar.prototype = {
viewIndices.push(index); viewIndices.push(index);
} }
} }
viewIndices.sort(function(a, b) { viewIndices.sort(function (a, b) {
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
this.columnSearchResultViewIndicesSorted = viewIndices; this.columnSearchResultViewIndicesSorted = viewIndices;
...@@ -847,14 +822,14 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -847,14 +822,14 @@ morpheus.HeatMapToolBar.prototype = {
viewIndices.push(index); viewIndices.push(index);
} }
} }
viewIndices.sort(function(a, b) { viewIndices.sort(function (a, b) {
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
this.rowSearchResultViewIndicesSorted = viewIndices; this.rowSearchResultViewIndicesSorted = viewIndices;
this.currentRowSearchIndex = -1; this.currentRowSearchIndex = -1;
} }
}, },
next : function(isColumns) { next: function (isColumns) {
var controller = this.controller; var controller = this.controller;
if (isColumns) { if (isColumns) {
this.currentColumnSearchIndex++; this.currentColumnSearchIndex++;
...@@ -880,7 +855,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -880,7 +855,7 @@ morpheus.HeatMapToolBar.prototype = {
this.rowSearchResultViewIndicesSorted[this.currentRowSearchIndex])); this.rowSearchResultViewIndicesSorted[this.currentRowSearchIndex]));
} }
}, },
setSearchText : function(options) { setSearchText: function (options) {
var $tf = options.isColumns ? this.$columnTextField var $tf = options.isColumns ? this.$columnTextField
: this.$rowTextField; : this.$rowTextField;
var existing = options.append ? $.trim($tf.val()) : ''; var existing = options.append ? $.trim($tf.val()) : '';
...@@ -900,7 +875,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -900,7 +875,7 @@ morpheus.HeatMapToolBar.prototype = {
// click next // click next
} }
}, },
updateDimensionsLabel : function() { updateDimensionsLabel: function () {
var p = this.controller.getProject(); var p = this.controller.getProject();
var d = p.getFullDataset(); var d = p.getFullDataset();
var f = p.getSortedFilteredDataset(); var f = p.getSortedFilteredDataset();
...@@ -910,7 +885,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -910,7 +885,7 @@ morpheus.HeatMapToolBar.prototype = {
+ morpheus.Util.intFormat(d.getColumnCount()) + ' columns'; + morpheus.Util.intFormat(d.getColumnCount()) + ' columns';
this.$dimensionsLabel.html(text); this.$dimensionsLabel.html(text);
}, },
updateSelectionLabel : function() { updateSelectionLabel: function () {
var nc = this.controller.getProject().getColumnSelectionModel().count(); var nc = this.controller.getProject().getColumnSelectionModel().count();
var nr = this.controller.getProject().getRowSelectionModel().count(); var nr = this.controller.getProject().getRowSelectionModel().count();
var text = []; var text = [];
...@@ -926,7 +901,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -926,7 +901,7 @@ morpheus.HeatMapToolBar.prototype = {
text.push(' selected'); text.push(' selected');
this.$selectionLabel.html(text.join('')); this.$selectionLabel.html(text.join(''));
}, },
searchDendrogram : function(isColumns) { searchDendrogram: function (isColumns) {
var text = $.trim(isColumns ? this.$searchColumnDendrogram.val() var text = $.trim(isColumns ? this.$searchColumnDendrogram.val()
: this.$searchRowDendrogram.val()); : this.$searchRowDendrogram.val());
var dendrogram = isColumns ? this.controller.columnDendrogram var dendrogram = isColumns ? this.controller.columnDendrogram
...@@ -962,7 +937,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -962,7 +937,7 @@ morpheus.HeatMapToolBar.prototype = {
// by // by
this.controller.revalidate(); this.controller.revalidate();
}, },
search : function(isRows) { search: function (isRows) {
this.searching = true; this.searching = true;
var isMatchesOnTop = isRows ? this.$rowMatchesToTop var isMatchesOnTop = isRows ? this.$rowMatchesToTop
.hasClass('btn-primary') : this.$columnMatchesToTop .hasClass('btn-primary') : this.$columnMatchesToTop
...@@ -992,17 +967,17 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -992,17 +967,17 @@ morpheus.HeatMapToolBar.prototype = {
var metadata = isRows ? dataset.getRowMetadata() : dataset var metadata = isRows ? dataset.getRowMetadata() : dataset
.getColumnMetadata(); .getColumnMetadata();
var visibleIndices = []; var visibleIndices = [];
controller.getVisibleTrackNames(!isRows).forEach(function(name) { controller.getVisibleTrackNames(!isRows).forEach(function (name) {
visibleIndices.push(morpheus.MetadataUtil.indexOf(metadata, name)); visibleIndices.push(morpheus.MetadataUtil.indexOf(metadata, name));
}); });
metadata = new morpheus.MetadataModelColumnView(metadata, metadata = new morpheus.MetadataModelColumnView(metadata,
visibleIndices); visibleIndices);
var searchResultViewIndices = morpheus.MetadataUtil.search({ var searchResultViewIndices = morpheus.MetadataUtil.search({
model : metadata, model: metadata,
text : searchText, text: searchText,
isColumns : !isRows, isColumns: !isRows,
defaultMatchMode : isRows ? this.defaultRowMatchMode defaultMatchMode: isRows ? this.defaultRowMatchMode
: this.defaultColumnMatchMode : this.defaultColumnMatchMode
}); });
if (searchText === '') { if (searchText === '') {
...@@ -1037,7 +1012,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -1037,7 +1012,7 @@ morpheus.HeatMapToolBar.prototype = {
if (searchResultViewIndices !== null && isMatchesOnTop) { if (searchResultViewIndices !== null && isMatchesOnTop) {
var key = new morpheus.MatchesOnTopSortKey(project, var key = new morpheus.MatchesOnTopSortKey(project,
searchResultsModelIndices, 'matches on top'); searchResultsModelIndices, 'matches on top');
sortKeys = sortKeys.filter(function(key) { sortKeys = sortKeys.filter(function (key) {
return !(key instanceof morpheus.MatchesOnTopSortKey); return !(key instanceof morpheus.MatchesOnTopSortKey);
}); });
searchResultViewIndices = key.indices; // matching indices searchResultViewIndices = key.indices; // matching indices
...@@ -1064,7 +1039,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -1064,7 +1039,7 @@ morpheus.HeatMapToolBar.prototype = {
if (isRows) { if (isRows) {
this.rowSearchResultModelIndices = searchResultsModelIndices; this.rowSearchResultModelIndices = searchResultsModelIndices;
this.rowSearchResultViewIndicesSorted = searchResultViewIndices this.rowSearchResultViewIndicesSorted = searchResultViewIndices
.sort(function(a, b) { .sort(function (a, b) {
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
this.currentRowSearchIndex = -1; this.currentRowSearchIndex = -1;
...@@ -1072,7 +1047,7 @@ morpheus.HeatMapToolBar.prototype = { ...@@ -1072,7 +1047,7 @@ morpheus.HeatMapToolBar.prototype = {
} else { } else {
this.columnSearchResultModelIndices = searchResultsModelIndices; this.columnSearchResultModelIndices = searchResultsModelIndices;
this.columnSearchResultViewIndicesSorted = searchResultViewIndices this.columnSearchResultViewIndicesSorted = searchResultViewIndices
.sort(function(a, b) { .sort(function (a, b) {
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
this.currentColumnSearchIndex = -1; this.currentColumnSearchIndex = -1;
......
morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex, morpheus.HeatMapTooltipProvider = function (heatMap, rowIndex, columnIndex,
options, separator, quick) { options, separator, quick) {
var dataset = heatMap.project.getSortedFilteredDataset(); var dataset = heatMap.project.getSortedFilteredDataset();
var tipText = []; var tipText = [];
if (!quick) { if (!quick) {
if (options.value) { // key value pairs for custom tooltip if (options.value) { // key value pairs for custom tooltip
_.each(options.value, function(pair) { _.each(options.value, function (pair) {
if (tipText.length > 0) { if (tipText.length > 0) {
tipText.push(separator); tipText.push(separator);
} }
...@@ -31,7 +31,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex, ...@@ -31,7 +31,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex,
options.showSeriesNameInTooltip || i > 0); options.showSeriesNameInTooltip || i > 0);
} }
if (quick) { if (quick) {
var quickRowTracks = heatMap.rowTracks.filter(function(t) { var quickRowTracks = heatMap.rowTracks.filter(function (t) {
return t.settings.inlineTooltip; return t.settings.inlineTooltip;
}); });
morpheus.HeatMapTooltipProvider._tracksToString(options, morpheus.HeatMapTooltipProvider._tracksToString(options,
...@@ -44,7 +44,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex, ...@@ -44,7 +44,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex,
// style="height:1px;background-color:LightGrey;"></div>'); // style="height:1px;background-color:LightGrey;"></div>');
// } // }
morpheus.HeatMapTooltipProvider._tracksToString(options, morpheus.HeatMapTooltipProvider._tracksToString(options,
heatMap.columnTracks.filter(function(t) { heatMap.columnTracks.filter(function (t) {
return t.settings.inlineTooltip; return t.settings.inlineTooltip;
}), dataset.getColumnMetadata(), columnIndex, tipText, }), dataset.getColumnMetadata(), columnIndex, tipText,
separator); separator);
...@@ -98,19 +98,19 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex, ...@@ -98,19 +98,19 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex,
} }
if (selectedRowNodes.length > 0 && rowNodes.length > 0) { if (selectedRowNodes.length > 0 && rowNodes.length > 0) {
var nodeIds = {}; var nodeIds = {};
_.each(selectedRowNodes, function(n) { _.each(selectedRowNodes, function (n) {
nodeIds[n.id] = true; nodeIds[n.id] = true;
}); });
rowNodes = _.filter(rowNodes, function(n) { rowNodes = _.filter(rowNodes, function (n) {
return nodeIds[n.id] === undefined; return nodeIds[n.id] === undefined;
}); });
} }
if (selectedColumnNodes.length > 0 && columnNodes.length > 0) { if (selectedColumnNodes.length > 0 && columnNodes.length > 0) {
var nodeIds = {}; var nodeIds = {};
_.each(selectedColumnNodes, function(n) { _.each(selectedColumnNodes, function (n) {
nodeIds[n.id] = true; nodeIds[n.id] = true;
}); });
columnNodes = _.filter(columnNodes, function(n) { columnNodes = _.filter(columnNodes, function (n) {
return nodeIds[n.id] === undefined; return nodeIds[n.id] === undefined;
}); });
} }
...@@ -134,7 +134,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex, ...@@ -134,7 +134,7 @@ morpheus.HeatMapTooltipProvider = function(heatMap, rowIndex, columnIndex,
return tipText.join(''); return tipText.join('');
}; };
morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset, morpheus.HeatMapTooltipProvider._matrixValueToString = function (dataset,
rowIndex, columnIndex, seriesIndex, tipText, separator, rowIndex, columnIndex, seriesIndex, tipText, separator,
showSeriesNameInTooltip) { showSeriesNameInTooltip) {
var val = dataset.getValue(rowIndex, columnIndex, seriesIndex); var val = dataset.getValue(rowIndex, columnIndex, seriesIndex);
...@@ -142,7 +142,21 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset, ...@@ -142,7 +142,21 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset,
if (val.toObject || !_.isNumber(val)) { if (val.toObject || !_.isNumber(val)) {
var obj = val.toObject ? val.toObject() : val; var obj = val.toObject ? val.toObject() : val;
var keys = _.keys(obj); var keys = _.keys(obj);
_.each(keys, function(key) { if (keys.length === 0) {
var v = morpheus.Util.formatObject(obj);
if (tipText.length > 0) {
tipText.push(separator);
}
if (showSeriesNameInTooltip) {
tipText.push(dataset.getName(seriesIndex));
tipText.push(': ');
}
tipText.push('<b>');
tipText.push(v);
tipText.push('</b>');
} else {
for (var i = 0, nkeys = keys.length; i < nkeys; i++) {
var key = keys[i];
if (key !== '__v') { // special value key if (key !== '__v') { // special value key
var v = morpheus.Util.formatObject(obj[key]); var v = morpheus.Util.formatObject(obj[key]);
if (tipText.length > 0) { if (tipText.length > 0) {
...@@ -153,7 +167,9 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset, ...@@ -153,7 +167,9 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset,
tipText.push(v); tipText.push(v);
tipText.push('</b>'); tipText.push('</b>');
} }
}); }
}
} else { } else {
if (tipText.length > 0) { if (tipText.length > 0) {
tipText.push(separator); tipText.push(separator);
...@@ -170,9 +186,9 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset, ...@@ -170,9 +186,9 @@ morpheus.HeatMapTooltipProvider._matrixValueToString = function(dataset,
} }
}; };
morpheus.HeatMapTooltipProvider.vectorToString = function(vector, index, morpheus.HeatMapTooltipProvider.vectorToString = function (vector, index,
tipText, separator, additionalVector) { tipText, separator, additionalVector) {
var arrayValueToString = function(arrayFieldName, arrayVal) { var arrayValueToString = function (arrayFieldName, arrayVal) {
if (arrayVal != null) { if (arrayVal != null) {
if (arrayFieldName != null) { if (arrayFieldName != null) {
if (tipText.length > 0) { if (tipText.length > 0) {
...@@ -184,7 +200,7 @@ morpheus.HeatMapTooltipProvider.vectorToString = function(vector, index, ...@@ -184,7 +200,7 @@ morpheus.HeatMapTooltipProvider.vectorToString = function(vector, index,
tipText.push(' '); tipText.push(' ');
var obj = arrayVal.toObject(); var obj = arrayVal.toObject();
var keys = _.keys(obj); var keys = _.keys(obj);
_.each(keys, function(key) { _.each(keys, function (key) {
var subVal = obj[key]; var subVal = obj[key];
if (subVal != null && subVal != '') { if (subVal != null && subVal != '') {
if (tipText.length > 0) { if (tipText.length > 0) {
...@@ -256,16 +272,14 @@ morpheus.HeatMapTooltipProvider.vectorToString = function(vector, index, ...@@ -256,16 +272,14 @@ morpheus.HeatMapTooltipProvider.vectorToString = function(vector, index,
} }
} }
}; };
morpheus.HeatMapTooltipProvider._tracksToString = function(options, tracks, morpheus.HeatMapTooltipProvider._tracksToString = function (options, tracks, metadata, index, tipText, separator) {
metadata, index, tipText, separator) {
for (var i = 0; i < tracks.length; i++) { for (var i = 0; i < tracks.length; i++) {
var vector = metadata.getByName(tracks[i].name); morpheus.HeatMapTooltipProvider.vectorToString(metadata.getByName(tracks[i].name), index, tipText,
morpheus.HeatMapTooltipProvider.vectorToString(vector, index, tipText,
separator); separator);
} }
}; };
morpheus.HeatMapTooltipProvider._metadataToString = function(options, tracks, morpheus.HeatMapTooltipProvider._metadataToString = function (options, tracks,
metadata, index, tipText, separator) { metadata, index, tipText, separator) {
var filtered = []; var filtered = [];
for (var i = 0, ntracks = tracks.length; i < ntracks; i++) { for (var i = 0, ntracks = tracks.length; i < ntracks; i++) {
...@@ -276,19 +290,17 @@ morpheus.HeatMapTooltipProvider._metadataToString = function(options, tracks, ...@@ -276,19 +290,17 @@ morpheus.HeatMapTooltipProvider._metadataToString = function(options, tracks,
} else { } else {
filtered.push(track); filtered.push(track);
} }
} }
} }
// show the vector that we're mousing over 1st // show the vector that we're mousing over 1st
morpheus.HeatMapTooltipProvider._tracksToString(options, filtered, morpheus.HeatMapTooltipProvider._tracksToString(options, filtered,
metadata, index, tipText, separator); metadata, index, tipText, separator);
}; };
morpheus.HeatMapTooltipProvider._nodesToString = function(tipText, nodes, morpheus.HeatMapTooltipProvider._nodesToString = function (tipText, nodes,
color, separator) { color, separator) {
var renderField = function(name, value) { var renderField = function (name, value) {
if (value != null) { if (value != null) {
if (tipText.length > 0) { if (tipText.length > 0) {
tipText.push(separator); tipText.push(separator);
...@@ -314,9 +326,9 @@ morpheus.HeatMapTooltipProvider._nodesToString = function(tipText, nodes, ...@@ -314,9 +326,9 @@ morpheus.HeatMapTooltipProvider._nodesToString = function(tipText, nodes,
} }
} }
}; };
_.each(nodes, function(node) { _.each(nodes, function (node) {
if (node.info) { if (node.info) {
for ( var name in node.info) { for (var name in node.info) {
var value = node.info[name]; var value = node.info[name];
renderField(name, value); renderField(name, value);
} }
......
...@@ -19,7 +19,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar, ...@@ -19,7 +19,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar,
scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer'; scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer';
var tipOptions = { var tipOptions = {
event: e, event: e,
heatMapLens: true heatMapLens: index >= 0
}; };
if (isVertical) { if (isVertical) {
controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1, controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1,
...@@ -35,6 +35,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar, ...@@ -35,6 +35,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar,
// but the canvas cursor has no effect // but the canvas cursor has no effect
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
scrollbar.canvas.style.cursor = 'default'; scrollbar.canvas.style.cursor = 'default';
controller.setToolTip(-1, -1, {event: e});
}; };
$(scrollbar.canvas).on('mousemove', mouseMove).on('mouseout', mouseExit); $(scrollbar.canvas).on('mousemove', mouseMove).on('mouseout', mouseExit);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment