React-vis: Zoomable chart / xDomain chart overflow

Created on 27 Sep 2017  路  7Comments  路  Source: uber/react-vis

When you use the xDomain to "zoom" in a chart, the path overflows the chart region.

Notice in the zoomable example:
https://uber.github.io/react-vis/examples/charts/zoomable-chart

image

See on the left how the lines "overflow" into the y axis.

Most helpful comment

Following up here - ran into the same issue. Would be great to intuitively fix this rather than expect everyone to apply a hack :) (it also doesn't entirely work, as it was chopping off things near the top and bottom edges of the chart, and only setting padding on the left side resulted in ugly black borders on the other three sides)

All 7 comments

I use the Borders component to fix this. Example:

<XYPlot
    width={800}
    height={600}
    xDomain={xDomain}
>
    {series.map((serie) => <LineSeries
        key={serie.id}
        data={serie.data}
        color={serie.color}
    />)}
    <Borders style={{all: {fill: '#fff'}}} />
    <XAxis />
    <YAxis />
</XYPlot>

Cool. Yea that solves the problem for me.

Should we close this?

Following up here - ran into the same issue. Would be great to intuitively fix this rather than expect everyone to apply a hack :) (it also doesn't entirely work, as it was chopping off things near the top and bottom edges of the chart, and only setting padding on the left side resulted in ugly black borders on the other three sides)

Using borders component didn't work for me. This issue is still ongoing...

Agreed that this issue is ongoing, looks as though the chart takes into account the axes when it is not zoomed, but when it is zoomed the axes are forgotten.

The border hack worked for me but it matters where you place it in your code. Regardless, I do agree that there should be a better solution than this hack. 馃檲 Perhaps a prop someone can pass in to enable or disable overflow?

I would accept a PR adding a prop to the highlight component that constrains it to be within the margins. Something like stayInsideMargins={true/false}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samhogg picture samhogg  路  4Comments

zavrick picture zavrick  路  4Comments

martoncsikos picture martoncsikos  路  4Comments

Tom-Gorup picture Tom-Gorup  路  3Comments

stroemdev picture stroemdev  路  4Comments