Skip to content

Commit

Permalink
Disable interactivity on grids with no feature counts
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyzhen committed Nov 3, 2023
1 parent ea92cab commit 86ed525
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
50 changes: 34 additions & 16 deletions src/LandingPage/components/figure1c.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ const omeLabels = [
'METHYL',
];

const assayMap = {
METAB: 'Metabolomics',
IMMUNO: 'Immunoassays',
UBIQ: 'Ubiquitylome',
ACETYL: 'Acetylproteomics',
PHOSPHO: 'Phosphoproteomics',
PROT: 'Global proteomics',
TRNSCRPT: 'RNA-Seq',
ATAC: 'ATAC-seq',
METHYL: 'RRBS',
};

const omeColors = [
{ type: 'Genomics', color: '#FC8D62' },
{ type: 'Proteomics', color: '#8DA0CB' },
Expand Down Expand Up @@ -130,25 +142,31 @@ function Figure1C() {
.attr('class', 'heatmap-tooltip');

// Tooltip functions
const onMouseOver = (event) => {
d3.select(event.currentTarget).attr('rx', 12).attr('ry', 12);
const onMouseOver = (event, d) => {
if (d.featureCnt !== null) {
d3.select(event.currentTarget).attr('rx', 12).attr('ry', 12);
}
};
const onMouseMove = (event, d) => {
tooltip
.html(
'Tissue: ' +
figureTissueProps[d.tissue].label +
'<br/>Assay: ' +
d.ome,
)
.style('top', event.pageY - 60 + 'px')
.style('left', event.pageX + 'px');
tooltip.transition().duration(100).style('opacity', 1);
d3.select(this).style('opacity', 1);
if (d.featureCnt !== null) {
tooltip
.html(
'Tissue: ' +
figureTissueProps[d.tissue].label +
'<br/>Assay: ' +
assayMap[d.ome],
)
.style('top', event.pageY - 60 + 'px')
.style('left', event.pageX + 'px');
tooltip.transition().duration(100).style('opacity', 1);
d3.select(this).style('opacity', 1);
}
};
const onMouseLeave = (event) => {
tooltip.transition().duration(100).style('opacity', 0);
d3.select(event.currentTarget).attr('rx', 4).attr('ry', 4);
const onMouseLeave = (event, d) => {
if (d.featureCnt !== null) {
tooltip.transition().duration(100).style('opacity', 0);
d3.select(event.currentTarget).attr('rx', 4).attr('ry', 4);
}
};

// Draw squares
Expand Down
2 changes: 1 addition & 1 deletion src/LandingPage/components/figureTissueProps.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
]
},
"TESTES": {
"label": "Testis",
"label": "Testes",
"hoverLabelColor": "#6D86A5",
"hoverLabelTextColor": "#FFFFFF",
"assays": [
Expand Down

0 comments on commit 86ed525

Please sign in to comment.