Commit 8b84e88d authored by Joshua Gould's avatar Joshua Gould

show new fields as text

parent 2e24c0f1
/*!
* clipboard.js v1.5.7
* clipboard.js v1.5.10
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){var r=t("matches-selector");e.exports=function(t,e,n){for(var o=n?t:t.parentNode;o&&o!==document;){if(r(o,e))return o;o=o.parentNode}}},{"matches-selector":5}],2:[function(t,e,n){function r(t,e,n,r,i){var a=o.apply(this,arguments);return t.addEventListener(n,a,i),{destroy:function(){t.removeEventListener(n,a,i)}}}function o(t,e,n,r){return function(n){n.delegateTarget=i(n.target,e,!0),n.delegateTarget&&r.call(t,n)}}var i=t("closest");e.exports=r},{closest:1}],3:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],4:[function(t,e,n){function r(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return o(t,e,n);if(c.nodeList(t))return i(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function i(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return s(document.body,t,e,n)}var c=t("./is"),s=t("delegate");e.exports=r},{"./is":3,delegate:2}],5:[function(t,e,n){function r(t,e){if(i)return i.call(t,e);for(var n=t.parentNode.querySelectorAll(e),r=0;r<n.length;++r)if(n[r]==t)return!0;return!1}var o=Element.prototype,i=o.matchesSelector||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=r},{}],6:[function(t,e,n){function r(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r),e=n.toString()}return e}e.exports=r},{}],7:[function(t,e,n){function r(){}r.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function r(){o.off(t,r),e.apply(n,arguments)}var o=this;return r._=e,this.on(t,r,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;for(r;o>r;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t("select"),c=r(a),s=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){if(this.text&&this.target)throw new Error('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)throw new Error('Missing required attributes, use either "target" or "text"');this.selectTarget()}},t.prototype.selectFake=function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return e.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=c.default(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=c.default(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},i(t,[{key:"action",set:function t(){var e=arguments.length<=0||void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!=typeof e||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');this._target=e}},get:function t(){return this._target}}]),t}();n.default=s,e.exports=n.default},{select:6}],9:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}n.__esModule=!0;var c=t("./clipboard-action"),s=r(c),u=t("tiny-emitter"),l=r(u),f=t("good-listener"),d=r(f),h=function(t){function e(n,r){o(this,e),t.call(this),this.resolveOptions(r),this.listenClick(n)}return i(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},e.prototype.listenClick=function t(e){var n=this;this.listener=d.default(e,"click",function(t){return n.onClick(t)})},e.prototype.onClick=function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})},e.prototype.defaultAction=function t(e){return a("action",e)},e.prototype.defaultTarget=function t(e){var n=a("target",e);return n?document.querySelector(n):void 0},e.prototype.defaultText=function t(e){return a("text",e)},e.prototype.destroy=function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(l.default);n.default=h,e.exports=n.default},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)});
\ No newline at end of file
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(c,a){if(!n[c]){if(!e[c]){var s="function"==typeof require&&require;if(!a&&s)return s(c,!0);if(r)return r(c,!0);var l=new Error("Cannot find module '"+c+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[c]={exports:{}};e[c][0].call(u.exports,function(t){var n=e[c][1][t];return i(n?n:t)},u,u.exports,t,e,n,o)}return n[c].exports}for(var r="function"==typeof require&&require,c=0;c<o.length;c++)i(o[c]);return i}({1:[function(t,e,n){var o=t("matches-selector");e.exports=function(t,e,n){for(var i=n?t:t.parentNode;i&&i!==document;){if(o(i,e))return i;i=i.parentNode}}},{"matches-selector":5}],2:[function(t,e,n){function o(t,e,n,o,r){var c=i.apply(this,arguments);return t.addEventListener(n,c,r),{destroy:function(){t.removeEventListener(n,c,r)}}}function i(t,e,n,o){return function(n){n.delegateTarget=r(n.target,e,!0),n.delegateTarget&&o.call(t,n)}}var r=t("closest");e.exports=o},{closest:1}],3:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],4:[function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!a.string(e))throw new TypeError("Second argument must be a String");if(!a.fn(n))throw new TypeError("Third argument must be a Function");if(a.node(t))return i(t,e,n);if(a.nodeList(t))return r(t,e,n);if(a.string(t))return c(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function c(t,e,n){return s(document.body,t,e,n)}var a=t("./is"),s=t("delegate");e.exports=o},{"./is":3,delegate:2}],5:[function(t,e,n){function o(t,e){if(r)return r.call(t,e);for(var n=t.parentNode.querySelectorAll(e),o=0;o<n.length;++o)if(n[o]==t)return!0;return!1}var i=Element.prototype,r=i.matchesSelector||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector;e.exports=o},{}],6:[function(t,e,n){function o(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o),e=n.toString()}return e}e.exports=o},{}],7:[function(t,e,n){function o(){}o.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;i>o;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,c=o.length;c>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var c={exports:{}};r(c,i.select),i.clipboardAction=c.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),a=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){this.text?this.selectFake():this.target&&this.selectTarget()},t.prototype.selectFake=function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return e.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="fixed",this.fakeElem.style[n?"right":"left"]="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=(0,i.default)(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},c(t,[{key:"action",set:function t(){var e=arguments.length<=0||void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==("undefined"==typeof e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=a})},{select:6}],9:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var c={exports:{}};r(c,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=c.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=i(e),u=i(n),f=i(o),d=function(t){function e(n,o){r(this,e);var i=c(this,t.call(this));return i.resolveOptions(o),i.listenClick(n),i}return a(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},e.prototype.listenClick=function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})},e.prototype.onClick=function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})},e.prototype.defaultAction=function t(e){return s("action",e)},e.prototype.defaultTarget=function t(e){var n=s("target",e);return n?document.querySelector(n):void 0},e.prototype.defaultText=function t(e){return s("text",e)},e.prototype.destroy=function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(u.default);t.exports=d})},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)});
\ No newline at end of file
......@@ -151,7 +151,9 @@ morpheus.VectorUtil.getValues = function (vector, excludeNull) {
if (excludeNull && val == null) {
continue;
}
set.add(val);
}
var array = set.values();
array.sort(morpheus.SortKey.ASCENDING_COMPARATOR);
......
......@@ -294,7 +294,7 @@ morpheus.OpenFileTool.prototype = {
metadataName, fileColumnName);
var render = [];
for (var i = 0; i < vectors.length; i++) {
render.push('color');
render.push('text');
}
controller.getProject().trigger('trackChanged', {
vectors : vectors,
......@@ -331,4 +331,4 @@ morpheus.OpenFileTool.prototype = {
};
morpheus.HeatMap.showTool(promptTool, controller);
}
};
\ No newline at end of file
};
......@@ -4,7 +4,7 @@
* @param stops
* An array of objects with value and color
*/
morpheus.HeatMapColorScheme = function(project, scheme) {
morpheus.HeatMapColorScheme = function (project, scheme) {
this.project = project;
var that = this;
......@@ -13,173 +13,173 @@ morpheus.HeatMapColorScheme = function(project, scheme) {
this.value = null;
if (scheme) {
this.rowValueToColorSupplier[null] = morpheus.HeatMapColorScheme
.createColorSupplier(scheme);
.createColorSupplier(scheme);
this.currentColorSupplier = this.rowValueToColorSupplier[this.value];
}
project
.on(
'rowFilterChanged columnFilterChanged rowSortOrderChanged columnSortOrderChanged datasetChanged',
function() {
that.projectUpdated();
});
.on(
'rowFilterChanged columnFilterChanged rowSortOrderChanged columnSortOrderChanged datasetChanged',
function () {
that.projectUpdated();
});
this.projectUpdated();
};
morpheus.HeatMapColorScheme.Predefined = {};
morpheus.HeatMapColorScheme.Predefined.SUMMLY = function() {
morpheus.HeatMapColorScheme.Predefined.SUMMLY = function () {
return {
type : 'fixed',
map : [ {
value : -100,
color : 'blue'
type: 'fixed',
map: [{
value: -100,
color: 'blue'
}, {
value : -90,
color : 'white'
value: -98,
color: 'white'
}, {
value : 98,
color : 'white'
value: 98,
color: 'white'
}, {
value : 100,
color : 'red'
} ]
value: 100,
color: 'red'
}]
};
};
morpheus.HeatMapColorScheme.Predefined.SUMMLY2 = function() {
morpheus.HeatMapColorScheme.Predefined.SUMMLY2 = function () {
return {
type : 'fixed',
map : [ {
value : -100,
color : 'blue'
type: 'fixed',
map: [{
value: -100,
color: 'blue'
}, {
value : -90,
color : '#abdda4'
value: -98,
color: '#abdda4'
}, {
value : -80,
color : 'white'
value: -95,
color: 'white'
}, {
value : 80,
color : 'white'
value: 95,
color: 'white'
}, {
value : 90,
color : '#fdae61'
value: 98,
color: '#fdae61'
}, {
value : 100,
color : 'red'
} ]
value: 100,
color: 'red'
}]
};
};
morpheus.HeatMapColorScheme.Predefined.SUMMLY3 = function() {
morpheus.HeatMapColorScheme.Predefined.SUMMLY3 = function () {
return {
type : 'fixed',
map : [ {
value : -100,
color : 'blue'
type: 'fixed',
map: [{
value: -100,
color: 'blue'
}, {
value : -90,
color : '#abdda4'
value: -90,
color: '#abdda4'
}, {
value : -80,
color : '#e6f598'
value: -80,
color: '#e6f598'
}, {
value : -70,
color : 'white'
value: -70,
color: 'white'
}, {
value : 70,
color : 'white'
value: 70,
color: 'white'
}, {
value : 80,
color : '#fee08b'
value: 80,
color: '#fee08b'
}, {
value : 90,
color : '#fdae61'
value: 90,
color: '#fdae61'
}, {
value : 100,
color : 'red'
} ]
value: 100,
color: 'red'
}]
};
};
morpheus.HeatMapColorScheme.Predefined.CN = function() {
morpheus.HeatMapColorScheme.Predefined.CN = function () {
return {
type : 'fixed',
map : [ {
value : -2,
color : 'blue'
type: 'fixed',
map: [{
value: -2,
color: 'blue'
}, {
value : -0.1,
color : 'white'
value: -0.1,
color: 'white'
}, {
value : 0.1,
color : 'white'
value: 0.1,
color: 'white'
}, {
value : 2,
color : 'red'
} ]
value: 2,
color: 'red'
}]
};
};
morpheus.HeatMapColorScheme.Predefined.BINARY = function() {
morpheus.HeatMapColorScheme.Predefined.BINARY = function () {
return {
type : 'fixed',
map : [ {
value : 0,
color : 'white'
type: 'fixed',
map: [{
value: 0,
color: 'white'
}, {
value : 1,
color : 'black'
} ]
value: 1,
color: 'black'
}]
};
};
morpheus.HeatMapColorScheme.Predefined.RELATIVE = function() {
morpheus.HeatMapColorScheme.Predefined.RELATIVE = function () {
return {
type : 'relative'
type: 'relative'
};
};
morpheus.HeatMapColorScheme.Predefined.MAF = function() {
morpheus.HeatMapColorScheme.Predefined.MAF = function () {
// coMut plot colors
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var toHex = function(rgb) {
var toHex = function (rgb) {
ctx.fillStyle = rgb;
return ctx.fillStyle;
};
return {
type : 'fixed',
stepped : true,
map : [ {
value : 0,
color : toHex('rgb(' + [ 255, 255, 255 ].join(',') + ')')
type: 'fixed',
stepped: true,
map: [{
value: 0,
color: toHex('rgb(' + [255, 255, 255].join(',') + ')')
}, {
value : 1,
color : toHex('rgb(' + [ 77, 175, 74 ].join(',') + ')'),
name : 'Synonymous'
value: 1,
color: toHex('rgb(' + [77, 175, 74].join(',') + ')'),
name: 'Synonymous'
}, {
value : 2,
color : toHex('rgb(' + [ 255, 255, 51 ].join(',') + ')'),
name : 'In Frame Indel'
value: 2,
color: toHex('rgb(' + [255, 255, 51].join(',') + ')'),
name: 'In Frame Indel'
}, {
value : 3,
color : toHex('rgb(' + [ 166, 86, 40 ].join(',') + ')'),
name : 'Other Non-Synonymous'
value: 3,
color: toHex('rgb(' + [166, 86, 40].join(',') + ')'),
name: 'Other Non-Synonymous'
}, {
value : 4,
color : toHex('rgb(' + [ 55, 126, 184 ].join(',') + ')'),
name : 'Missense'
value: 4,
color: toHex('rgb(' + [55, 126, 184].join(',') + ')'),
name: 'Missense'
}, {
value : 5,
color : toHex('rgb(' + [ 152, 78, 163 ].join(',') + ')'),
name : 'Splice Site'
value: 5,
color: toHex('rgb(' + [152, 78, 163].join(',') + ')'),
name: 'Splice Site'
}, {
value : 6,
color : toHex('rgb(' + [ 255, 127, 0 ].join(',') + ')'),
name : 'Frame Shift'
value: 6,
color: toHex('rgb(' + [255, 127, 0].join(',') + ')'),
name: 'Frame Shift'
}, {
value : 7,
color : toHex('rgb(' + [ 228, 26, 28 ].join(',') + ')'),
name : 'Nonsense'
} ]
value: 7,
color: toHex('rgb(' + [228, 26, 28].join(',') + ')'),
name: 'Nonsense'
}]
};
};
// morpheus.HeatMapColorScheme.Predefined.MAF_NEW = function() {
......@@ -228,62 +228,62 @@ morpheus.HeatMapColorScheme.Predefined.MAF = function() {
// } ]
// };
// };
morpheus.HeatMapColorScheme.Predefined.ZS = function() {
morpheus.HeatMapColorScheme.Predefined.ZS = function () {
return {
type : 'fixed',
map : [ {
value : -10,
color : 'blue'
type: 'fixed',
map: [{
value: -10,
color: 'blue'
}, {
value : -2,
color : 'white'
value: -2,
color: 'white'
}, {
value : 2,
color : 'white'
value: 2,
color: 'white'
}, {
value : 10,
color : 'red'
} ]
value: 10,
color: 'red'
}]
};
};
morpheus.HeatMapColorScheme.ScalingMode = {
RELATIVE : 0,
FIXED : 1
RELATIVE: 0,
FIXED: 1
};
morpheus.HeatMapConditions = function() {
morpheus.HeatMapConditions = function () {
this.conditions = [];
// each condition is a object with fields: series, shape, color and
// accept(val) function
};
morpheus.HeatMapConditions.prototype = {
insert : function(index, c) {
insert: function (index, c) {
this.conditions.splice(index, 0, c);
},
getConditions : function() {
getConditions: function () {
return this.conditions;
},
remove : function(index) {
remove: function (index) {
this.conditions.splice(index, 1);
},
copy : function() {
copy: function () {
var c = new morpheus.HeatMapConditions();
this.conditions.forEach(function(cond) {
this.conditions.forEach(function (cond) {
c.conditions.push(_.clone(cond));
});
return c;
}
};
morpheus.HeatMapSizer = function() {
morpheus.HeatMapSizer = function () {
this._seriesName = null;
this._sizeByScale = d3.scale.linear().domain([ this._min, this._max ])
.range([ 0, 1 ]).clamp(true);
this._sizeByScale = d3.scale.linear().domain([this._min, this._max])
.range([0, 1]).clamp(true);
};
morpheus.HeatMapSizer.prototype = {
_min : 0,
_max : 1,
copy : function() {
_min: 0,
_max: 1,
copy: function () {
var sizer = new morpheus.HeatMapSizer();
sizer._seriesName = this._seriesName;
sizer._min = this._mini;
......@@ -291,39 +291,39 @@ morpheus.HeatMapSizer.prototype = {
sizer._sizeByScale = this._sizeByScale.copy();
return sizer;
},
valueToFraction : function(value) {
valueToFraction: function (value) {
return this._sizeByScale(value);
},
setMin : function(min) {
setMin: function (min) {
this._min = min;
this._sizeByScale = d3.scale.linear().domain([ this._min, this._max ])
.range([ 0, 1 ]).clamp(true);
this._sizeByScale = d3.scale.linear().domain([this._min, this._max])
.range([0, 1]).clamp(true);
},
setMax : function(max) {
setMax: function (max) {
this._max = max;
this._sizeByScale = d3.scale.linear().domain([ this._min, this._max ])
.range([ 0, 1 ]).clamp(true);
this._sizeByScale = d3.scale.linear().domain([this._min, this._max])
.range([0, 1]).clamp(true);
},
getMin : function() {
getMin: function () {
return this._min;
},
getMax : function() {
getMax: function () {
return this._max;
},
getSeriesName : function() {
getSeriesName: function () {
return this._seriesName;
},
setSeriesName : function(name) {
setSeriesName: function (name) {
this._seriesName = name;
}
};
morpheus.HeatMapColorScheme.createColorSupplier = function(options) {
morpheus.HeatMapColorScheme.createColorSupplier = function (options) {
var type = options.type;
var stepped = options.stepped;
var map = options.map;
var scalingMode;
var colorSupplier = stepped ? new morpheus.SteppedColorSupplier()
: new morpheus.GradientColorSupplier();
: new morpheus.GradientColorSupplier();
if (type === 'fixed') {
scalingMode = morpheus.HeatMapColorScheme.ScalingMode.FIXED;
if (map) { // get min/max
......@@ -348,8 +348,8 @@ morpheus.HeatMapColorScheme.createColorSupplier = function(options) {
var colors = [];
var names = [];
var valueToFraction = d3.scale.linear().domain(
[ colorSupplier.getMin(), colorSupplier.getMax() ]).range(
[ 0, 1 ]).clamp(true);
[colorSupplier.getMin(), colorSupplier.getMax()]).range(
[0, 1]).clamp(true);
var hasNames = false;
for (var i = 0; i < map.length; i++) {
fractions.push(valueToFraction(map[i].value));
......@@ -361,92 +361,92 @@ morpheus.HeatMapColorScheme.createColorSupplier = function(options) {
names.push(name);
}
colorSupplier.setFractions({
fractions : fractions,
colors : colors,
names : hasNames ? names : null
fractions: fractions,
colors: colors,
names: hasNames ? names : null
});
}
return colorSupplier;
};
morpheus.HeatMapColorScheme.prototype = {
getColors : function() {
getColors: function () {
return this.currentColorSupplier.getColors();
},
setMissingColor : function(color) {
setMissingColor: function (color) {
this.currentColorSupplier.setMissingColor(color);
},
getHiddenValues : function() {
getHiddenValues: function () {
return this.currentColorSupplier.getHiddenValues ? this.currentColorSupplier
.getHiddenValues()
: null;
.getHiddenValues()
: null;
},
getMissingColor : function() {
getMissingColor: function () {
return this.currentColorSupplier.getMissingColor();
},
getScalingMode : function() {
getScalingMode: function () {
return this.currentColorSupplier.getScalingMode();
},
getSizer : function() {
getSizer: function () {
return this.currentColorSupplier.getSizer();
},
getConditions : function() {
getConditions: function () {
return this.currentColorSupplier.getConditions();
},
setScalingMode : function(scalingMode) {
setScalingMode: function (scalingMode) {
this.currentColorSupplier.setScalingMode(scalingMode);
},
getFractions : function() {
getFractions: function () {
return this.currentColorSupplier.getFractions();
},
getNames : function() {
getNames: function () {
return this.currentColorSupplier.getNames();
},
getMin : function() {
getMin: function () {
return this.currentColorSupplier.getMin();
},
getMax : function() {
getMax: function () {
return this.currentColorSupplier.getMax();
},
setMin : function(min) {
setMin: function (min) {
this.currentColorSupplier.setMin(min);
},
setMax : function(max) {
setMax: function (max) {
this.currentColorSupplier.setMax(max);
},
isStepped : function() {
isStepped: function () {
return this.currentColorSupplier.isStepped();
},
isDiscrete : function() {
isDiscrete: function () {
return this.currentColorSupplier.isDiscrete();
},
setFractions : function(options) {
setFractions: function (options) {
this.currentColorSupplier.setFractions(options);
},
setStepped : function(stepped) {
setStepped: function (stepped) {
var oldColorSupplier = this.currentColorSupplier;
var newColorSupplier = stepped ? new morpheus.SteppedColorSupplier()
: new morpheus.GradientColorSupplier();
: new morpheus.GradientColorSupplier();
newColorSupplier.sizer = oldColorSupplier.getSizer();
newColorSupplier.conditions = oldColorSupplier.getConditions();
newColorSupplier.setScalingMode(oldColorSupplier.getScalingMode());
newColorSupplier.setMin(oldColorSupplier.getMin());
newColorSupplier.setMax(oldColorSupplier.getMax());
newColorSupplier.setFractions({
fractions : oldColorSupplier.getFractions(),
colors : oldColorSupplier.getColors()
fractions: oldColorSupplier.getFractions(),
colors: oldColorSupplier.getColors()
});
this.currentColorSupplier = newColorSupplier;
this.rowValueToColorSupplier[this.value] = this.currentColorSupplier;
},
toJson : function() {
toJson: function () {
var json = {};
var _this = this;
if (this.separateColorSchemeForRowMetadataField != null) {
json.separateColorSchemeForRowMetadataField = this.separateColorSchemeForRowMetadataField;
}
json.colorSchemes = {};
_.each(_.keys(this.rowValueToColorSupplier), function(key) {
_.each(_.keys(this.rowValueToColorSupplier), function (key) {
// save each scheme
var val = _this.rowValueToColorSupplier[key];
// delete val.sizer;
......@@ -457,38 +457,38 @@ morpheus.HeatMapColorScheme.prototype = {
return JSON.stringify(json);
},
fromJson : function(json) {
fromJson: function (json) {
var _this = this;
if (json.separateColorSchemeForRowMetadataField) {
this.separateColorSchemeForRowMetadataField = json.separateColorSchemeForRowMetadataField;
this.vector = this.project.getSortedFilteredDataset()
.getRowMetadata().getByName(
this.separateColorSchemeForRowMetadataField);
.getRowMetadata().getByName(
this.separateColorSchemeForRowMetadataField);
}
this.rowValueToColorSupplier = {};
_.each(_.keys(json.colorSchemes), function(key) {
_.each(_.keys(json.colorSchemes), function (key) {
var colorSupplier = morpheus.AbstractColorSupplier
.fromJson(json.colorSchemes[key]);
.fromJson(json.colorSchemes[key]);
_this.rowValueToColorSupplier[key] = colorSupplier;
});
this._ensureColorSupplierExists();
},
copy : function(project) {
copy: function (project) {
var _this = this;
var c = new morpheus.HeatMapColorScheme(project);
c.separateColorSchemeForRowMetadataField = this.separateColorSchemeForRowMetadataField;
if (c.separateColorSchemeForRowMetadataField != null) {
c.vector = project.getSortedFilteredDataset().getRowMetadata()
.getByName(c.separateColorSchemeForRowMetadataField);
.getByName(c.separateColorSchemeForRowMetadataField);
}
if (c.vector == null) {
c.separateColorSchemeForRowMetadataField = null;
}
_.each(_.keys(this.rowValueToColorSupplier), function(key) {
_.each(_.keys(this.rowValueToColorSupplier), function (key) {
c.rowValueToColorSupplier[key] = _this.rowValueToColorSupplier[key]
.copy();
.copy();
});
c.value = this.value;
......@@ -496,63 +496,62 @@ morpheus.HeatMapColorScheme.prototype = {
return c;
},
setSeparateColorSchemeForRowMetadataField : function(
separateColorSchemeForRowMetadataField) {
setSeparateColorSchemeForRowMetadataField: function (separateColorSchemeForRowMetadataField) {
if (separateColorSchemeForRowMetadataField != this.separateColorSchemeForRowMetadataField) {
this.separateColorSchemeForRowMetadataField = separateColorSchemeForRowMetadataField;
this.vector = this.project.getSortedFilteredDataset()
.getRowMetadata().getByName(
separateColorSchemeForRowMetadataField);
.getRowMetadata().getByName(
separateColorSchemeForRowMetadataField);
var that = this;
_.each(_.keys(this.rowValueToColorSupplier), function(key) {
_.each(_.keys(this.rowValueToColorSupplier), function (key) {
// remove old color schemes
delete that.rowValueToColorSupplier[key];
});
}
},
getProject : function() {
getProject: function () {
return this.project;
},
getSeparateColorSchemeForRowMetadataField : function() {
getSeparateColorSchemeForRowMetadataField: function () {
return this.separateColorSchemeForRowMetadataField;
},
getColorByValues : function() {
getColorByValues: function () {
return _.keys(this.rowValueToColorSupplier);
},
projectUpdated : function() {
projectUpdated: function () {
var dataset = this.project.getSortedFilteredDataset();
if (this.separateColorSchemeForRowMetadataField != null) {
this.vector = this.project.getSortedFilteredDataset()
.getRowMetadata().getByName(
this.separateColorSchemeForRowMetadataField);
.getRowMetadata().getByName(
this.separateColorSchemeForRowMetadataField);
}
this.cachedRowStats = new morpheus.RowStats(dataset);
},
/**
* @private
*/
_ensureColorSupplierExists : function() {
_ensureColorSupplierExists: function () {
this.currentColorSupplier = this.rowValueToColorSupplier[this.value];
if (this.currentColorSupplier === undefined) {
var cs = morpheus.HeatMapColorScheme.createColorSupplier({
type : 'relative'
type: 'relative'
});
this.rowValueToColorSupplier[this.value] = cs;
this.currentColorSupplier = cs;
}
},
setColorSupplierForCurrentValue : function(colorSupplier) {
setColorSupplierForCurrentValue: function (colorSupplier) {
this.rowValueToColorSupplier[this.value] = colorSupplier;
this.currentColorSupplier = colorSupplier;
},
setCurrentValue : function(value) {
setCurrentValue: function (value) {
this.value = value;
this._ensureColorSupplierExists();
},
isSizeBy : function() {
isSizeBy: function () {
this.currentColorSupplier.isSizeBy();
},
getColor : function(row, column, val) {
getColor: function (row, column, val) {
if (this.vector !== undefined) {
var tmp = this.vector.getValue(row);
if (this.value !== tmp) {
......@@ -563,22 +562,22 @@ morpheus.HeatMapColorScheme.prototype = {
if (this.currentColorSupplier.getScalingMode() === morpheus.HeatMapColorScheme.ScalingMode.RELATIVE) {
if (this.cachedRowStats.maybeUpdate(row)) {
this.currentColorSupplier
.setMin(this.cachedRowStats.rowCachedMin);
.setMin(this.cachedRowStats.rowCachedMin);
this.currentColorSupplier
.setMax(this.cachedRowStats.rowCachedMax);
.setMax(this.cachedRowStats.rowCachedMax);
}
}
return this.currentColorSupplier.getColor(row, column, val);
}
};
morpheus.RowStats = function(dataset) {
morpheus.RowStats = function (dataset) {
this.datasetRowView = new morpheus.DatasetRowView(dataset);
this.cachedRow = -1;
this.rowCachedMax = 0;
this.rowCachedMin = 0;
};
morpheus.RowStats.prototype = {
maybeUpdate : function(row) {
maybeUpdate: function (row) {
if (this.cachedRow !== row) {
this.cachedRow = row;
this.datasetRowView.setIndex(row);
......@@ -588,9 +587,9 @@ morpheus.RowStats.prototype = {
var d = this.datasetRowView.getValue(j);
if (!isNaN(d)) {
this.rowCachedMax = d > this.rowCachedMax ? d
: this.rowCachedMax;
: this.rowCachedMax;
this.rowCachedMin = d < this.rowCachedMin ? d
: this.rowCachedMin;
: this.rowCachedMin;
}
}
if (this.rowCachedMin === this.rowCachedMax) {
......@@ -600,4 +599,4 @@ morpheus.RowStats.prototype = {
}
return false;
}
};
\ No newline at end of file
};
......@@ -37,10 +37,10 @@ morpheus.HeatMapOptions = function (controller) {
name: 'fixed (-1.5, -0.1, 0.1, 1.5)',
value: 'cn'
}, {
name: 'fixed (-90, -80, 80, 90)',
name: 'fixed (-100, -98, -95, 95, 98, 100)',
value: '100scale2'
}, {
name: 'fixed (-90, 90)',
name: 'fixed (-100, -98, 98, 100)',
value: '100scale1'
}]
}, {
......
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