-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
FR plotly type heatmap #21
Comments
Very interesting idea. I'll modify the lambdas so they can return z values to enable this. |
I think the user should be able to set at least a colorscale: https://plotly.com/javascript/colorscales/#custom-colorscale for z values and then to start with days on x and hours on y. Later an improvement could be a yaml to define y (1-6, 6-12, 13-18, 18-0) to have only four blocks, etc. The question for me is only, how you would get the z values. I looked for bar-charts in plotly-graph-card, but didn't find an example. Thought, that you are combining data as well. Anyway, Great would be, if the user could set the aggregation: min, max, average, median or whatever for the z values of the coresponding y-frames. I don't understand question around duplicated entries. Last Tuesday would be e.g. x2y12z15. This tuesday x9y12z15, if the chart would show starting with monday (x1). |
Hey @emufan |
👍
in this case, z have have to be the (lamda) average of the grid cells, so. e.h. today, 0-4h, 4-8 h, etc., |
When possible I try to avoid diverging from plotly's API, it's simpler for me and gives you more flexibility. |
Either I didn't get it or I don't know. 😥 My thought on the example is, that with these settings, the card would combine/calculate the values, which are then passed to plotly. Here from 5d,8-20,1d,4h example above. z is calclulated then from the values in x y timeframes
according to https://plotly.com/javascript/heatmaps/#heatmap-with-categorical-axis-labels |
It took me a year, but you can do it! |
I don't. You'll need a bit of JavaScript. Can you code? Here's a different example you can use as a base. type: custom:plotly-graph-dev
title: 2D Histogram - Last 10 days
entities:
- entity: sensor.openweathermap_pressure
period: hour
internal: true
fn: $fn ({ xs, ys, vars }) => { vars.pressure = ys; vars.xs = xs; }
- entity: sensor.openweathermap_temperature
period: hour
internal: true
fn: $fn ({ ys, vars }) => vars.temperature = ys
- entity: ''
x: $fn ({ vars }) => vars.temperature
'y': $fn ({ vars }) => vars.pressure
type: histogram2d
mode: lines+markers
line:
color: null
hours_to_show: 240
raw_plotly_config: true
ha_theme: true
layout:
margin:
t: 10
l: 70
r: 0
b: 70
height: 500
zaxis:
title:
text: Humidity
yaxis:
title:
text: Pressure
xaxis:
title:
text: Temperature
autorange: true
|
Partly. Most of the time I'm able to search, adopt, afjust, ... - but need mostly a starting point. And for this, I only found examples for heatmaps with different entities on the axis and then a count on the z. As in your example. But I would like to have only one entity, but different scales on x and y and then e.g. mean on z. Of for this, I don't have a fitting starting point, how to get the values, etc. Like in example above. But of course, I will stay searching for examples. If you have a good one, I would really appreciate. |
You can use the same entity in different rows and do the same as above :) |
I know. But I have no starting point or idea how to calculate the mean for such z field, e.g. mean of temperature, Monday, 0-8h, Tuesday, 9-16h accordingly. or to set a scale of 7 entries on x and 3 on y as in example above. I will keep searching and trying to understand how it works. So either I get it working via try and error or someday, someone has a simple example to extend. We'll see. Until now, I understand the examples, but they are mostly from the same type and not fitting to my goto idea above. Thanks for your help anyway. |
Ok, I'll give it a try |
Here it is |
Again, more than great. And surprisingly I understand, what you are doing. So the best starting point for further ideas and adoptions on my side! 👍 |
Would be great to have heatmaps as type as well. E.g. x-axsis days, y-axis hours or timeframes or .... The would give a great visual overview for temperatures, percentages, liters, etc. etc.
https://plotly.com/javascript/heatmaps/
The text was updated successfully, but these errors were encountered: