Hooked scatterplots up to generate the right facets.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@458 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
e232a90a73
commit
666bcdbf8d
@ -1,8 +1,8 @@
|
||||
function ScatterplotDialog() {
|
||||
this._createDialog();
|
||||
this._plot_method = "lin";
|
||||
this._plot_size = 20;
|
||||
this._dot_size = 0.1;
|
||||
this._createDialog();
|
||||
}
|
||||
|
||||
ScatterplotDialog.prototype._createDialog = function() {
|
||||
@ -22,7 +22,7 @@ ScatterplotDialog.prototype._createDialog = function() {
|
||||
).appendTo(frame);
|
||||
|
||||
var html = $(
|
||||
'<div class="grid-layout layout-normal"><table width="100%">' +
|
||||
'<div class="grid-layout layout-normal layout-full"><table>' +
|
||||
'<tr>' +
|
||||
'<td>' +
|
||||
'<span class="clustering-dialog-controls">Plot type: <select bind="plotSelector">' +
|
||||
@ -92,8 +92,14 @@ ScatterplotDialog.prototype._renderMatrix = function() {
|
||||
if (columns.length > 0) {
|
||||
var table = $('<table></table>').addClass("scatterplot-matrix-table")[0];
|
||||
|
||||
var wrap = function(element,cx,cy) {
|
||||
return element.click(function() {
|
||||
var createScatterplot = function(i, j) {
|
||||
var cx = columns[i].name;
|
||||
var cy = columns[j].name;
|
||||
|
||||
var name = cx + ' (x) vs. ' + cy + ' (y)';
|
||||
var link = $('<a href="javascript:{}"></a>')
|
||||
.attr("title", name)
|
||||
.click(function() {
|
||||
var options = {
|
||||
"name" : name,
|
||||
"x_columnName" : cx,
|
||||
@ -104,13 +110,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
|
||||
ui.browsingEngine.addFacet("scatterplot", options);
|
||||
//self._dismiss();
|
||||
});
|
||||
};
|
||||
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
for (var j = 0; j < i; j++) {
|
||||
var cx = columns[i].name;
|
||||
var cy = columns[j].name;
|
||||
var plotter_params = {
|
||||
'cx' : cx,
|
||||
'cy' : cy,
|
||||
@ -123,21 +123,32 @@ ScatterplotDialog.prototype._renderMatrix = function() {
|
||||
project: theProject.id,
|
||||
engine: JSON.stringify(ui.browsingEngine.getJSON()),
|
||||
plotter: JSON.stringify(plotter_params)
|
||||
}
|
||||
};
|
||||
var url = "/command/get-scatterplot?" + $.param(params);
|
||||
var name = cx + ' (x) vs. ' + cy + ' (y)';
|
||||
var cell = $(tr.insertCell(j));
|
||||
var link = wrap($('<a href="javascript:{}"></a>').attr("title",name),cx,cy);
|
||||
var plot = $('<img src="' + url + '" />').addClass("scatterplot").appendTo(link);
|
||||
link.appendTo(cell);
|
||||
}
|
||||
$(tr.insertCell(i)).text(columns[i]);
|
||||
for (var j = i + 1; j < columns.length; j++) {
|
||||
$(tr.insertCell(j)).text(" ");
|
||||
}
|
||||
var plot = $('<img src="' + url + '" />')
|
||||
.addClass("scatterplot")
|
||||
.attr("width", self._plot_size)
|
||||
.attr("height", self._plot_size)
|
||||
.appendTo(link);
|
||||
|
||||
return link;
|
||||
};
|
||||
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
for (var j = 0; j < i; j++) {
|
||||
$(tr.insertCell(j)).append(createScatterplot(i,j));
|
||||
}
|
||||
|
||||
container.empty().append(table);
|
||||
var tdColumnName = $(tr.insertCell(tr.cells.length));
|
||||
tdColumnName
|
||||
.text(columns[i].name)
|
||||
.css("text-align", "left")
|
||||
.attr("colspan", columns.length - i);
|
||||
}
|
||||
|
||||
var width = container.width();
|
||||
container.empty().css("width", width + "px").append(table);
|
||||
|
||||
} else {
|
||||
container.html(
|
||||
|
@ -1,6 +1,6 @@
|
||||
.scatterplot-dialog-table-container {
|
||||
height: 500px;
|
||||
overflow: auto;
|
||||
overflow: scroll;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user