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

AutoRange axis in CircularDoubleErrorDataSet #378

Closed
RossHS opened this issue Mar 7, 2021 · 4 comments · Fixed by #379
Closed

AutoRange axis in CircularDoubleErrorDataSet #378

RossHS opened this issue Mar 7, 2021 · 4 comments · Fixed by #379

Comments

@RossHS
Copy link

RossHS commented Mar 7, 2021

Hello,

I am using a CircularDoubleErrorDataSet to display real-time data with a given 400 points buffer size and I would like to know if it even possible to implement autoRanging of the yAxis? What i mean. If you look at the first screenshot you may see the correct auto range for y axis. (For testing, I created a linear function growing in time with an initial point of (200;200) and auto range work correct).
RollingBufferSample
But over time, when the buffer overflows and we no longer see y-point 200, auto range locked at this minimum value and it doesn't work the way I want
RollingBufferSample1

Do you have any practice to solve this kind of problem?

Thanks for the great lib!

@RossHS
Copy link
Author

RossHS commented Mar 7, 2021

Little update. Version 11.2.3 does not have this problem, everything works as it should. Thus, this is a bug of version 11.2.4. As I understand in version 11.2.4, the values of the min and max in the CircularDoubleErrorDataSet::getAxisDescription are calculated incorrectly.

screenshots of the same code, but with the library of the previous version:
image
RollingBufferSample3

@RalphSteinhagen
Copy link
Member

@RossHS thanks for spotting and reporting. This may have slipped in with one of the last PRs.

I will have a look at it and make a new release by the end of the day.

@yezhengli-Mr9
Copy link

Dear @RossHS ,
How does your dataset update mechanism code look like? #647 For your use case of CircularDoubleErrorDataSet,
are you using

CachedDaemonThreadFactory.getInstance().newThread(() -> {
while (true) {
ds.reset();
try {
TimeUnit.MILLISECONDS.sleep(100);
FXUtils.runAndWait(() -> {
yAxis.getAutoRange().set(0, 10);
});
TimeUnit.MILLISECONDS.sleep(100);
} catch (Exception e) {
e.printStackTrace();
}
for (int i = 0; i < 500; i++) {
ds.add(i, 40 * Math.sin(i * 0.1) + 100 * Math.sin(i * 0.02), 0, 0);
try {
TimeUnit.MILLISECONDS.sleep(40);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
})
.start();

or codes like (but does not feel that relevant to CircularDoubleErrorDataSet:
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
System.gc();
}
}, 5, 2000);

} else {
ohlcvDataSet = new OhlcvDataSet(resource);
indiSet = new DefaultDataSet("MA(24)");
try {
loadTestData(resource, ohlcvDataSet, indiSet);
} catch (IOException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}

@ennerf
Copy link
Collaborator

ennerf commented Nov 27, 2023

@yezhengli-Mr9 please stop created off-topic comments on issues that have been closed for years. This is not maintainable.

The framework has changed significantly since then, so the old code might not even be best practice anymore. Please create a separate issue for your actual question.

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

Successfully merging a pull request may close this issue.

4 participants