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

feat(widgets/chart): add option to set the position of legend #378

Merged
merged 2 commits into from Dec 15, 2023

Conversation

lyuha
Copy link
Contributor

@lyuha lyuha commented Aug 6, 2023

Migerated PR from tui-rs is #25

Add option to position the legend at corner. The option uses tui::layout::Corner emum that already made.
If the layout have axis title, the layout draw the legend position above x axis title or under y axis title.

Examples all positions of legend
ratatui-chart-legend

I make 3 tests for each corners of legend based on original test for legend.

@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (d118565) 91.3% compared to head (210a291) 91.4%.

Files Patch % Lines
src/widgets/chart.rs 96.7% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #378     +/-   ##
=======================================
+ Coverage   91.3%   91.4%   +0.1%     
=======================================
  Files         42      42             
  Lines      12992   13355    +363     
=======================================
+ Hits       11868   12218    +350     
- Misses      1124    1137     +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

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

I'd suggest also adding / updating the existing chart example to show the legend positioning:
image

src/widgets/chart.rs Outdated Show resolved Hide resolved
src/widgets/chart.rs Outdated Show resolved Hide resolved
src/widgets/chart.rs Outdated Show resolved Hide resolved
tests/widgets_chart.rs Outdated Show resolved Hide resolved
@lyuha
Copy link
Contributor Author

lyuha commented Aug 16, 2023

I'll fix CI and add more test codes. And I make commits cumulativly.
Before merge, I will rebase and squash commits for clean git history.

@joshka joshka added this to the v0.23.0 milestone Aug 21, 2023
@lyuha
Copy link
Contributor Author

lyuha commented Aug 22, 2023

CI failed because of codecov.io. Please check CI pass.

[2023-08-21T15:53:03.740Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}

@joshka
Copy link
Member

joshka commented Aug 22, 2023

CI failed because of codecov.io. Please check CI pass.

Done - not sure why this fails. I have been meaning to look into it more.

@lyuha lyuha force-pushed the legend branch 2 times, most recently from d009f3d to e2f65a2 Compare September 4, 2023 21:44
@lyuha
Copy link
Contributor Author

lyuha commented Sep 4, 2023

Update chart examples all code requested changes.

chart example

At this time, rebase to main branch, CI failed. But CI failed due to an other reason.

Here is error.

Can't use 'tar -xzf' extract archive file: /home/runner/work/_actions/_temp_fcc1cf2d-bf9a-43b0-8047-ca17e1e0339a/f92c391d-66ef-45d5-9351-73185dd01cc5.tar.gz

@lyuha
Copy link
Contributor Author

lyuha commented Sep 13, 2023

Rebase to main branch a7bf4b3.
Passed CI!

@joshka joshka modified the milestones: v0.23.0, v0.24.0 Sep 20, 2023
@joshka joshka modified the milestones: v0.24.0, v0.25.0 Dec 4, 2023
Copy link
Member

@Valentin271 Valentin271 left a comment

Choose a reason for hiding this comment

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

Mainly this needs documentation.
Also could you rebase on main, this PR has been hanging for quite a while now ...

src/widgets/chart.rs Show resolved Hide resolved
src/widgets/chart.rs Outdated Show resolved Hide resolved
src/widgets/chart.rs Show resolved Hide resolved
examples/chart.rs Outdated Show resolved Hide resolved
lyuha and others added 2 commits December 14, 2023 00:32
- update rendering algorithm to avoid collisiion with axis titles.
- add unit tests.
Copy link
Member

@Valentin271 Valentin271 left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for your contribution!

@Valentin271
Copy link
Member

Just missing an approval from @joshka

@joshka joshka merged commit b8f71c0 into ratatui-org:main Dec 15, 2023
33 checks passed
@lyuha lyuha deleted the legend branch February 20, 2024 23:05
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.

None yet

4 participants