Victory: voronoi + zoom container zooming with data changes does not update correctly

Created on 2 Oct 2017  路  6Comments  路  Source: FormidableLabs/victory

From @jmansor

It works fine unless you zoom first, if you zoom, the scale remains fixed
https://jsfiddle.net/6jrqyL6f/2/

The container prop of VictorySharedEvents gets it's domain prop updated correctly (matching the new dataset)
But its child VictoryZoomVoronoiContainer keeps the old domain

Most helpful comment

When you not only set the domain on the VictoryChart, but also set the zoomDomain on the VictoryZoomContainer (or the mixin in the case above), the problem went away for us.

All 6 comments

Some more data:

The structure is like this:

<VictoryChart>
    <VictorySharedEvents>
        <VictoryZoomVoronoiContainer>

When changing the dataset, VictorySharedEvents.props.container.props.domain is set correctly with a domain that suits the new dataset. But VictorySharedEvents.state.parent.domain keeps the old domain value.
VictoryZoomVoronoiContainer.props.domain keeps the old domain value as well.

More on this:

screen shot 2017-10-06 at 15 43 03

The problem seems to be related to events, in this case specifically with the onMouseWheel, it receives the targetProps with the old domain.

The attached screenshot is the result of this console.error (that I've added) in victory-shared-events.js

var parentProps = _defaults({}, this.getEventState("parent", "parent"), containerProps, this.baseProps.parent, { children: children })
console.error(this.getEventState("parent", "parent"), containerProps)

Because of the way _.defaults work, the getEventState result will set the value of the domain prop.

However I was unable to figure out where are the targetProps argument of the event is coming from. If you can provide some guidance, would be of great help.

Is there any workaround for this issue besides just forcing the whole chart to unmount before re-rendering?

When you not only set the domain on the VictoryChart, but also set the zoomDomain on the VictoryZoomContainer (or the mixin in the case above), the problem went away for us.

Any progress on this?

We are still having this issue and we are unmounting and mounting the chart every time but this has super low performance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pruhstal picture pruhstal  路  4Comments

icd2k3 picture icd2k3  路  3Comments

tylermassey picture tylermassey  路  5Comments

captDaylight picture captDaylight  路  5Comments

seddonm1 picture seddonm1  路  5Comments