2

How do i specify the axis range in React-Vis

For Ex: 0 to 100 for Y Axis and the data is as below

data={[ {x: 1, y: 45}, {x: 2, y: 50}, {x: 3, y: 85} ]}/>

The YAxis must range 0 to 100 even though the max Y value here is 85

Prashant Andani
  • 109
  • 3
  • 6

2 Answers2

5

Use the xDomain or yDomain props on the XYPlot component <XYPlot xDomain={[0, 50]}

Ryan Irilli
  • 1,187
  • 10
  • 5
1

From their docs about scales at: https://uber.github.io/react-vis/documentation/general-principles/scales-and-data

"To redefine a scale, you must pass a prop to the series that uses that scale. The prop names are based on the name of the attribute: name + Domain, name + Range, name + Type, name + Padding (for instance: yDomain, colorType, xRange)."

So for your purpose, you would set <XYPlot yDomain=[0,100]></XYPlot>

Fran
  • 21
  • 3