Help with switching axis field

HI @valeriabreveglieri

OK, I couldn’t figure out a way to handle the temporal axis issue, so I decided to avoid it altogether and instead use a quantitative X axis for both visuals. So, I computed the hours and minutes as integers, then composed decimal numbers from them as needed. Here’s what I came up with:

Also, I knew I’d used a “visual switching” technique a while ago, based on a “hack” discovered by Madison Giammaria last year:

  • add a parameter for an expression to retrieve the frequency selected in the Power BI slicer
  • add a parameter for an expression to set the “padding” of the child visuals

Vega-Lite then uses the padding values when rendering the visual.

Here’s the [params] block from my I used in this second version:

{
  "params": [
    {
      "name": "_meeting_frequency",
      "expr": "data('dataset')[0]['Frequency']"
    },
    {
      "name": "padding",
      "expr": "{ top: _meeting_frequency == 'Daily' ? 20 : -540, bottom: _meeting_frequency == 'Daily' ? -530 : 20, left: _meeting_frequency == 'Daily' ? -130 : 10, right: _meeting_frequency == 'Daily' ? 0 : 0 }"
    }
  ]
}

Here’s the links:
Technique found by Madison Giammaria and posted to LinkedIn in July 2024:

GP’s example from July 2024 using this technique in the Deneb Showcase section of the Enterprise DNA website:

As this was only an alternative solution, I was a bit quick-and-dirty: although I tried to use several of your code blocks, I’m sure I missed several (e.g., tooltips, yOffset, etc.). There’s probably some left over development artifacts as well. Nevertheless …

I know its not what you were looking for, but I hope it helps.

Greg

eDNA Forum - Deneb Team Meetings - V2.pbix (2.4 MB)
Meetings.xlsx (13.0 KB)

3 Likes