Skip to content

feat: add per-entity logarithmic override#1348

Open
mxr wants to merge 2 commits into
kalkih:devfrom
mxr:entity-logarithmic-axis
Open

feat: add per-entity logarithmic override#1348
mxr wants to merge 2 commits into
kalkih:devfrom
mxr:entity-logarithmic-axis

Conversation

@mxr
Copy link
Copy Markdown
Contributor

@mxr mxr commented Mar 9, 2026

Adds per-entity logarithmic configuration so mixed-scale graphs work correctly.

Specifying 'secondary' for the y-axis isn't enough for my use-case. I have a graph with two waveforms: one waveform is brightness on the primary y-axis (roughly 1 to 5000), while another waveform is sunrise/sunset on the secondary y-axis (boolean 0/1). With only global logarithmic: true, the sunrise/sunset waveform breaks; this change allows keeping brightness logarithmic while leaving sunrise/sunset linear via entity-level override.

Resolves #862

Current Example of why logarithmic: true globally doesn't work Example with the fix

@ildar170975
Copy link
Copy Markdown
Collaborator

ildar170975 commented Mar 9, 2026

Thank you! Will check it soon.
Meanwhile, if you have some spare time, test other PRs; start with recently updated ones. Of course, only if you are interested in the proposed functionality, no obligations))

Comment thread README.md Outdated
Comment thread src/main.js Outdated
@ildar170975
Copy link
Copy Markdown
Collaborator

@mxr
Added some observations, please consider.

For me, the whole "graph" functionality (described in a graph.js) is still a complex thing which I am not 100% familiar with.
In this PR there are mostly SIMPLE changes, a global logarithmic option is "augmented" by a a per-entity option.
What probably needs to be at least confirmed - is a building a logarithmic graph itself.
Of course, we may blindly trust the current implementation - but these algorithms should be analysed & improved if needed in future (at least to become "maintainable").

For now, I think this PR achieved it's minimal goal (per-entity option).
@akloeckner - please review when you have a spare time.

@mxr
Copy link
Copy Markdown
Contributor Author

mxr commented Mar 11, 2026

Thanks for the feedback. I implemented it in mxr@6518e8b (GitHub seems to be lagging so I amended the prior commit)

What probably needs to be at least confirmed - is a building a logarithmic graph itself.

I have an example in the PR description. Let me know if I misunderstood.

@mxr mxr force-pushed the entity-logarithmic-axis branch from 6518e8b to 9dfd832 Compare March 11, 2026 13:36
@ildar170975
Copy link
Copy Markdown
Collaborator

ildar170975 commented Mar 11, 2026

I totally understood your example, I meant a technical implementation of the Graph class itself. Repeat, the PR looks fine, but since personally me may not know some details of Graph class, I am not sure that the whole logarithmic thing works properly. Let’s merge and then test.

@ildar170975 ildar170975 changed the title fix: add per-entity logarithmic override feat: add per-entity logarithmic override Mar 11, 2026
@ildar170975
Copy link
Copy Markdown
Collaborator

ping @akloeckner

@mxr mxr requested a review from ildar170975 May 23, 2026 13:18
@ildar170975
Copy link
Copy Markdown
Collaborator

@mxr
I approved these changes on March, just did not push the "approve" button )))
We have a bunch of unmerged PRs now, let's wait for @akloeckner (we do things in a team here) & make a RELEASE.
Thanks again for the contribution, sorry for the delay.
As you probably know, you can start using js with your changes right now (download it from here - https://github.com/kalkih/mini-graph-card/actions/runs/22955326308/job/66630389391)

@ildar170975
Copy link
Copy Markdown
Collaborator

@mxr
Based on personal experience, I think we need to add some clarifications to Docs about "what a logarithmic thing is".
(BTW, for stock History graph & Statistics graph cards there were even plans to exclude a corresponding "logarithmic scale" option from UI editor & make it available for yaml only - many people checked this option & did not understand what they got).
At least, we need to add a note about "for any values < 1 - the logarithmic graph will be 0" - this is a current implementation, i.e. here yellow values fall back to 0:
изображение

@mxr
Copy link
Copy Markdown
Contributor Author

mxr commented May 25, 2026

@ildar170975 thanks added some docs

@ildar170975
Copy link
Copy Markdown
Collaborator

@ildar170975 thanks added some docs

Thanks, I think these clarifications are good, they seem to be clear even for non-technical people.

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