diff options
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/Histogram.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/components/Histogram.tsx | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx index 68cb768d1..89dcf87db 100644 --- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx +++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx @@ -45,7 +45,7 @@ export class Histogram extends React.Component<HistogramProps> { private maxBins = 15; // maximum number of bins that is readable on a normal sized doc @observable _currSelected: any | undefined = undefined; private curBarSelected: any = undefined; - private selectTry: any = undefined; + private selectedData: any = undefined; // TODO: nda - some sort of mapping that keeps track of the annotated points so we can easily remove when annotations list updates @computed get _histogramData() { @@ -377,32 +377,17 @@ export class Histogram extends React.Component<HistogramProps> { && showSelected[yAxisTitle]==this._currSelected![yAxisTitle]) : false; this._currSelected = sameAsCurrent? undefined: showSelected; - this.selectTry = sameAsCurrent? undefined: d; + this.selectedData = sameAsCurrent? undefined: d; return true } return false; }); - // console.log(this.curBarSelected.groups[0][0].data==selected) - const elements = document.querySelectorAll('.histogram-bar'); - for (let i = 0; i < elements.length; i++) { - elements[i].classList.remove('hover'); - } - if (!sameAsCurrent!) selected.attr('class', 'histogram-bar hover'); - if (sameAsCurrent!) { - selected.attr('class', 'histogram-bar') - this.curBarSelected = undefined; - } - else { - selected.attr('class', 'histogram-bar hover') - selected.attr('stroke', 'blue') - this.curBarSelected = selected; - } - console.log(this._currSelected) - console.log(this.selectTry) + if (sameAsCurrent!) this.curBarSelected = undefined; + else this.curBarSelected = selected; }); svg.on('click', onPointClick); - var selected = this.selectTry; + var selected = this.selectedData; svg.append("text") .attr("transform", "translate(" + (width/2) + " ," + (height+40) + ")") .style("text-anchor", "middle") @@ -435,7 +420,6 @@ export class Histogram extends React.Component<HistogramProps> { .attr("width", eachRectWidth) .attr("class", selected? function(d) { - console.log(d[0]==selected[0], d) return (selected && selected[0]==d[0])? 'histogram-bar hover' : 'histogram-bar'; }: function(d) {return 'histogram-bar'}) .attr("fill", (d)=>{ return this.props.layoutDoc['histogramBarColors-'+d[0]]? StrCast(this.props.layoutDoc['histogramBarColors-'+d[0]]) : StrCast(this.props.layoutDoc['defaultHistogramColor'])}) |