-
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
PaneRendererCustomData has x=NaN in bars outside of visible range #1612
Comments
|
Providing The spacing between each It would be quite simple to calculate what the offscreen I would recommend that you calculate such values required for the renderer within the 'View' but you can do this within the renderer as well (no forced rules on this). |
Thanks, got it. What you're suggesting is exactly what I ended up doing. Good to get a validation! |
Lightweight Charts™ Version: 4.1.4
Steps/code to reproduce:
npm create lwc-plugin@latest
utilityconsole.log(data)
in the createdMyCustomSeries.update
methodbars
property and theirx
attribute - it isNaN
for any bars that fall outside of the currently visible rangeActual behavior:
The
bars.x
property in thePaneRendererCustomData
provided through theMyCustomSeries.update
method isNaN
in bars outside of the visible range.Expected behavior:
The
bars.x
property in thePaneRendererCustomData
provided through theMyCustomSeries.update
method is set with the correctx
value, including for bars outside the visible range. Thex
will be negative for values before the start of the visible range and greater than the media width of the visible pane for any bars beyond the visible range.Screenshots:
Use case
I am creating a renderer to draw custom series that have a price value at each bar (and that value may be drawn as a point or as a k-line), and some some of the points are connectes with a line (think open position point and realized PNL point). The start/end of a line may fall outside of the visible range when scrolling through the chart, but as the
bar.x
value is NaN outside the visible range, I have no way of determining the correct placement of those points in such scenario.I would like to know if the issue described above is indeed a bug or a feature. If it's the latter then it might be useful to discuss this case in the CustomBarItemData docs.
The text was updated successfully, but these errors were encountered: