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

add relative gradient option to the baseline series #1730

Merged
merged 9 commits into from
Nov 28, 2024

Conversation

illetid
Copy link
Contributor

@illetid illetid commented Nov 18, 2024

Type of PR: enhancement

PR checklist:

Overview of change:
Added a new option to the baseline series where we calculate gradient from the visible points range and not from the top and bottom of the chart.
Example with two series with the same settings. Top and bottom colors are different without option enabled
without option:
image

with the option enabled:
image

@illetid illetid requested a review from SlicedSilver November 18, 2024 10:45
Copy link

github-actions bot commented Nov 18, 2024

size-limit report 📦

Path Size
ESM 42.65 KB (+0.32% 🔺)
ESM createChart 36.36 KB (+0.05% 🔺)
ESM createChartEx 35.12 KB (+0.06% 🔺)
ESM Standalone 44.09 KB (+0.31% 🔺)
Standalone 44.05 KB (+0.31% 🔺)
Plugin: Text Watermark 1.86 KB (-0.27% 🔽)
Plugin: Image Watermark 1.69 KB (+0.53% 🔺)
Plugin: Series Markers 3.97 KB (-0.05% 🔽)
Series: LineSeries 2.54 KB (0%)
Series: BaselineSeries 3.19 KB (+4.66% 🔺)
Series: AreaSeries 3.11 KB (+3.99% 🔺)
Series: BarSeries 2.14 KB (+0.1% 🔺)
Series: CandlestickSeries 2.43 KB (+0.05% 🔺)
Series: HistogramSeries 2.19 KB (+0.05% 🔺)

@illetid illetid marked this pull request as ready for review November 18, 2024 10:51
@illetid illetid self-assigned this Nov 18, 2024
Copy link
Contributor

@SlicedSilver SlicedSilver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add this option to the area series as well.

Additionally, could you check the behaviour when you have more than one series on the same price scale?
because there would be two ways to implement this feature:

  • Consider the min and max visible values of items (like this PR)
  • Use the min and max values from the scale margins

For a single series (and the price scale not adjusted) then the visible range and the scale margins range would essentially be the same and unchanging (and quicker to calculate).

However for multiple series, this wouldn't be the case. So please try these different setups and comment on how they look.

.size-limit.js Outdated Show resolved Hide resolved
@illetid illetid requested a review from SlicedSilver November 21, 2024 10:04
Copy link
Contributor

@SlicedSilver SlicedSilver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a concern that there are graphics tests (which haven't been changed) are failing for the area series. Could you please investigate why the area series is rendering differently in these cases. The opacity seems to be different.

@illetid
Copy link
Contributor Author

illetid commented Nov 27, 2024

@SlicedSilver fixed area gradient. and two tests that should fail are passing. Looks like our screenshot comparison can't identify such small changes in color with opacity
image
image

@illetid illetid requested a review from SlicedSilver November 27, 2024 10:56
@SlicedSilver
Copy link
Contributor

@SlicedSilver fixed area gradient. and two tests that should fail are passing. Looks like our screenshot comparison can't identify such small changes in color with opacity image image

Perhaps we should adjust this value to be more accurate?

@illetid
Copy link
Contributor Author

illetid commented Nov 28, 2024

@SlicedSilver When I lowered the threshold random tests were failing, I tried to with a few different values and didn't find one that can detect gradient changes and not fail random tests, so I left the default value 0.1

@SlicedSilver
Copy link
Contributor

@illetid This PR is still approved. So if you want to merge then go ahead 👍

@illetid illetid merged commit 4cf3378 into v5-candidate Nov 28, 2024
27 of 33 checks passed
@illetid illetid deleted the feature/relative-gradient branch November 28, 2024 15:51
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 this pull request may close these issues.

2 participants