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
"Positive/negative" graph meter style #1415
Draft
Explorer09
wants to merge
11
commits into
htop-dev:main
Choose a base branch
from
Explorer09:graph-with-neg
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Explorer09
force-pushed
the
graph-with-neg
branch
3 times, most recently
from
March 28, 2024 13:54
f47a975
to
745f394
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
from
April 13, 2024 15:26
745f394
to
af6b927
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
3 times, most recently
from
April 21, 2024 06:39
31cb513
to
bedca8f
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
4 times, most recently
from
April 26, 2024 18:59
ade4922
to
54d3d1c
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
3 times, most recently
from
May 2, 2024 21:01
728ef87
to
3033b1d
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
from
May 17, 2024 09:08
3033b1d
to
aa96aa4
Compare
This property distinguishes meters that have a (relatively) fixed "total" value and meters that do not have a definite maximum value. The former meters would be drawn as a "100% stacked bar" or "graph", and the latter would have their "total" values updated automatically in bar meter mode. This commit is a prerequisite for the "Graph meter dynamic scaling and coloring" feature. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
If "isPercentChart" of a meter is false, update its "total" value automatically. The "total" value should be finite in order to ensure the division works. The newly introduced Meter_computeSum() function will be reused by the "Graph meter dynamic scaling and coloring" feature. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This is a prerequisite for the "Graph meter dynamic scaling and coloring" feature. powerOf2Floor() will utilize __builtin_clz() or stdc_bit_floor_ui() (__builtin_clz() is preferred) if either is supported. popCount8() will utilize ARM NEON instructions and x86 POPCNT instruction if the machine supports either of them. I am not adopting the C23 standard interface stdc_count_ones_uc() yet, as I am not sure C libraries would implement it as fast as our version. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Rewrite the entire graph meter drawing code to support dynamic scaling and colors. Dynamic scaling is used for meter classes with "isPercentChart" set to false. The "total" of a graph meter will align to a power of 2 to ease the management of internal data structures. The colors of a graph are based on the percentages of item values of the meter. The rounding differences of each terminal character are addressed through the different numbers of braille dots. Due to low resolution of the character terminal, the rasterized colors may not look nice, but better than nothing. :) The code is designed with the anticipation that the graph height may be changeable at runtime. However no UI or option has been implemented for that yet. The graph height has a limit of 8191 (terminal rows). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Specifically 'PIXPERROW_*' and 'GraphMeterMode_dots*' constants. They were commented out rather than removed in the previous commit (for ease of code reviewing). Now this commit removes the constant defines for good.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This special case of "details" value would print as ':' in the ASCII display mode. It is used in "positive/negative" graph display only. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Explorer09
force-pushed
the
graph-with-neg
branch
from
May 22, 2024 19:03
aa96aa4
to
10bb617
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof of concept of the graph style as discussed in #1390. I post this so that people can try it and see how it looks.
Notice this code is based on #714 -- the first few commit are the same, while the last one is the real modification of the new graph style.