').text(this._errorCount).addClass("facet-range-choice-count").appendTo(errorLabel);
+
+ if (this._baseErrorCount === 0) errorCheck.removeAttr("checked");
+
+ // --------------------------
+
+ choices.appendTo(container);
};
RangeFacet.prototype._setRangeIndicators = function() {
- this._elmts.statusDiv.html(this._addCommas(this._from.toFixed(2)) + " — " + this._addCommas(this._to.toFixed(2)));
+ this._elmts.statusDiv.html(this._addCommas(this._from.toFixed(2)) + " — " + this._addCommas(this._to.toFixed(2)));
};
RangeFacet.prototype._addCommas = function(nStr) {
- nStr += '';
- x = nStr.split('.');
- x1 = x[0];
- x2 = x.length > 1 ? '.' + x[1] : '';
- var rgx = /(\d+)(\d{3})/;
- while (rgx.test(x1)) {
- x1 = x1.replace(rgx, '$1' + ',' + '$2');
- }
- return x1 + x2;
+ nStr += '';
+ x = nStr.split('.');
+ x1 = x[0];
+ x2 = x.length > 1 ? '.' + x[1] : '';
+ var rgx = /(\d+)(\d{3})/;
+ while (rgx.test(x1)) {
+ x1 = x1.replace(rgx, '$1' + ',' + '$2');
+ }
+ return x1 + x2;
};
RangeFacet.prototype.updateState = function(data) {
- if ("min" in data && "max" in data) {
- this._error = false;
-
- this._config.min = data.min;
- this._config.max = data.max;
- this._config.step = data.step;
- this._baseBins = data.baseBins;
- this._bins = data.bins;
-
- switch (this._config.mode) {
- case "min":
- this._from = Math.max(data.from, this._config.min);
- break;
- case "max":
- this._to = Math.min(data.to, this._config.max);
- break;
- default:
- this._from = Math.max(data.from, this._config.min);
- if ("to" in data) {
- this._to = Math.min(data.to, this._config.max);
- } else {
- this._to = data.max;
- }
- }
-
- this._baseNumericCount = data.baseNumericCount;
- this._baseNonNumericCount = data.baseNonNumericCount;
- this._baseBlankCount = data.baseBlankCount;
- this._baseErrorCount = data.baseErrorCount;
+ if ("min" in data && "max" in data) {
+ this._error = false;
- this._numericCount = data.numericCount;
- this._nonNumericCount = data.nonNumericCount;
- this._blankCount = data.blankCount;
- this._errorCount = data.errorCount;
+ this._config.min = data.min;
+ this._config.max = data.max;
+ this._config.step = data.step;
+ this._baseBins = data.baseBins;
+ this._bins = data.bins;
+
+ switch (this._config.mode) {
+ case "min":
+ this._from = Math.max(data.from, this._config.min);
+ break;
+ case "max":
+ this._to = Math.min(data.to, this._config.max);
+ break;
+ default:
+ this._from = Math.max(data.from, this._config.min);
+ if ("to" in data) {
+ this._to = Math.min(data.to, this._config.max);
} else {
- this._error = true;
- this._errorMessage = "error" in data ? data.error : "Unknown error.";
+ this._to = data.max;
}
-
- this.render();
+ }
+
+ this._baseNumericCount = data.baseNumericCount;
+ this._baseNonNumericCount = data.baseNonNumericCount;
+ this._baseBlankCount = data.baseBlankCount;
+ this._baseErrorCount = data.baseErrorCount;
+
+ this._numericCount = data.numericCount;
+ this._nonNumericCount = data.nonNumericCount;
+ this._blankCount = data.blankCount;
+ this._errorCount = data.errorCount;
+ } else {
+ this._error = true;
+ this._errorMessage = "error" in data ? data.error : "Unknown error.";
+ }
+
+ this.render();
};
RangeFacet.prototype.render = function() {
- if (!this._initializedUI) {
- this._initializeUI();
- this._initializedUI = true;
- }
-
- if (this._error) {
- this._elmts.messageDiv.text(this._errorMessage).show();
- this._elmts.sliderWidgetDiv.hide();
- this._elmts.histogramDiv.hide();
- this._elmts.statusDiv.hide();
- this._elmts.otherChoicesDiv.hide();
- return;
- }
-
- this._elmts.messageDiv.hide();
- this._elmts.sliderWidgetDiv.show();
- this._elmts.histogramDiv.show();
- this._elmts.statusDiv.show();
- this._elmts.otherChoicesDiv.show();
-
- this._sliderWidget.update(
- this._config.min,
- this._config.max,
- this._config.step,
- this._from,
- this._to
- );
- this._histogram.update(
- this._config.min,
- this._config.max,
- this._config.step,
- [ this._baseBins, this._bins ]
- );
-
- this._setRangeIndicators();
- this._renderOtherChoices();
+ if (!this._initializedUI) {
+ this._initializeUI();
+ this._initializedUI = true;
+ }
+
+ if (this._error) {
+ this._elmts.messageDiv.text(this._errorMessage).show();
+ this._elmts.sliderWidgetDiv.hide();
+ this._elmts.histogramDiv.hide();
+ this._elmts.statusDiv.hide();
+ this._elmts.otherChoicesDiv.hide();
+ return;
+ }
+
+ this._elmts.messageDiv.hide();
+ this._elmts.sliderWidgetDiv.show();
+ this._elmts.histogramDiv.show();
+ this._elmts.statusDiv.show();
+ this._elmts.otherChoicesDiv.show();
+
+ this._sliderWidget.update(
+ this._config.min,
+ this._config.max,
+ this._config.step,
+ this._from,
+ this._to
+ );
+ this._histogram.update(
+ this._config.min,
+ this._config.max,
+ this._config.step,
+ [ this._baseBins, this._bins ]
+ );
+
+ this._setRangeIndicators();
+ this._renderOtherChoices();
};
RangeFacet.prototype._remove = function() {
- ui.browsingEngine.removeFacet(this);
-
- this._div = null;
- this._config = null;
- this._data = null;
+ ui.browsingEngine.removeFacet(this);
+
+ this._div = null;
+ this._config = null;
+ this._data = null;
};
RangeFacet.prototype._updateRest = function() {
- Refine.update({ engineChanged: true });
+ Refine.update({ engineChanged: true });
};
RangeFacet.prototype._editExpression = function() {
- var self = this;
- var title = (this._config.columnName) ?
- ("Edit Facet's Expression based on Column " + this._config.columnName) :
- "Edit Facet's Expression";
-
- var column = Refine.columnNameToColumn(this._config.columnName);
- var o = DataTableView.sampleVisibleRows(column);
-
- new ExpressionPreviewDialog(
- title,
- column ? column.cellIndex : -1,
- o.rowIndices,
- o.values,
- this._config.expression,
- function(expr) {
+ var self = this;
+ var title = (this._config.columnName) ?
+ ("Edit Facet's Expression based on Column " + this._config.columnName) :
+ "Edit Facet's Expression";
+
+ var column = Refine.columnNameToColumn(this._config.columnName);
+ var o = DataTableView.sampleVisibleRows(column);
+
+ new ExpressionPreviewDialog(
+ title,
+ column ? column.cellIndex : -1,
+ o.rowIndices,
+ o.values,
+ this._config.expression,
+ function(expr) {
if (expr != self._config.expression) {
- self._config.expression = expr;
- self._elmts.expressionDiv.text(self._config.expression);
-
- self.reset();
- self._from = null;
- self._to = null;
- self._updateRest();
+ self._config.expression = expr;
+ self._elmts.expressionDiv.text(self._config.expression);
+
+ self.reset();
+ self._from = null;
+ self._to = null;
+ self._updateRest();
}
- }
- );
+ }
+ );
};
\ No newline at end of file
diff --git a/main/webapp/modules/core/scripts/facets/scatterplot-facet.js b/main/webapp/modules/core/scripts/facets/scatterplot-facet.js
index ff01683c6..0c58a7dfa 100644
--- a/main/webapp/modules/core/scripts/facets/scatterplot-facet.js
+++ b/main/webapp/modules/core/scripts/facets/scatterplot-facet.js
@@ -7,13 +7,13 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
+ * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
@@ -29,328 +29,328 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
function ScatterplotFacet(div, config, options) {
- this._div = div;
- this._config = config;
- this._options = options;
-
- this._error = false;
- this._initializedUI = false;
+ this._div = div;
+ this._config = config;
+ this._options = options;
+
+ this._error = false;
+ this._initializedUI = false;
}
ScatterplotFacet.prototype.update = function() {
- this._plotAreaSelector.update();
+ this._plotAreaSelector.update();
};
ScatterplotFacet.prototype.reset = function() {
- delete this._config.from_x;
- delete this._config.from_y;
- delete this._config.to_x;
- delete this._config.to_y;
- this._plotAreaSelector.setOptions({ hide : true });
- this._plotAreaSelector.update();
+ delete this._config.from_x;
+ delete this._config.from_y;
+ delete this._config.to_x;
+ delete this._config.to_y;
+ this._plotAreaSelector.setOptions({ hide : true });
+ this._plotAreaSelector.update();
};
ScatterplotFacet.reconstruct = function(div, uiState) {
- return new ScatterplotFacet(div, uiState.c, uiState.o);
+ return new ScatterplotFacet(div, uiState.c, uiState.o);
};
ScatterplotFacet.prototype.dispose = function() {
- this._elmts.plotImg.imgAreaSelect({ hide : true });
+ this._elmts.plotImg.imgAreaSelect({ hide : true });
};
ScatterplotFacet.prototype.getUIState = function() {
- var json = {
- c: this.getJSON(),
- o: this._options
- };
-
- return json;
+ var json = {
+ c: this.getJSON(),
+ o: this._options
+ };
+
+ return json;
};
ScatterplotFacet.prototype.getJSON = function() {
- this._config.type = "scatterplot";
- var dot = this._config.dot;
- if (typeof dot == 'number') this._config.dot.toFixed(2);
- return this._config;
+ this._config.type = "scatterplot";
+ var dot = this._config.dot;
+ if (typeof dot == 'number') this._config.dot.toFixed(2);
+ return this._config;
};
ScatterplotFacet.prototype.hasSelection = function() {
- return ("from_x" in this._config && this._config.from_x !== 0) ||
- ("from_y" in this._config && this._config.from_y !== 0) ||
- ("to_x" in this._config && this._config.to_x !== 1) ||
- ("to_y" in this._config && this._config.to_y !== 1);
+ return ("from_x" in this._config && this._config.from_x !== 0) ||
+ ("from_y" in this._config && this._config.from_y !== 0) ||
+ ("to_x" in this._config && this._config.to_x !== 1) ||
+ ("to_y" in this._config && this._config.to_y !== 1);
};
ScatterplotFacet.prototype._initializeUI = function() {
- var self = this;
- var container = this._div.empty().show();
-
- var facet_id = container.attr("id");
-
- this._div.empty().show().html(
- '
' +
- '
' +
- ' | ' +
- '' +
- 'reset' +
- '' +
- ' | ' +
- '
' +
- '
' +
- '
' +
- '
Loading...
' +
- '
' +
- '' +
- '' +
- ' ' +
- ' ![]() ' +
- ' ![]() ' +
- ' ' +
- ' ' +
- ' | ' +
- '' +
- '' +
- ' | ' +
- '
' +
- '
' +
- '
'
- );
- this._elmts = DOM.bind(this._div);
-
- this._elmts.titleSpan.text(this._config.name);
- this._elmts.removeButton.click(function() { self._remove(); });
- this._elmts.resetButton.click(function() {
- self.reset();
+ var self = this;
+ var container = this._div.empty().show();
+
+ var facet_id = container.attr("id");
+
+ this._div.empty().show().html(
+ '
' +
+ '
' +
+ ' | ' +
+ '' +
+ 'reset' +
+ '' +
+ ' | ' +
+ '
' +
+ '
' +
+ '
' +
+ '
Loading...
' +
+ '
' +
+ '' +
+ '' +
+ ' ' +
+ ' ![]() ' +
+ ' ![]() ' +
+ ' ' +
+ ' ' +
+ ' | ' +
+ '' +
+ '' +
+ ' | ' +
+ '
' +
+ '
' +
+ '
'
+ );
+ this._elmts = DOM.bind(this._div);
+
+ this._elmts.titleSpan.text(this._config.name);
+ this._elmts.removeButton.click(function() { self._remove(); });
+ this._elmts.resetButton.click(function() {
+ self.reset();
+ self._updateRest();
+ });
+
+ this._elmts.plotDiv.width(this._config.l + "px").height(this._config.l + "px");
+ this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl())
+ .attr("width", this._config.l)
+ .attr("height", this._config.l);
+ this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl())
+ .attr("width", this._config.l)
+ .attr("height", this._config.l);
+
+ var ops = {
+ instance: true,
+ handles: false,
+ parent: this._elmts.plotDiv,
+ fadeSpeed: 70,
+ onSelectEnd: function(elmt, selection) {
+ self._putSelectionOptions(selection);
self._updateRest();
- });
-
- this._elmts.plotDiv.width(this._config.l + "px").height(this._config.l + "px");
- this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl())
- .attr("width", this._config.l)
- .attr("height", this._config.l);
- this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl())
- .attr("width", this._config.l)
- .attr("height", this._config.l);
-
- var ops = {
- instance: true,
- handles: false,
- parent: this._elmts.plotDiv,
- fadeSpeed: 70,
- onSelectEnd: function(elmt, selection) {
- self._putSelectionOptions(selection);
- self._updateRest();
- }
- };
+ }
+ };
- this._fillSelectionOptions(ops);
- this._plotAreaSelector = this._elmts.plotImg.imgAreaSelect(ops);
-
- if (this._config.dim_x == 'lin' && this._config.dim_y == 'lin') {
- this._elmts.selectors.find("#" + facet_id + "-dim-lin").attr('checked','checked');
- } else if (this._config.dim_x == 'log' && this._config.dim_y == 'log') {
- this._elmts.selectors.find("#" + facet_id + "-dim-log").attr('checked','checked');
- }
+ this._fillSelectionOptions(ops);
+ this._plotAreaSelector = this._elmts.plotImg.imgAreaSelect(ops);
- if (this._config.r == 'cw') {
- this._elmts.selectors.find("#" + facet_id + "-rot-cw").attr('checked','checked');
- } else if (this._config.r == 'ccw') {
- this._elmts.selectors.find("#" + facet_id + "-rot-ccw").attr('checked','checked');
+ if (this._config.dim_x == 'lin' && this._config.dim_y == 'lin') {
+ this._elmts.selectors.find("#" + facet_id + "-dim-lin").attr('checked','checked');
+ } else if (this._config.dim_x == 'log' && this._config.dim_y == 'log') {
+ this._elmts.selectors.find("#" + facet_id + "-dim-log").attr('checked','checked');
+ }
+
+ if (this._config.r == 'cw') {
+ this._elmts.selectors.find("#" + facet_id + "-rot-cw").attr('checked','checked');
+ } else if (this._config.r == 'ccw') {
+ this._elmts.selectors.find("#" + facet_id + "-rot-ccw").attr('checked','checked');
+ } else {
+ this._elmts.selectors.find("#" + facet_id + "-rot-none").attr('checked','checked');
+ }
+
+ if (this._config.dot >= 1.2) {
+ this._elmts.selectors.find("#" + facet_id + "-dot-big").attr('checked','checked');
+ } else if (this._config.dot <= 0.4) {
+ this._elmts.selectors.find("#" + facet_id + "-dot-small").attr('checked','checked');
+ } else {
+ this._elmts.selectors.find("#" + facet_id + "-dot-regular").attr('checked','checked');
+ }
+
+ this._elmts.selectors.find(".scatterplot-dim-selector").change(function() {
+ var dim = $(this).find("input:checked").val();
+ self._config.dim_x = dim;
+ self._config.dim_y = dim;
+ self.reset();
+ self._updateRest();
+ self.changePlot();
+ });
+
+ this._elmts.selectors.find(".scatterplot-rot-selector").change(function() {
+ self._config.r = $(this).find("input:checked").val();
+ self.reset();
+ self._updateRest();
+ self.changePlot();
+ });
+
+ this._elmts.selectors.find(".scatterplot-dot-selector").change(function() {
+ var dot_size = $(this).find("input:checked").val();
+ if (dot_size == "small") {
+ self._config.dot = 0.4;
+ } else if (dot_size == "big") {
+ self._config.dot = 1.4;
} else {
- this._elmts.selectors.find("#" + facet_id + "-rot-none").attr('checked','checked');
+ self._config.dot = 0.8;
}
+ self.changePlot();
+ });
- if (this._config.dot >= 1.2) {
- this._elmts.selectors.find("#" + facet_id + "-dot-big").attr('checked','checked');
- } else if (this._config.dot <= 0.4) {
- this._elmts.selectors.find("#" + facet_id + "-dot-small").attr('checked','checked');
- } else {
- this._elmts.selectors.find("#" + facet_id + "-dot-regular").attr('checked','checked');
- }
-
- this._elmts.selectors.find(".scatterplot-dim-selector").change(function() {
- var dim = $(this).find("input:checked").val();
- self._config.dim_x = dim;
- self._config.dim_y = dim;
- self.reset();
- self._updateRest();
- self.changePlot();
- });
-
- this._elmts.selectors.find(".scatterplot-rot-selector").change(function() {
- self._config.r = $(this).find("input:checked").val();
- self.reset();
- self._updateRest();
- self.changePlot();
- });
-
- this._elmts.selectors.find(".scatterplot-dot-selector").change(function() {
- var dot_size = $(this).find("input:checked").val();
- if (dot_size == "small") {
- self._config.dot = 0.4;
- } else if (dot_size == "big") {
- self._config.dot = 1.4;
- } else {
- self._config.dot = 0.8;
- }
- self.changePlot();
- });
-
- this._elmts.selectors.find(".buttonset").buttonset();
+ this._elmts.selectors.find(".buttonset").buttonset();
};
ScatterplotFacet.prototype._fillSelectionOptions = function(ops) {
- if (this.hasSelection()) {
- ops.x1 = this._config.l * this._config.from_x;
- ops.x2 = this._config.l * this._config.to_x;
-
- ops.y1 = this._config.l - (this._config.l * this._config.to_y);
- ops.y2 = this._config.l - (this._config.l * this._config.from_y);
- } else {
- ops.x1 = ops.y1 = 0;
- ops.x2 = ops.y2 = this._config.l;
- ops.hide = true;
- }
+ if (this.hasSelection()) {
+ ops.x1 = this._config.l * this._config.from_x;
+ ops.x2 = this._config.l * this._config.to_x;
+
+ ops.y1 = this._config.l - (this._config.l * this._config.to_y);
+ ops.y2 = this._config.l - (this._config.l * this._config.from_y);
+ } else {
+ ops.x1 = ops.y1 = 0;
+ ops.x2 = ops.y2 = this._config.l;
+ ops.hide = true;
+ }
};
ScatterplotFacet.prototype._putSelectionOptions = function(selection) {
- if (selection.height === 0 || selection.width === 0) {
- this.reset();
- } else {
- this._config.from_x = selection.x1 / this._config.l;
- this._config.to_x = selection.x2 / this._config.l;
-
- this._config.from_y = (this._config.l - selection.y2) / this._config.l;
- this._config.to_y = (this._config.l - selection.y1) / this._config.l;
- }
+ if (selection.height === 0 || selection.width === 0) {
+ this.reset();
+ } else {
+ this._config.from_x = selection.x1 / this._config.l;
+ this._config.to_x = selection.x2 / this._config.l;
+
+ this._config.from_y = (this._config.l - selection.y2) / this._config.l;
+ this._config.to_y = (this._config.l - selection.y1) / this._config.l;
+ }
};
ScatterplotFacet.prototype._formulateCurrentImageUrl = function() {
- return this._formulateImageUrl(ui.browsingEngine.getJSON(false, this), { color: "ff6a00" });
+ return this._formulateImageUrl(ui.browsingEngine.getJSON(false, this), { color: "ff6a00" });
};
ScatterplotFacet.prototype._formulateBaseImageUrl = function() {
- return this._formulateImageUrl({},{ color: "888888", dot : this._config.dot * 0.9 });
+ return this._formulateImageUrl({},{ color: "888888", dot : this._config.dot * 0.9 });
};
ScatterplotFacet.prototype._formulateExportImageUrl = function() {
- return this._formulateImageUrl(ui.browsingEngine.getJSON(false, this), { dot : this._config.dot * 5, l: 500, base_color: "888888" });
+ return this._formulateImageUrl(ui.browsingEngine.getJSON(false, this), { dot : this._config.dot * 5, l: 500, base_color: "888888" });
};
ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) {
- var options = {};
- for (var p in this._config) {
- if (this._config.hasOwnProperty(p)) {
- options[p] = this._config[p];
- }
+ var options = {};
+ for (var p in this._config) {
+ if (this._config.hasOwnProperty(p)) {
+ options[p] = this._config[p];
}
- for (var p in conf) {
- if (conf.hasOwnProperty(p)) {
- options[p] = conf[p];
- }
+ }
+ for (var p in conf) {
+ if (conf.hasOwnProperty(p)) {
+ options[p] = conf[p];
}
- var params = {
- project: theProject.id,
- engine: JSON.stringify(engineConfig),
- plotter: JSON.stringify(options)
- };
- return "/command/core/get-scatterplot?" + $.param(params);
+ }
+ var params = {
+ project: theProject.id,
+ engine: JSON.stringify(engineConfig),
+ plotter: JSON.stringify(options)
+ };
+ return "/command/core/get-scatterplot?" + $.param(params);
};
ScatterplotFacet.prototype.updateState = function(data) {
- if ("error" in data) {
- this._error = true;
- this._errorMessage = "error" in data ? data.error : "Unknown error.";
- } else {
- this._error = false;
-
- // These are in 0 - 1 coordinates
- if ("from_x" in data) {
- this._config.from_x = Math.min(Math.max(data.from_x, 0), 1);
- } else {
- this._config.from_x = 0;
- }
- if ("to_x" in data) {
- this._config.to_x = Math.min(Math.max(data.to_x, data.from_x), 1);
- } else {
- this._config.to_x = 1;
- }
+ if ("error" in data) {
+ this._error = true;
+ this._errorMessage = "error" in data ? data.error : "Unknown error.";
+ } else {
+ this._error = false;
- if ("from_y" in data) {
- this._config.from_y = Math.min(Math.max(data.from_y, 0), 1);
- } else {
- this._config.from_y = 0;
- }
- if ("to_y" in data) {
- this._config.to_y = Math.min(Math.max(data.to_y, data.from_y), this._config.l);
- } else {
- this._config.to_y = 1;
- }
-
- if (this._plotAreaSelector) {
- var ops = {};
- this._fillSelectionOptions(ops);
- this._plotAreaSelector.setOptions(ops);
- this._plotAreaSelector.update();
- }
+ // These are in 0 - 1 coordinates
+ if ("from_x" in data) {
+ this._config.from_x = Math.min(Math.max(data.from_x, 0), 1);
+ } else {
+ this._config.from_x = 0;
}
-
- this.render();
+ if ("to_x" in data) {
+ this._config.to_x = Math.min(Math.max(data.to_x, data.from_x), 1);
+ } else {
+ this._config.to_x = 1;
+ }
+
+ if ("from_y" in data) {
+ this._config.from_y = Math.min(Math.max(data.from_y, 0), 1);
+ } else {
+ this._config.from_y = 0;
+ }
+ if ("to_y" in data) {
+ this._config.to_y = Math.min(Math.max(data.to_y, data.from_y), this._config.l);
+ } else {
+ this._config.to_y = 1;
+ }
+
+ if (this._plotAreaSelector) {
+ var ops = {};
+ this._fillSelectionOptions(ops);
+ this._plotAreaSelector.setOptions(ops);
+ this._plotAreaSelector.update();
+ }
+ }
+
+ this.render();
};
ScatterplotFacet.prototype.changePlot = function() {
- this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl());
- this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl());
- this._elmts.exportPlotLink.attr("href", this._formulateExportImageUrl());
+ this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl());
+ this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl());
+ this._elmts.exportPlotLink.attr("href", this._formulateExportImageUrl());
};
ScatterplotFacet.prototype.render = function() {
- if (!this._initializedUI) {
- this._initializeUI();
- this._initializedUI = true;
- }
-
- if (this._error) {
- this._elmts.messageDiv.text(this._errorMessage).show();
- this._elmts.plotDiv.hide();
- this._elmts.statusDiv.hide();
- return;
- }
-
- this._elmts.messageDiv.hide();
- this._elmts.plotDiv.show();
- this._elmts.statusDiv.show();
-
- this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl());
- this._elmts.exportPlotLink.attr("href", this._formulateExportImageUrl());
+ if (!this._initializedUI) {
+ this._initializeUI();
+ this._initializedUI = true;
+ }
+
+ if (this._error) {
+ this._elmts.messageDiv.text(this._errorMessage).show();
+ this._elmts.plotDiv.hide();
+ this._elmts.statusDiv.hide();
+ return;
+ }
+
+ this._elmts.messageDiv.hide();
+ this._elmts.plotDiv.show();
+ this._elmts.statusDiv.show();
+
+ this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl());
+ this._elmts.exportPlotLink.attr("href", this._formulateExportImageUrl());
};
ScatterplotFacet.prototype._remove = function() {
- ui.browsingEngine.removeFacet(this);
-
- this._div = null;
- this._config = null;
+ ui.browsingEngine.removeFacet(this);
+
+ this._div = null;
+ this._config = null;
};
ScatterplotFacet.prototype._updateRest = function() {
- Refine.update({ engineChanged: true });
+ Refine.update({ engineChanged: true });
};
diff --git a/main/webapp/modules/core/scripts/facets/text-search-facet.js b/main/webapp/modules/core/scripts/facets/text-search-facet.js
index dd273e932..67cdcc6ed 100644
--- a/main/webapp/modules/core/scripts/facets/text-search-facet.js
+++ b/main/webapp/modules/core/scripts/facets/text-search-facet.js
@@ -7,13 +7,13 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
+ * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
@@ -29,139 +29,139 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
function TextSearchFacet(div, config, options) {
- this._div = div;
- this._config = config;
- this._options = options;
-
- this._query = config.query || null;
- this._timerID = null;
-
- this._initializeUI();
+ this._div = div;
+ this._config = config;
+ this._options = options;
+
+ this._query = config.query || null;
+ this._timerID = null;
+
+ this._initializeUI();
}
TextSearchFacet.reconstruct = function(div, uiState) {
- return new TextSearchFacet(div, uiState.c, uiState.o);
+ return new TextSearchFacet(div, uiState.c, uiState.o);
};
TextSearchFacet.prototype.dispose = function() {
};
TextSearchFacet.prototype.reset = function() {
- this._query = null;
- this._div.find(".input-container input").each(function() { this.value = ""; });
+ this._query = null;
+ this._div.find(".input-container input").each(function() { this.value = ""; });
};
TextSearchFacet.prototype.getUIState = function() {
- var json = {
- c: this.getJSON(),
- o: this._options
- };
-
- return json;
+ var json = {
+ c: this.getJSON(),
+ o: this._options
+ };
+
+ return json;
};
TextSearchFacet.prototype.getJSON = function() {
- var o = {
- type: "text",
- name: this._config.name,
- columnName: this._config.columnName,
- mode: this._config.mode,
- caseSensitive: this._config.caseSensitive,
- query: this._query
- };
- return o;
+ var o = {
+ type: "text",
+ name: this._config.name,
+ columnName: this._config.columnName,
+ mode: this._config.mode,
+ caseSensitive: this._config.caseSensitive,
+ query: this._query
+ };
+ return o;
};
TextSearchFacet.prototype.hasSelection = function() {
- return this._query !== null;
+ return this._query !== null;
};
TextSearchFacet.prototype._initializeUI = function() {
- var self = this;
- this._div.empty().show().html(
- '
' +
- '
' +
- ' | ' +
- '' +
- '' + this._config.name + '' +
- ' | ' +
- '
' +
- '
' +
- '
'
- );
-
- var elmts = DOM.bind(this._div);
-
- if (this._config.caseSensitive) {
- elmts.caseSensitiveCheckbox.attr("checked", "true");
+ var self = this;
+ this._div.empty().show().html(
+ '
' +
+ '
' +
+ ' | ' +
+ '' +
+ '' + this._config.name + '' +
+ ' | ' +
+ '
' +
+ '
' +
+ '
'
+ );
+
+ var elmts = DOM.bind(this._div);
+
+ if (this._config.caseSensitive) {
+ elmts.caseSensitiveCheckbox.attr("checked", "true");
+ }
+ if (this._config.mode == "regex") {
+ elmts.regexCheckbox.attr("checked", "true");
+ }
+
+ elmts.removeButton.click(function() { self._remove(); });
+
+ elmts.caseSensitiveCheckbox.bind("change", function() {
+ self._config.caseSensitive = this.checked;
+ if (self._query !== null && self._query.length > 0) {
+ self._scheduleUpdate();
}
- if (this._config.mode == "regex") {
- elmts.regexCheckbox.attr("checked", "true");
+ });
+ elmts.regexCheckbox.bind("change", function() {
+ self._config.mode = this.checked ? "regex" : "text";
+ if (self._query !== null && self._query.length > 0) {
+ self._scheduleUpdate();
}
-
- elmts.removeButton.click(function() { self._remove(); });
-
- elmts.caseSensitiveCheckbox.bind("change", function() {
- self._config.caseSensitive = this.checked;
- if (self._query !== null && self._query.length > 0) {
- self._scheduleUpdate();
- }
- });
- elmts.regexCheckbox.bind("change", function() {
- self._config.mode = this.checked ? "regex" : "text";
- if (self._query !== null && self._query.length > 0) {
- self._scheduleUpdate();
- }
- });
-
- if (this._query) {
- elmts.input[0].value = this._query;
- }
- elmts.input.keyup(function(evt) {
- self._query = this.value;
- self._scheduleUpdate();
- }).focus();
+ });
+
+ if (this._query) {
+ elmts.input[0].value = this._query;
+ }
+ elmts.input.keyup(function(evt) {
+ self._query = this.value;
+ self._scheduleUpdate();
+ }).focus();
};
TextSearchFacet.prototype.updateState = function(data) {
};
TextSearchFacet.prototype.render = function() {
- this._setRangeIndicators();
+ this._setRangeIndicators();
};
TextSearchFacet.prototype._reset = function() {
- this._query = null;
- this._updateRest();
+ this._query = null;
+ this._updateRest();
};
TextSearchFacet.prototype._remove = function() {
- ui.browsingEngine.removeFacet(this);
-
- this._div = null;
- this._config = null;
- this._options = null;
+ ui.browsingEngine.removeFacet(this);
+
+ this._div = null;
+ this._config = null;
+ this._options = null;
};
TextSearchFacet.prototype._scheduleUpdate = function() {
- if (!this._timerID) {
- var self = this;
- this._timerID = window.setTimeout(function() {
- self._timerID = null;
- self._updateRest();
- }, 500);
- }
+ if (!this._timerID) {
+ var self = this;
+ this._timerID = window.setTimeout(function() {
+ self._timerID = null;
+ self._updateRest();
+ }, 500);
+ }
};
TextSearchFacet.prototype._updateRest = function() {
- Refine.update({ engineChanged: true });
+ Refine.update({ engineChanged: true });
};
diff --git a/main/webapp/modules/core/scripts/facets/timerange-facet.js b/main/webapp/modules/core/scripts/facets/timerange-facet.js
index 223ceaf56..e59706ca1 100644
--- a/main/webapp/modules/core/scripts/facets/timerange-facet.js
+++ b/main/webapp/modules/core/scripts/facets/timerange-facet.js
@@ -7,13 +7,13 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
+ * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
@@ -29,401 +29,401 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
function TimeRangeFacet(div, config, options) {
- this._div = div;
- this._config = config;
- this._options = options;
-
- this._from = ("from" in this._config) ? this._config.from : null;
- this._to = ("to" in this._config) ? this._config.to : null;
- this._step = ("step" in this._config) ? this._config.step : null;
-
- this._selectTime = ("selectTime" in this._config) ? this._config.selectTime : true;
- this._selectNonTime = ("selectNonTime" in this._config) ? this._config.selectNonTime : true;
- this._selectBlank = ("selectBlank" in this._config) ? this._config.selectBlank : true;
- this._selectError = ("selectError" in this._config) ? this._config.selectError : true;
-
- this._baseTimeCount = 0;
- this._baseNonTimeCount = 0;
- this._baseBlankCount = 0;
- this._baseErrorCount = 0;
-
- this._timeCount = 0;
- this._nonTimeCount = 0;
- this._blankCount = 0;
- this._errorCount = 0;
-
- this._error = false;
- this._initializedUI = false;
+ this._div = div;
+ this._config = config;
+ this._options = options;
+
+ this._from = ("from" in this._config) ? this._config.from : null;
+ this._to = ("to" in this._config) ? this._config.to : null;
+ this._step = ("step" in this._config) ? this._config.step : null;
+
+ this._selectTime = ("selectTime" in this._config) ? this._config.selectTime : true;
+ this._selectNonTime = ("selectNonTime" in this._config) ? this._config.selectNonTime : true;
+ this._selectBlank = ("selectBlank" in this._config) ? this._config.selectBlank : true;
+ this._selectError = ("selectError" in this._config) ? this._config.selectError : true;
+
+ this._baseTimeCount = 0;
+ this._baseNonTimeCount = 0;
+ this._baseBlankCount = 0;
+ this._baseErrorCount = 0;
+
+ this._timeCount = 0;
+ this._nonTimeCount = 0;
+ this._blankCount = 0;
+ this._errorCount = 0;
+
+ this._error = false;
+ this._initializedUI = false;
}
TimeRangeFacet.prototype.reset = function() {
- this._from = this._config.min;
- this._to = this._config.max;
- this._sliderWidget.update(
- this._config.min,
- this._config.max,
- this._config.step,
- this._from,
- this._to
- );
-
- this._selectTime = true;
- this._selectNonTime = true;
- this._selectBlank = true;
- this._selectError = true;
-
- this._setRangeIndicators();
+ this._from = this._config.min;
+ this._to = this._config.max;
+ this._sliderWidget.update(
+ this._config.min,
+ this._config.max,
+ this._config.step,
+ this._from,
+ this._to
+ );
+
+ this._selectTime = true;
+ this._selectNonTime = true;
+ this._selectBlank = true;
+ this._selectError = true;
+
+ this._setRangeIndicators();
};
TimeRangeFacet.reconstruct = function(div, uiState) {
- return new TimeRangeFacet(div, uiState.c, uiState.o);
+ return new TimeRangeFacet(div, uiState.c, uiState.o);
};
TimeRangeFacet.prototype.dispose = function() {
};
TimeRangeFacet.prototype.getUIState = function() {
- var json = {
- c: this.getJSON(),
- o: this._options
- };
-
- return json;
+ var json = {
+ c: this.getJSON(),
+ o: this._options
+ };
+
+ return json;
};
TimeRangeFacet.prototype.getJSON = function() {
- var o = {
- type: "timerange",
- name: this._config.name,
- expression: this._config.expression,
- columnName: this._config.columnName,
- selectTime: this._selectTime,
- selectNonTime: this._selectNonTime,
- selectBlank: this._selectBlank,
- selectError: this._selectError
- };
-
- if (this._from !== null) {
- o.from = this._from;
- }
- if (this._to !== null) {
- o.to = this._to;
- }
-
- return o;
+ var o = {
+ type: "timerange",
+ name: this._config.name,
+ expression: this._config.expression,
+ columnName: this._config.columnName,
+ selectTime: this._selectTime,
+ selectNonTime: this._selectNonTime,
+ selectBlank: this._selectBlank,
+ selectError: this._selectError
+ };
+
+ if (this._from !== null) {
+ o.from = this._from;
+ }
+ if (this._to !== null) {
+ o.to = this._to;
+ }
+
+ return o;
};
TimeRangeFacet.prototype.hasSelection = function() {
- if (!this._selectTime || !this._selectNonTime || !this._selectBlank || !this._selectError) {
- return true;
- }
-
- return (this._from !== null && (!this._initializedUI || this._from > this._config.min)) ||
- (this._to !== null && (!this._initializedUI || this._to < this._config.max));
+ if (!this._selectTime || !this._selectNonTime || !this._selectBlank || !this._selectError) {
+ return true;
+ }
+
+ return (this._from !== null && (!this._initializedUI || this._from > this._config.min)) ||
+ (this._to !== null && (!this._initializedUI || this._to < this._config.max));
};
TimeRangeFacet.prototype._initializeUI = function() {
- var self = this;
- this._div
- .empty()
- .show()
- .html(
- '
' +
- '
' +
- ' | ' +
- '' +
- 'reset' +
- 'change' +
- '' +
- ' | ' +
- '
' +
- '
' +
- '
' +
- '
' +
- '
Loading...
' +
- '
' +
- '
' +
- '
' +
- '
'
- );
- this._elmts = DOM.bind(this._div);
-
- this._elmts.facetTitle.text(this._config.name);
- this._elmts.changeButton.attr("title","Current Expression: " + this._config.expression).click(function() {
- self._elmts.expressionDiv.slideToggle(100, function() {
- if (self._elmts.expressionDiv.css("display") != "none") {
- self._editExpression();
- }
- });
- });
- this._elmts.expressionDiv.text(this._config.expression).click(function() {
- self._editExpression();
- }).hide();
-
- this._elmts.resetButton.click(function() {
- self.reset();
- self._updateRest();
- });
- this._elmts.removeButton.click(function() {
- self._remove();
- });
-
- this._histogram = new HistogramWidget(this._elmts.histogramDiv, { binColors: [ "#ccccff", "#6666ff" ] });
- this._sliderWidget = new SliderWidget(this._elmts.sliderWidgetDiv);
-
- this._elmts.sliderWidgetDiv.bind("slide", function(evt, data) {
- self._from = data.from;
- self._to = data.to;
- self._setRangeIndicators();
- }).bind("stop", function(evt, data) {
- self._from = data.from;
- self._to = data.to;
- self._selectTime = true;
- self._updateRest();
+ var self = this;
+ this._div
+ .empty()
+ .show()
+ .html(
+ '
' +
+ '
' +
+ ' | ' +
+ '' +
+ 'reset' +
+ 'change' +
+ '' +
+ ' | ' +
+ '
' +
+ '
' +
+ '
' +
+ '
' +
+ '
Loading...
' +
+ '
' +
+ '
' +
+ '
' +
+ '
'
+ );
+ this._elmts = DOM.bind(this._div);
+
+ this._elmts.facetTitle.text(this._config.name);
+ this._elmts.changeButton.attr("title","Current Expression: " + this._config.expression).click(function() {
+ self._elmts.expressionDiv.slideToggle(100, function() {
+ if (self._elmts.expressionDiv.css("display") != "none") {
+ self._editExpression();
+ }
});
+ });
+ this._elmts.expressionDiv.text(this._config.expression).click(function() {
+ self._editExpression();
+ }).hide();
+
+ this._elmts.resetButton.click(function() {
+ self.reset();
+ self._updateRest();
+ });
+ this._elmts.removeButton.click(function() {
+ self._remove();
+ });
+
+ this._histogram = new HistogramWidget(this._elmts.histogramDiv, { binColors: [ "#ccccff", "#6666ff" ] });
+ this._sliderWidget = new SliderWidget(this._elmts.sliderWidgetDiv);
+
+ this._elmts.sliderWidgetDiv.bind("slide", function(evt, data) {
+ self._from = data.from;
+ self._to = data.to;
+ self._setRangeIndicators();
+ }).bind("stop", function(evt, data) {
+ self._from = data.from;
+ self._to = data.to;
+ self._selectTime = true;
+ self._updateRest();
+ });
};
TimeRangeFacet.prototype._renderOtherChoices = function() {
- var self = this;
- var container = this._elmts.otherChoicesDiv.empty();
-
- if (this._baseNonTimeCount === 0 && this._baseBlankCount === 0 && this._baseErrorCount === 0) {
- return;
- }
+ var self = this;
+ var container = this._elmts.otherChoicesDiv.empty();
- var facet_id = this._div.attr("id");
-
- var choices = $('
').addClass("facet-range-choices");
+ if (this._baseNonTimeCount === 0 && this._baseBlankCount === 0 && this._baseErrorCount === 0) {
+ return;
+ }
- // ----------------- time -----------------
-
- var timeDiv = $('
').appendTo(choices);
- var timeCheck = $('
').attr("id",facet_id + "-time").appendTo(timeDiv).change(function() {
- self._selectTime = !self._selectTime;
- self._updateRest();
- });
- if (this._selectTime) timeCheck.attr("checked","checked");
-
- var timeLabel = $('