How to return (change) conditional values? #386
Replies: 4 comments 12 replies
-
Wow, you started on expert mode :)
Google (or search these discussions)
you can set
try with: ({ meta }) => ({
xs: meta.data.map(({ start_time }) => new Date(start_time)),
ys: meta.data.map(({ start_time }, i) =>
[16, 17, 18].includes(new Date(start_time).getHours()) ? 12 : 0
),
}); |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Managed to fudge the bars to overlap as I envisaged, but the hourly bar "starts" half an hour "early". |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Firstly I'm impressed with this card, I have been a big ApexCharts card user but a crippling javascript bug and unaddressed limitations are forcing me to look for alternatives So I'm trying reproduce and improve the graphs I want with added interactive element of this plotly card.
Anyway, one of the things I could do with apex was set a data_generator and get it to spit out anything. One of the things I want to do here is add a series of fixed additions only when certain conditions are met, in example here, the condition is time of day. I add blocks of 12, but only ad certain hours (16, 17 and 18:00). I tried to use the same basic code and make an array of timestamps and values of either 0 or 12 but can't figure out how to output that in the plotly series (entity) it just shows the original entity contents.
This is what I want to achieve:

The filters:
The original data set ( for this series, I'm only interested in the datetime and whether or not the "bump" applies

Apex chart was happy to replace the whole entity with a timestamp, value array, but I think with plotly I need to be more precise. How would I best go about this with the plotly card and filters?

multi stacks and overlaid series with different semi-transparent colours are things I would want to use here too, but one thing at a time 😀
Beta Was this translation helpful? Give feedback.
All reactions