-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Baseline series should use min/max price range in visible range to calculate gradient stops #1005
Comments
Could you please elaborate what do you want to achieve with that? |
Have you tried your solution in the case when a price scale is manually scaled and you move the chart to vertically (especially out of your margins), how does it work? |
Probably we need to provide a way to control what the start/end points should be. Right now we use the full height of the pane to paint it so I'm trying to understand what exact options we should have. As one of possible options could be max/min coordinates of a series for this visible range, but we'll need to check it properly. |
Regarding your second comment, I think the most logical situation would be that the gradient is simply based on the min/max values of the series (or well, the top/bottom of the pane). Having extra options for the start/end point in the API would seem cluttered, in my opinion 👍 |
Have you tried to move a series after that vertically? How the color is changing on this?
Hm, probably we need to have 2 separate hard-coded options here:
What do you think about that @EastingAndNorthing?
I'll discuss this question with the team and come back to you with the solution we could accept here. |
Ok, it seems that we're happy with the solution you provided, i.e. calculate top/bottom based on the data in visible range instead of @EastingAndNorthing Do you still want to create a pull request for that? See https://github.com/tradingview/lightweight-charts/blob/master/CONTRIBUTING.md#pull-requests for our contribution guide. |
Yes, this will give the same result, a color change while moving the chart up/down. See https://jsfiddle.net/ean9vj3r/1/
I agree, compared to the baseline series on Tradingview, it does seem more logical to use the entire scale as a gradient if we're talking about percentage values.
Yes. I'll also add a few lines to check whether the base value is price, leaving the upcoming percentage scale at |
Lightweight Charts Version:
3.7.0
Steps/code to reproduce:
Actual behavior:
The baseline gradient does not fully render the assigned color stop from the configuration.
Expected behavior:
The baseline gradient should use the scaleMargins to compute the color stops.
data.bottom
should not be the height of the current chart, but the height of the series with the current scaleMargins.Screenshots:
Expected here would be a full-black (
#000000
) top and bottom gradient.Without scale margins:
Scale margins moved to top:
Scale margins moved to bottom:
CodeSandbox/JSFiddle/etc link:
https://jsfiddle.net/0r3cLmjd/51/
The text was updated successfully, but these errors were encountered: