-
-
Notifications
You must be signed in to change notification settings - Fork 441
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
14
commits into
htop-dev:main
Choose a base branch
from
Explorer09:graph-with-neg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
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
2 times, most recently
from
May 22, 2024 19:03
aa96aa4
to
10bb617
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
from
June 28, 2024 09:59
10bb617
to
8ab21e9
Compare
Explorer09
force-pushed
the
graph-with-neg
branch
from
July 5, 2024 10:03
8ab21e9
to
30691c9
Compare
This suppresses a "-Wshorten-64-to-32" warning in Clang 19.
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 could have their "total" values updated automatically in bar meter mode. This commit is a prerequisite for the feature "Graph meter dynamic scaling and percent graph drawing". Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
If "isPercentChart" of a meter is false, update its "total" value automatically in the bar meter mode. The "total" value is capped to DBL_MAX in order to ensure the division never produces NaN. The newly introduced Meter_computeSum() function will be reused by the feature "Graph meter dynamic scaling and percent graph drawing". Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Implement dynamic scaling for Graph meter mode, and separate it from "100% graph" drawing. This is controlled by the "isPercentChart" property of a MeterClass. If "isPercentChart" is true, the meter would be drawn as a "100% graph". Graph meters now expect the "total" value may change, and the newly changed "total" value no longer affects the percent graph drawings of earlier meter values. If "isPercentChart" is false, the meter would be drawn with a dynamic scale. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Round the graph meter's dynamic scale to a power of two and print the graph scale. For a percent graph, a "%" character is printed in place of the scale. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This is a code quality change that avoids dependency on the hard-coded GRAPH_HEIGHT in GraphMeterMode_draw(). This doesn't enable variable graph heights per meter, but it makes room for implementing such feature. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This is a prerequisite for the feature "Graph meter coloring (with GraphData structure rework)". 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 color graph drawing in addition to the dynamic scaling (both can work together because of the new GraphData structure design). 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 new GraphData structure design has two technical limitations: * The height of a graph meter now has a limit of 8191 (terminal rows). * If dynamic scaling is used, the "total" value or scale of a graph now has to align to a power of 2. The code is designed with the anticipation that the graph height may change at runtime. No UI or option has been implemented for that yet. 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.
Explorer09
force-pushed
the
graph-with-neg
branch
from
August 25, 2024 23:05
30691c9
to
f57affb
Compare
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
August 25, 2024 23:10
f57affb
to
5e3eeb1
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.