I'm trying to build a slider element (much like input range element in HTML5), using d3.js brushes.
Following up from Disable d3 brush resize post, i tried a few things however none of them are able to disable the resize behavior.
Here's my progress so far:
var width = 640,
height = 480,
margin = {
right: 30,
left: 30
}
var svg = d3.select('body')
.append('svg')
.attr('width', width)
.attr('height', height)
var xScale = d3.scaleLinear()
.domain([0, 180])
.range([0, width])
.clamp(true) //May not be required in version 5
svg.append('g')
.attr('class', 'x axis')
.attr('transform', 'translate(50,100)')
.call(d3.axisBottom()
.scale(xScale)
.tickSize(0)
.tickFormat("")
)
var brush = d3.brushX()
.extent([
[0, 0],
[width, 20]
])
.on('brush', brushed)
var brushg = svg.append('g')
.attr('class', 'brush')
.call(brush)
.attr('transform', 'translate(50,100)')
brushg.selectAll(".resize").remove();
function brushed() {
}
brush.move(brushg, [0, 20].map(xScale));
.brush .extent {
fill-opacity: .125;
shape-rendering: crispEdges;
}
g.brush>.resize {
display: none;
}
.handle {
pointer-events: none;
}
<script src="https://d3js.org/d3.v5.min.js"></script>
Also, does the below snippet (mentioned in many posts and examples) no longer work?
brush.selectAll(".resize").remove();
Is this a version specific issue? How can I disable the brush resize without over-complicating the source code in version 5 of d3?