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

refactor(barchart): replace remove_invisible_groups_and_bars by group… #544

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

karthago1
Copy link
Contributor

It is maybe still not what you expect. but maybe it is a small step. (At least the internal state is not changed)

remove_invisible_groups_and_bars() is replaced by group_ticks(), which calculates the visible bar length in ticks. (A cell contains 8 ticks).

It is used for 2 purposes:

  1. to get the bar length in ticks for rendering
  2. since it delivers only the values of the visible bars, If we zip these values with the groups and bars, then we will filter out the invisible groups and bars

Since this patch, doesn't add any new feature, it can be closed, if it doesn't add any value regarding readability.

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #544 (c3b372f) into main (11076d0) will decrease coverage by 0.15%.
Report is 3 commits behind head on main.
The diff coverage is 78.88%.

@@            Coverage Diff             @@
##             main     #544      +/-   ##
==========================================
- Coverage   89.65%   89.51%   -0.15%     
==========================================
  Files          41       41              
  Lines       11437    11451      +14     
==========================================
- Hits        10254    10250       -4     
- Misses       1183     1201      +18     
Files Coverage Δ
src/widgets/barchart.rs 87.87% <78.88%> (-1.68%) ⬇️

... and 1 file with indirect coverage changes

@karthago1 karthago1 force-pushed the hich/barchart-refactor branch 2 times, most recently from 2d9e609 to 5b901e3 Compare September 28, 2023 20:06
@karthago1
Copy link
Contributor Author

also I noticed, that I should replace the removed unit tests in the previous commit. (I almost made some breaking changes)

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.

Generally LGTM - with a couple of quick questions

src/widgets/barchart.rs Show resolved Hide resolved
src/widgets/barchart.rs Show resolved Hide resolved
src/widgets/barchart.rs Outdated Show resolved Hide resolved
@karthago1 karthago1 force-pushed the hich/barchart-refactor branch from 5b901e3 to c8dd9cc Compare September 29, 2023 19:43
…_ticks

group_ticks calculates the visible bar length in ticks. (A cell contains 8 ticks).

It is used for 2 purposes:
1. to get the bar length in ticks for rendering
2. since it delivers only the values of the visible bars, If we zip these values
   with the groups and bars, then we will filter out the invisible groups and bars

Signed-off-by: Ben Fekih, Hichem <[email protected]>
@karthago1 karthago1 force-pushed the hich/barchart-refactor branch from c8dd9cc to c3b372f Compare September 29, 2023 20:03
@joshka joshka merged commit 2fd85af into ratatui:main Sep 29, 2023
31 of 33 checks passed
@joshka
Copy link
Member

joshka commented Sep 29, 2023

Thanks for the PR

tonogdlp pushed a commit to tonogdlp/ratatui that referenced this pull request Oct 6, 2023
Replace `remove_invisible_groups_and_bars` with `group_ticks`
`group_ticks` calculates the visible bar length in ticks. (A cell contains 8 ticks).

It is used for 2 purposes:
1. to get the bar length in ticks for rendering
2. since it delivers only the values of the visible bars, If we zip these values
   with the groups and bars, then we will filter out the invisible groups and bars

Signed-off-by: Ben Fekih, Hichem <[email protected]>
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