Closed cloudy-sfu closed 6 months ago
Get rid of ChatGPT, it's of no help here. Whatever little it knows about DPG, it learned from docs of a very old version of DPG, which has since changed a lot.
Now, back to your code. You're saying the range never updates, but I've just tried your code and the range does update:
Expected X-Axis range is 1710591945 1710592010
Actual X-Axis range is [0.0, 1.0]
Expected X-Axis range is 1710591946 1710592011
Actual X-Axis range is [1710592000.0, 1710592000.0]
Expected X-Axis range is 1710591947 1710592012
Actual X-Axis range is [1710592000.0, 1710592000.0]
The reason you're seeing different numbers than what you specified in the set_axis_limits
call is loss of precision on floating-point numbers. There are a number of tickets opened on this; you can take a look at #2157 for example (other tickets are #2067, #1847, #386, maybe something else I missed).
Hi v-ein, I try to always subtract 1710632700 from t1
, and it works as expected. It seems that #2157 is the root cause. Thanks a lot.
Minimum example:
I want to dynamically adjust the range of X-Axis with
update_figure
function (the expected behavior is like resource manager), but the range of X-Axis never update.GPT keeps suggesting changing
ymin, ymax
toxmin, xmax
, but the functionset_axis_limits
only acceptymin, ymax
arguments. It's mainly implemented by functionupdate_figure
. When user click "start" button in GUI,update_figure
will update per second. I have removed the data query part and the multiple series as a simplified example, so don't feel strange that I wrapupdate_figure
function.How to solve this problem? Thank you!