React-vis: Scaling large yRange values

Created on 30 Aug 2017  路  3Comments  路  Source: uber/react-vis

I'm using react-vis 1.7.4
My yRange is [199740, 200400] and I'm just getting a wall of bars w/ no relative difference because everything is being scaled compared to a yRange of [0, 200400]

https://www.webpackbin.com/bins/-Ksoencaj2nvtlGMdKtA

How to fix this? I tried declaring the yRange but that just made the entire graph disappear.

Thanks for your help...

Most helpful comment

Hey @Falieson

You need to modify your example just a little bit to make it work. First you need to be using yDomain, not yRange. domain refers to the scope of the values that are coming in, and range refers to the pixels being output. Secondly there is a weird quirk with modifying where the barChart "starts", in that you need to provide a "baseValue". So all told your chart should look like this

 return (
      <XYPlot
        height={480}
        xType='time'
        width={500}
yDomain={[yRange.min, yRange.max]}
yBaseValue={yRange.min}
      >
        <HorizontalGridLines />
        <VerticalBarSeries data={xyData} />
        <XAxis />
        <YAxis />
      </XYPlot>
    )

That said, I'm a frequent contributor of this library and that took me quite a while to figure out. I going to open a PR to remove the baseValue property because it seems like it is redundant to domain.

All 3 comments

Hey @Falieson

You need to modify your example just a little bit to make it work. First you need to be using yDomain, not yRange. domain refers to the scope of the values that are coming in, and range refers to the pixels being output. Secondly there is a weird quirk with modifying where the barChart "starts", in that you need to provide a "baseValue". So all told your chart should look like this

 return (
      <XYPlot
        height={480}
        xType='time'
        width={500}
yDomain={[yRange.min, yRange.max]}
yBaseValue={yRange.min}
      >
        <HorizontalGridLines />
        <VerticalBarSeries data={xyData} />
        <XAxis />
        <YAxis />
      </XYPlot>
    )

That said, I'm a frequent contributor of this library and that took me quite a while to figure out. I going to open a PR to remove the baseValue property because it seems like it is redundant to domain.

Should now be resolved in 1.7.5!

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcnuttandrew picture mcnuttandrew  路  3Comments

kbouaazzi-ds picture kbouaazzi-ds  路  3Comments

cvalmonte picture cvalmonte  路  4Comments

mcnuttandrew picture mcnuttandrew  路  5Comments

JayFields picture JayFields  路  5Comments