RomRider / apexcharts-card

📈 A Lovelace card to display advanced graphs and charts based on ApexChartsJS for Home Assistant
MIT License
1.08k stars 75 forks source link

Min/Max option that combines soft bounds and absolute value #670

Open WPettersson opened 4 months ago

WPettersson commented 4 months ago

Checklist

Is your feature request related to a problem? Please describe.

I currently use min: ~17 and max: ~22 for temperatures in my house, which for most days gives a good graph of the temperature. However, when the indoor temperature drops below 17 (usually if I'm away and heating is off) or goes above 22 (summers), the line graph sits on the top or bottom of the chart. I would prefer for there to always be a 0.5 gap above/below. I can achieve this with min: |-0.5| and max: |+0.5| but then the soft boundaries are lost.

Describe the solution you'd like

A new type, minmax_type.SOFTABSOLUTE, could be added. It could be specified with min: ~17|-0.5| and max: ~22|+0.5|. Parsing these shouldn't be hard, adding an extra if (value.startsWith('~') && value.endsWith('|') before the if statement at https://github.com/RomRider/apexcharts-card/blob/1b63c0f53fadde489179f7c9e08d700daeb4215e/src/apexcharts-card.ts#L1264 (or running a regex match). It would mean that yaxis.min and yaxis.max couldn't just be a number though, but possibly an array or something.

Describe alternatives you've considered

I haven't got an alternative solutions in the current apexcharts-card that I've tried.

Additional context

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

WPettersson commented 2 months ago

Hmm, this repo is feeling abandoned. No commits this year, loads of issues going closed as stale. Anyone know of either a fork, or alternative?

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.