Hi!
See reproduction of the issue here.
When xDomain of the chart is modified after it is mounted, BrushContext of the chart doesn't update its own ogXDomain variable. See the lines of implementation here. As ogXDomain is initialized by const ogXDomain = xDomain, it captures the initial value but loses reactivity and doesn't react to subsequent xDomain changes. Svelte doc almost about this.
That means that when the user resets brush, it resets domain to the one at the moment of mounting, which doesn't react to changes in chart's xDomain (see lines in reset() method)
One of possible workarounds is to wrap the entire chart in {#key xDomain} ... {/key}, which forces remount of the component on each xDomain change. But in case where user selects the period of data to show, all animations will re-trigger on remount (draw and all the others), which hurts UX. If this is actually desirable behaviour, I think it's worth adding a few lines about this in documentation. Thank you!
Hi!
See reproduction of the issue here.
When xDomain of the chart is modified after it is mounted, BrushContext of the chart doesn't update its own
ogXDomainvariable. See the lines of implementation here. As ogXDomain is initialized byconst ogXDomain = xDomain, it captures the initial value but loses reactivity and doesn't react to subsequent xDomain changes. Svelte doc almost about this.That means that when the user resets brush, it resets domain to the one at the moment of mounting, which doesn't react to changes in chart's xDomain (see lines in
reset()method)One of possible workarounds is to wrap the entire chart in
{#key xDomain} ... {/key}, which forces remount of the component on each xDomain change. But in case where user selects the period of data to show, all animations will re-trigger on remount (draw and all the others), which hurts UX. If this is actually desirable behaviour, I think it's worth adding a few lines about this in documentation. Thank you!