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

When rendering multiple charts with baseline series, baseValue of the last element is used on all charts series. #898

Closed
deaglegame opened this issue Nov 16, 2021 · 0 comments · Fixed by #900
Assignees
Labels
bug Unexpected problem or unintended behavior.
Milestone

Comments

@deaglegame
Copy link

Lightweight Charts 3.7.0
React 16.14.0 used in my project, React 17.0.2 in codesandbox with same results
Codesandbox example : https://codesandbox.io/s/pensive-blackwell-cuz1j?file=/src/Baseline.jsx

Hello,

While trying to render multiple charts, each with a baseline series, setting the baseValue on each chart independently doesn't seem to work as expected, instead it applies the value of the last series to each element.

In my example, the grey price line is to indicate where the baseValue price should be set for each chart series.

image

I have tried everything I could think of as far as React goes. To name a few, setting baseValue in either addBaselineSeries or applyOptions doesn't affect anything. Thinking it might be because each series is not unique, I tried keeping a list of refs of all my series in state, outside of my loop, and once the charts rendered, iterating through the list calling applyOptions on each series to set baseValue, without success.

If I play around with the data and put the first item at the end of my array, you notice that now it works for that particular chart, but only because it's now last. And the second to last (previously last) shows all red because its values are lower than the new baseValue price.

image

I'm scratching my head over this because all other series options seem to work fine. I have read the docs without finding anything about this. I'm still thinking it could be user error, my apologies if so. That is the reason I did not file this under bugs, just in case.

Thank you for this great library!

@timocov timocov added the bug Unexpected problem or unintended behavior. label Nov 16, 2021
@timocov timocov added this to the 3.8 (optional) milestone Nov 16, 2021
@timocov timocov self-assigned this Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants