In an object I store line chart made with d3.js, which have possibility to brush selected area.
Selected area is removed when I click outside selected part of line chart.
I'd like to remove selected area clicking on external link eg. [reset]
Unfortunately even if I access brush object from line chart object calling clear()
on brush
object doesn't remove selection.
How can I remove brush selection using external link from outside line chart?
I create brush:
this.brush = d3.svg.brush()
.x(xScale)
.on('brushstart', function() {
lineChart.brushStart();
})
.on('brushend', function() {
lineChart.brushEnd();
});
I create brushing area:
this.brushArea = svg.append('svg:g')
.attr('class', 'brush')
.call(this.brush)
.selectAll('rect')
.attr('height', this.height);
On external link I put clear()
command:
<span onclick="javascript: lineChart.brush.clear();">[reset]</span>
It doesn't remove selection from line chart.
Please help.
Documentation about brush.clear()
is not efficient.