-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Markers get cropped off at extremes #1175
Comments
Thanks @maxkostin, am I right in concluding that you would like a There is a way to get your desired behaviour at the moment if you make use of chart.timeScale().applyOptions({
rightOffset: 4,
});
chart.timeScale().fitContent();
requestAnimationFrame(() => {
// needs to be called after the chart has been redrawn, so requestAnimationFrame is used.
const currentVisibleLogicalRange = chart.timeScale().getVisibleLogicalRange();
chart.timeScale().setVisibleLogicalRange({
...currentVisibleLogicalRange,
from: currentVisibleLogicalRange.from - 4 // adding a left offset of 4
});
}); Basically, we are calling |
Thanks @SlicedSilver, your solution might help, but it also has unintended consequences: rightOffset/leftOffset have their own meaning (the data is not fully available for a set time range for example).
|
Thanks for the extra clarification. Possible solutions / future enhancements:
We will need to discuss the possible ideas within the team to determine which approach would be the best. |
is requestAnimationFrame the recommended way to wait after updating candles / setting the offset? i'm finding that if i set rightOffset before setting candle data the rightOffset is ignored so i had to add what is the recommended approach @SlicedSilver ? |
Actually on my case i found that requestAnimationFrame is perhaps too quick and the offset is not added. Currently i'm using setTimeout with 100 ms and it's working, but would be nice to somehow not depend on a random timeout to get the rightOffset applied. I guess i'm doing something wrong here @SlicedSilver ? |
Needing to use anything longer than a RequestAnimationFrame delay is not expected. It would be helpful if you could provide a code sample so we could know the combination of settings which are being used to produce this issue.
|
i did a new refactor and perhaps this was the culprit? tbh i changed so many things that's now hard to put my finger on exactly what solved, but after cleaning up a lot of the logic reqAnimFrame is doing the job perfectly! thank you |
Lightweight Charts Version: 3.8.0
Steps/code to reproduce:
chart.timeScale().fitContent();
Actual behavior:
Markers are cropped off. I can add
rightOffset
to alleviate the issue, but there's no option to setleftOffset
.Expected behavior:
Markers should be fully visible
Screenshots:
CodeSandbox/JSFiddle/etc link:
JSFiddle link
The text was updated successfully, but these errors were encountered: