Search code examples
javascriptcssd3.jsbrush

Extent set to zero when you click the background


I am using d3 to create a brush timeline much in the same way as this example. If you hover over the top axis of the selection part of the chart, you notice that the cursor changes to a crosshair. When you click it, the brush will disappear because it sets the extant to empty. Is there any way I can disable this? I want to make sure the brush never simply disappears. Thank you for your help!


Solution

  • My solution was to edit .on("brushend", funtion(){...}) to check for an empty brush and reset values if it is empty. This insures that the user can never have an empty brush. If anyone has questions about how to do this exactly, please let me know!