diff --git a/src/pages/resultsView/enrichments/GeneBarPlot.tsx b/src/pages/resultsView/enrichments/GeneBarPlot.tsx index 387bfa9e2c7..270f4ac29b3 100644 --- a/src/pages/resultsView/enrichments/GeneBarPlot.tsx +++ b/src/pages/resultsView/enrichments/GeneBarPlot.tsx @@ -37,8 +37,6 @@ export interface IGeneBarPlotProps { dataStore: EnrichmentsTableDataStore; } -const SVG_ID = 'GroupComparisonGeneFrequencyPlot'; - const DEFAULT_GENES_COUNT = 10; const MAXIMUM_ALLOWED_GENES = 100; @@ -57,6 +55,7 @@ export default class GeneBarPlot extends React.Component< @observable selectedGenes: SingleGeneQuery[] | undefined; @observable _label: GeneOptionLabel | undefined; @observable isGeneSelectionPopupVisible: boolean | undefined = false; + @observable private svgContainer: SVGElement | null; @computed get geneListOptions() { return getGeneListOptions(this.props.data, this.props.showCNAInTable); @@ -138,11 +137,6 @@ export default class GeneBarPlot extends React.Component< return _.flatMap(this.barPlotOrderedGenes, gene => [gene + '*', gene]); } - @autobind - private getSvg() { - return document.getElementById(SVG_ID) as SVGElement | null; - } - @autobind private getTooltip(datum: any) { let geneSymbol = datum.majorCategory as string; @@ -271,8 +265,8 @@ export default class GeneBarPlot extends React.Component< this.svgContainer} + filename={'GroupComparisonGeneFrequencyPlot'} dontFade={true} type="button" /> @@ -307,7 +301,6 @@ export default class GeneBarPlot extends React.Component< {this.toolbar}
(this.svgContainer = ref)} />
diff --git a/src/shared/components/plots/MultipleCategoryBarPlot.tsx b/src/shared/components/plots/MultipleCategoryBarPlot.tsx index 1aed0af1cea..c129b997cf4 100644 --- a/src/shared/components/plots/MultipleCategoryBarPlot.tsx +++ b/src/shared/components/plots/MultipleCategoryBarPlot.tsx @@ -55,6 +55,7 @@ export interface IMultipleCategoryBarPlotProps { axisStyle?: any; countAxisLabel?: string; tooltip?: (datum: any) => JSX.Element; + containerRef?: (svgContainer: SVGElement | null) => void; } export interface IMultipleCategoryBarPlotData { @@ -846,6 +847,11 @@ export default class MultipleCategoryBarPlot extends React.Component< role="img" viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`} onMouseMove={this.onMouseMove} + ref={ref => { + if (this.props.containerRef) { + this.props.containerRef(ref); + } + }} >