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

feat: dynamic time line #1210

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

feat: dynamic time line #1210

wants to merge 2 commits into from

Conversation

Haluska77
Copy link

In my project I want to have some daily times marked for better graph readibility. Or for long term graphs it might be difficult to realize some specific values in time as the graph does not support it.

My sollution adds user specific times as list in configuration that are displayed in graph.
timeLine1

These time lines are tightly coupled with their values, so their position is dynamically rendered along with the graph.
The styling is fully customized by user by <card_mod> as per css class.
Time value could be disabled as well.
On midnight time (when user setup 00:00), graph displays a new date value instead of a time.

timeLineCustom24hours

Time lines are applied for every day in the graph so long term graphs are supported
timeLine48hours

The solution requires new config variable 'time_line' with a list of expected times in format HH:MM under the 'show' option as follows:

    - type: custom:mini-graph-card
                entities:
                  - entity: sensor.grid_power_negative
                  - entity: sensor.solar_production
                    color: "#ffee3A"
                color_thresholds_transition: hard
                color_thresholds:
                  - value: -10000
                    color: "#488fc2"
                  - value: 0
                    color: "#8353d1"
                hours_to_show: 24
                line_width: 2
                show:
                  state: false
                  name: false
                  icon: false
                  legend: false
                  time_line:
                    - '00:00'
                    - '12:00'
                points_per_hour: 4
                card_mod:
                  style: |
                    ha-card svg .line-12-00 {
                      stroke-dasharray: 10,5;
                      stroke-width: 1px;
                    }
                    ha-card svg .line-00-00 {
                      stroke: red;
                      stroke-width: 2px;
                    }
                    ha-card svg .text-00-00 {
                      fill: red;
                    }

@ildar170975
Copy link
Collaborator

ildar170975 commented Feb 7, 2025

Thanks for contributing.
Please check a PR for grid lines. Perhaps your idea could be an addition.
Note that mentioned PR also will allow to address a particular vertical line and style it with card-mod.

@Haluska77
Copy link
Author

PR for grid lines is totallly different.

  1. it provides static grid hence it does not identify value in time
  2. User is not able to specify very own grid

@ildar170975
Copy link
Collaborator

ildar170975 commented Feb 7, 2025

That is why I suggested you to think how to add your useful functionality to the current paradigm (related config options should be in one place, may be in a separate section; drawing of lines should be consistent to the existing code).
Yes, that PR is not merged yet. There are some open discussions about it. But anyway it should be merged first - and then all other improvements should be made.

@akloeckner
Copy link
Collaborator

Mentioning #1179 to link the PR as related.

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