Skip to content

Commit

Permalink
Fix for string columns breaking axes and color legend. Closes #518
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsielicki committed Oct 22, 2015
1 parent f14e92e commit 9f48dc7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
24 changes: 18 additions & 6 deletions web-server/plugins/slycat-parameter-image-plus-model/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ function setup_scatterplot()
x_label: table_metadata["column-names"][x_index],
y_label: table_metadata["column-names"][y_index],
v_label: table_metadata["column-names"][v_index],
x: x,
y: y,
v: v,
x: table_metadata["column-types"][x_index]=="string" ? x[0] : x,
y: table_metadata["column-types"][y_index]=="string" ? y[0] : y,
v: table_metadata["column-types"][v_index]=="string" ? v[0] : v,
x_string: table_metadata["column-types"][x_index]=="string",
y_string: table_metadata["column-types"][y_index]=="string",
v_string: table_metadata["column-types"][v_index]=="string",
Expand Down Expand Up @@ -1121,7 +1121,11 @@ function update_widgets_after_color_variable_change()
{
update_current_colorscale();
$("#table").table("option", "colorscale", colorscale);
$("#scatterplot").scatterplot("update_color_scale_and_v", {v : v, v_string : table_metadata["column-types"][v_index]=="string", colorscale : colorscale});
$("#scatterplot").scatterplot("update_color_scale_and_v", {
v : table_metadata["column-types"][v_index]=="string" ? v[0] : v,
v_string : table_metadata["column-types"][v_index]=="string",
colorscale : colorscale
});
$("#scatterplot").scatterplot("option", "v_label", table_metadata["column-names"][v_index]);
$("#dendrogram-viewer").dendrogram("option", "color-options", {color_array : v, colorscale : colorscale});
}
Expand Down Expand Up @@ -1336,7 +1340,11 @@ function update_scatterplot_x(variable)
attribute : variable,
success : function(result)
{
$("#scatterplot").scatterplot("option", {x_string: table_metadata["column-types"][variable]=="string", x: result, x_label:table_metadata["column-names"][variable]});
$("#scatterplot").scatterplot("option", {
x_string: table_metadata["column-types"][variable]=="string",
x: table_metadata["column-types"][variable]=="string" ? result[0] : result,
x_label:table_metadata["column-names"][variable]
});
},
error : artifact_missing
});
Expand All @@ -1352,7 +1360,11 @@ function update_scatterplot_y(variable)
attribute : variable,
success : function(result)
{
$("#scatterplot").scatterplot("option", {y_string: table_metadata["column-types"][variable]=="string", y: result, y_label:table_metadata["column-names"][variable]});
$("#scatterplot").scatterplot("option", {
y_string: table_metadata["column-types"][variable]=="string",
y: table_metadata["column-types"][variable]=="string" ? result[0] : result,
y_label:table_metadata["column-names"][variable]
});
},
error : artifact_missing
});
Expand Down
24 changes: 18 additions & 6 deletions web-server/plugins/slycat-parameter-image/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ function setup_scatterplot()
x_label: table_metadata["column-names"][x_index],
y_label: table_metadata["column-names"][y_index],
v_label: table_metadata["column-names"][v_index],
x: x,
y: y,
v: v,
x: table_metadata["column-types"][x_index]=="string" ? x[0] : x,
y: table_metadata["column-types"][y_index]=="string" ? y[0] : y,
v: table_metadata["column-types"][v_index]=="string" ? v[0] : v,
x_string: table_metadata["column-types"][x_index]=="string",
y_string: table_metadata["column-types"][y_index]=="string",
v_string: table_metadata["column-types"][v_index]=="string",
Expand Down Expand Up @@ -972,7 +972,11 @@ function update_widgets_after_color_variable_change()
{
update_current_colorscale();
$("#table").table("option", "colorscale", colorscale);
$("#scatterplot").scatterplot("update_color_scale_and_v", {v : v, v_string : table_metadata["column-types"][v_index]=="string", colorscale : colorscale});
$("#scatterplot").scatterplot("update_color_scale_and_v", {
v : table_metadata["column-types"][v_index]=="string" ? v[0] : v,
v_string : table_metadata["column-types"][v_index]=="string",
colorscale : colorscale
});
$("#scatterplot").scatterplot("option", "v_label", table_metadata["column-names"][v_index]);
}

Expand Down Expand Up @@ -1145,7 +1149,11 @@ function update_scatterplot_x(variable)
attribute : variable,
success : function(result)
{
$("#scatterplot").scatterplot("option", {x_string: table_metadata["column-types"][variable]=="string", x: result, x_label:table_metadata["column-names"][variable]});
$("#scatterplot").scatterplot("option", {
x_string: table_metadata["column-types"][variable]=="string",
x: table_metadata["column-types"][variable]=="string" ? result[0] : result,
x_label:table_metadata["column-names"][variable]
});
},
error : artifact_missing
});
Expand All @@ -1161,7 +1169,11 @@ function update_scatterplot_y(variable)
attribute : variable,
success : function(result)
{
$("#scatterplot").scatterplot("option", {y_string: table_metadata["column-types"][variable]=="string", y: result, y_label:table_metadata["column-names"][variable]});
$("#scatterplot").scatterplot("option", {
y_string: table_metadata["column-types"][variable]=="string",
y: table_metadata["column-types"][variable]=="string" ? result[0] : result,
y_label:table_metadata["column-names"][variable]
});
},
error : artifact_missing
});
Expand Down

0 comments on commit 9f48dc7

Please sign in to comment.