Summary
I want to show another value on a chart column stack tooltip, but can't seem to make it work.
Details
Example data
Name 1 | added_on_month | added_on_quarter
Bird | 2021-11-01T00:00:00.000Z | 2021-10-01T00:00:00.000Z
Cat | 2022-02-01T00:00:00.000Z | 2022-01-01T00:00:00.000Z
Dog | 2022-03-01T00:00:00.000Z | 2022-01-01T00:00:00.000Z
Dog | 2022-04-01T00:00:00.000Z | 2022-04-01T00:00:00.000Z
Dog | 2022-05-01T00:00:00.000Z | 2022-04-01T00:00:00.000Z
Dog | 2022-06-01T00:00:00.000Z | 2022-04-01T00:00:00.000Z
Cat | 2022-06-01T00:00:00.000Z | 2022-04-01T00:00:00.000Z
Description of the chart
- Q4 2021: count of 1 with 1 stack in a column (1 in Nov 2021)
- Q1 2022: count of 2 with 2 stacks in a column (1 in Feb 2022, 1 in Mar 2022)
- Q2 2022: count of 4 with 3 stacks in a column (1 in Apr 2022, 1 in May 2022, and 2 in Jun 2022)
Chart setup
- Y axis is count
- X axis is added_on_quarter
- Grouped by added_on_month (stacked)
On the tooltip, I'd like to include the following
Example here based on hovering on the stack for "Jun 2022"
- Quarter: "Q2 2022" (achieved with
%{x}
in the tooltip and tick format set toQ%q %Y
) - Count for month: "2" (achieved with
%{y}
) - Month: "Jun, 2022" (I can't seem to figure this one out)
What doesn't work
{{my_query.data['offer_added_on_month'][i]}}
/ {{my_query.data.offer_added_on_month[i]}}
-> This shows me a date, but displays only a single date on all of the stacks in the respective column (when I would expect each month shows its own date on the stack in each column).
I've also tried various things after reading Plotly docs, but I'm not finding success.
On a somewhat related note, is it possible to format the tooltip plotly variables like %{x} with moment (i.e., {{moment(%{x}).format('MMM, YYYY')}}
)?
Thank you!