Skip to content

Commit

Permalink
Brushing bugfix and committing old fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwarchol committed Aug 18, 2022
1 parent 0591b53 commit 02731dc
Show file tree
Hide file tree
Showing 9 changed files with 1,786 additions and 1,606 deletions.
17 changes: 14 additions & 3 deletions minerva_analysis/client/dist/vendor_bundle.js

Large diffs are not rendered by default.

3,165 changes: 1,625 additions & 1,540 deletions minerva_analysis/client/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions minerva_analysis/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"d3-svg-legend": "^2.25.6",
"expose-loader": "^1.0.0",
"file-loader": "^6.0.0",
"file-saver": "^2.0.5",
"ify-loader": "^1.1.0",
"install": "^0.13.0",
"jquery": "^3.5.1",
Expand Down
28 changes: 27 additions & 1 deletion minerva_analysis/client/src/js/services/dataLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,32 @@ class DataLayer {
}
}

async downloadNeighborhood(d) {
try {
let response = await fetch('/download_neighborhood', {
method: 'POST',
headers: {
'Content-Type': 'text/csv'

},
responseType: 'blob',

body: JSON.stringify(
{
datasource: datasource,
elem: {
'id': d[0]
}
})
});
let response_data = await response.blob();
saveAs(response_data, `${datasource}_${d[2]}.csv`);

} catch (e) {
console.log("Error Downloading Neighborhood", e);
}
}

async getNeighborhood(id) {
try {
let response = await fetch('/get_neighborhood', {
Expand Down Expand Up @@ -495,7 +521,7 @@ class DataLayer {
}
}

async customCluster(numClusters, subsample=true) {
async customCluster(numClusters, subsample = true) {
try {
let response = await fetch('/custom_cluster?' + new URLSearchParams({
datasource: datasource,
Expand Down
4 changes: 4 additions & 0 deletions minerva_analysis/client/src/js/vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import store from "store2";

import {annotation} from 'd3-svg-annotation';
import {legendColor} from 'd3-svg-legend'
import {saveAs} from 'file-saver';

import colorbrewer from 'colorbrewer';
import 'lodash';
import 'jquery-form';
Expand All @@ -27,6 +29,7 @@ import 'viawebgl'
import * as viaWebGL from 'viawebgl';
import {ViewerManager} from './views/viewerManager';
import concaveman from 'concaveman';

window.d3 = Object.assign(d3base, {legendColor, sliderBottom, annotation});
window.convert = convert;
window.$ = $;
Expand All @@ -44,5 +47,6 @@ window.ViewerManager = ViewerManager;
window.createScatterplot = createScatterplot;
window.concaveman = concaveman;
window.store = store;
window.saveAs = saveAs;
// window.GridStack = GridStack;

20 changes: 17 additions & 3 deletions minerva_analysis/client/src/js/views/neighborhoodTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class NeighborhoodTable {

let enteredCol = nameCol.enter()
.append('td')
.attr('class', 'name-col col-8');
.attr('class', 'name-col col-7');
enteredCol
.append('div')
.attr('class', 'row')
Expand Down Expand Up @@ -130,7 +130,7 @@ class NeighborhoodTable {

actionsCol.enter()
.append('td')
.attr('class', 'actions-column col-4')
.attr('class', 'actions-column col-5')
.append('div')
.attr('class', 'row actions-row justify-content-end')
.datum(d => d)
Expand Down Expand Up @@ -177,7 +177,21 @@ class NeighborhoodTable {
.append('span')
.attr('class', 'fas fa-trash delete_neighborhood neighborhood-table-icon');

trashIcon.exit().remove();
let downloadIcon = d3.select(self.table).selectAll('.actions-row').selectAll('.download_neighborhood_col')
.data(d => {
return [d];
});
downloadIcon.enter()
.append('div')
.attr('class', 'col-sm-auto neighborhood_icon_col download_neighborhood_col')
.on('click', (e, d) => {
return self.dataLayer.downloadNeighborhood(d);

})
.append('span')
.attr('class', 'fas fa-download download_neighborhood neighborhood-table-icon');

downloadIcon.exit().remove();
self.eventHandler.trigger(NeighborhoodTable.events.updateSavedNeighborhoods, null);
}

Expand Down
19 changes: 6 additions & 13 deletions minerva_analysis/client/src/js/views/parallel_coordinates.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ class ParallelCoordinates {
})
.classed("par_cor_label", true)
.style("fill", d => {
console.log(d.key, self.colorScheme.colorMap[d.key])
return self.colorScheme.colorMap[d.key].hex;
})
.attr('fill-opacity', d => {
Expand Down Expand Up @@ -675,15 +676,15 @@ class ParallelCoordinates {
console.log('switching')
self.editMode = !self.editMode;
self.draw();
// self.svgGroup.selectAll(".value-slider-group")
// .classed("hidden", !self.editMode)
// .classed("visible", self.editMode)
console.log('Edit Mode,', self.editMode)

if (self.editMode) {
// self.svgGroup.selectAll(".average_path")
// .attr("stroke-width", 0)
self.svgGroup.selectAll(".brush").remove();
self.svgGroup.selectAll(".average_path")
.attr("stroke-width", 2)
document.getElementById('neighborhood_current_selection').innerText = "Composition";
} else {
self.drawBrush();
}
_.each(document.querySelectorAll('.handler'), elem => {
if (self.editMode) {
Expand All @@ -692,14 +693,6 @@ class ParallelCoordinates {
elem.style.cursor = 'default';
}
})
//
// _.each(document.querySelectorAll('.viewfinder_chart_label_g_g_text_g'), elem => {
// if (self.editMode) {
// elem.style.cursor = 'pointer';
// } else {
// elem.style.cursor = 'default';
// }
// })
}

enableOrDisablePhenotype(e, d) {
Expand Down
Loading

0 comments on commit 02731dc

Please sign in to comment.