Skip to content

feat: line_width per entity#1241

Open
ildar170975 wants to merge 22 commits into
kalkih:devfrom
ildar170975:per-entity-line-width
Open

feat: line_width per entity#1241
ildar170975 wants to merge 22 commits into
kalkih:devfrom
ildar170975:per-entity-line-width

Conversation

@ildar170975
Copy link
Copy Markdown
Collaborator

Partly implements #555

image

@ildar170975 ildar170975 marked this pull request as ready for review April 29, 2025 23:37
@ZionFox
Copy link
Copy Markdown

ZionFox commented Jul 16, 2025

@kalkih This would be a wonderful feature to have.

@ildar170975
Copy link
Copy Markdown
Collaborator Author

ping @akloeckner

fran68 pushed a commit to fran68/mini-graph-card-xt that referenced this pull request May 10, 2026
github-actions Bot pushed a commit to fran68/mini-graph-card-xt that referenced this pull request May 10, 2026
# [0.3.0](xt-v0.2.1...xt-v0.3.0) (2026-05-10)

### Bug Fixes

* check config for x_labels and x_lines if enabled ([09492eb](09492eb))
* gradient for color thresholds ([eb8703f](eb8703f))
* labels and grid lines for x-axis, get x margin in sync with line and bar graph ([9ef11cd](9ef11cd))
* state last uses value from last graph coordinate (kalkih[kalkih#1308](https://github.com/fran68/mini-graph-card/issues/1308)) ([89fe5d0](89fe5d0))

### Features

* graph with preset value ([6102103](6102103))
* line_width per entity (parts from kalkih[kalkih#1241](https://github.com/fran68/mini-graph-card/issues/1241)) ([e0d0323](e0d0323))
* spacing between bar groups (multiple entities) ([3ebe1eb](3ebe1eb))

### Fork based on [mini-graph-card](https://github.com/kalkih/mini-graph-card.git), upstream version **0.13.0**
@fran68
Copy link
Copy Markdown

fran68 commented May 23, 2026

I think the function getMinMaxLineWidth wouldn't meet the following use cases:

  • line_width is set for entity but graph is not shown (show_graph: false). line_width is evaluated although it shouldn't
  • if line_width is set per entity for all entities, the global line_width should be out of scope

Maybe you can a take a look at #e0d0323

And a question: Why is min_line_width used for x margin instead of max_line_width? Wouldn't that clip lines with higher line_width at the edge.

@ildar170975
Copy link
Copy Markdown
Collaborator Author

ildar170975 commented May 24, 2026

I think the function getMinMaxLineWidth wouldn't meet the following use cases:

* line_width is set for entity but graph is not shown (show_graph: false). line_width is evaluated although it shouldn't

* if line_width is set per entity for all entities, the global line_width should be out of scope

Maybe you can a take a look at #e0d0323

I honestly really like your idea!
fran68@e0d0323#diff-3274f1a37032fb0ae4e2823def0007c634e869ae0dfc304ff6a12c36513c3a52R13
But - I am not sure we need this getMinMaxNumber() as a separate function.
The function (abstract from a particular option) takes an arr_obj array of objects (dicts), and either uses a "local" item[opt] option value or a "global" option value.
Great, but probably the line_width case could be the ONLY case where this function is needed as a separate function.

Meanwhile, I added a few lines to implement your cases "show_graph: false" & "every entity has line_width" - took your code as an inspiration.
Please check the added commit (do not bother about linter errors, they are unrelated & fixed in the next commit).
May be a bit more cumbersome than your separate function though...

@ildar170975
Copy link
Copy Markdown
Collaborator Author

ildar170975 commented May 24, 2026

And a question: Why is min_line_width used for x margin instead of max_line_width? Wouldn't that clip lines with higher line_width at the edge with higher line_width.

Need to check once again...

Update:
Since it was decided some time ago, could not recall a reason.
But now I recall: the reason was that I did not like a horizontal spacing between an Y-axis and a curve.
Compare this:

margin[X] = min, margin[Y] = max:
image

margin[X] = max, margin[Y] = max - see a horizontal gap:
image

So, I chose the 1st variant.

@ildar170975
Copy link
Copy Markdown
Collaborator Author

@fran68
Also, (might want to test in your setup), no need to calculate min & max values for bars.
8105211

@fran68
Copy link
Copy Markdown

fran68 commented May 26, 2026

@fran68 Also, (might want to test in your setup), no need to calculate min & max values for bars. 8105211

Wouldn't it be better to place it in the filter?

@fran68
Copy link
Copy Markdown

fran68 commented May 26, 2026

Thanks for explanation!

However, isn't the design approach to have a line which has round shapes at the ends and does not touch the edge of the diagram when fill is set to false?

I would prefer the max option, maybe by extending the lines. Or we handle it in the way when the fill is set to true/fade, no gap at all!?

@ildar170975
Copy link
Copy Markdown
Collaborator Author

Wouldn't it be better to place it in the filter?

Probably better, cannot say, away from a PC, will be able to check in a week I hope.

@ildar170975
Copy link
Copy Markdown
Collaborator Author

ildar170975 commented May 26, 2026

Thanks for explanation!

Sorry, cannot answer now. For these kind of questions , I need a PC nearby (((
Just a quick reply: we may start with the proposed algorithm, and then start playing, then improve if needed.

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.

3 participants