# Calling Method Plotly.react resets Zoom to default

**URL:** <https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109>\
**Category:** plotly.js\
**Tags:** question\
**Created:** [July 14, 2022, 7:21pm UTC](https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109 "2022-07-14T19:21:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![damorgan](https://avatars.discourse-cdn.com/v4/letter/d/b3f665/32.png) [@damorgan](https://community.plotly.com/u/damorgan)\
**Post date:** [July 14, 2022, 7:21pm UTC](https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109/1 "2022-07-14T19:21:39Z")

</div>

I have been running into the issues very similar to this [question](https://community.plotly.com/t/updating-chart-data-without-affecting-zoom/4172). I am using javascript, and the moment I called Plotly.react to update the plot with new data it zooms the user back out to the default state.

My range is stored in this range $ctrl.chart.layout.xaxis.range, $ctrl.chart.layout.yaxis.range. Is there a configuration command that prevents this from happening? Because even when storing the data else where, inject it back in and then calling that method it still zooms back out.

Thank you very much for your time

---

<div class="post-metadata">

**Author:** ![jlfsjunior](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jlfsjunior/32/16061_2.png) [@jlfsjunior](https://community.plotly.com/u/jlfsjunior)\
**Post date:** [July 14, 2022, 9:50pm UTC](https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109/2 "2022-07-14T21:50:01Z")

</div>

Hi,

I believe you are looking for uirevision. Here is the link to the docs:

> **[Uirevision](https://plotly.com/javascript/uirevision/)**
>
> Persist

Hope this helps!

---

<div class="post-metadata">

**Author:** ![damorgan](https://avatars.discourse-cdn.com/v4/letter/d/b3f665/32.png) [@damorgan](https://community.plotly.com/u/damorgan)\
**Post date:** [July 20, 2022, 6:42pm UTC](https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109/3 "2022-07-20T18:42:57Z")

</div>

Sorry it hasn’t fixed my problem. However, I might have found a possible solution.

I have an object Chart, that has .text, .x, and .y. When I change the visible of .text = hidden/legendonly, it also changes the .y?

Same thing when changing the value of .text, it also changes the .y values as well. Is there anyway to change specifically just the .text visible / value? This causes the entire chart to be blank due to it also changing the value of .y.

 ![2022-07-20 14_43_53-Window](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/c/d/cdd0a1174a7538f78ef18da94166ce008896d073.png)

I am following the example you have given, to redraw the plot after. That works fine. What I have is a work in progress, sorry for the mess.

---

<div class="post-metadata">

**Author:** ![damorgan](https://avatars.discourse-cdn.com/v4/letter/d/b3f665/32.png) [@damorgan](https://community.plotly.com/u/damorgan)\
**Post date:** [July 20, 2022, 6:49pm UTC](https://community.plotly.com/t/calling-method-plotly-react-resets-zoom-to-default/66109/4 "2022-07-20T18:49:29Z")

</div>

You can see here as I’m stepping through, the code hasn’t reached the .y to reassign it due to the .text overwriting both .text and .y as if they’re referencing each other.

 ![Capture](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/a/b/ab2cc12d6323f60fb7bdd8f4ecdb678f04e3d884.png)
