Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How you set a fixed x-axis with dynamic data? #1425

Open
nbhector opened this issue Jul 26, 2021 · 2 comments
Open

How you set a fixed x-axis with dynamic data? #1425

nbhector opened this issue Jul 26, 2021 · 2 comments

Comments

@nbhector
Copy link

Hi,

I am using the LineMarkSeries and I am feeding the data parameter with a new object (i.e. {x: cnt; y: getData()} ) and I am trying to get a fixed axis in the range from 0 to 20. However, it seems a bit difficult since the dynamic data is creating a new object containing new data points to be rendered on the graph. Does anyone know how I can fix this issue?

Thanks!

@nbhector
Copy link
Author

Okay, so I figured out how to make the axis have a predetermined scale. However, the way the graph renders every second doesn't seem to map to the tick value. For example, the first data point is {x: 1, y: 0.7}, so I expect the graph to render at the first tick. However, it gets rendered to the last tick value. The first data point will eventually reach the first tick value once all the data points have been added to the array. Does anyone know how I can fix that issue?

@saurabhgupta050890
Copy link

Try
<XYPlot height={200} width={200} xDomain={[0, 20]}> <MarkSeries data={data} /> </XYPlot>
https://github.com/uber/react-vis/blob/master/docs/scales-and-data.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants