wiring-vizro-actions

Implements cross-filter, cross-highlight, drill-through, and data export interactions in Vizro dashboards.

3.8k|299|Updated Sep 4, 2023
One-click install
npx skills add https://github.com/mckinsey/vizro --skill wiring-vizro-actions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wiring-vizro-actions
Source: https://github.com/mckinsey/vizro/tree/main/vizro-e2e-flow/skills/wiring-vizro-actions
Command: npx skills add https://github.com/mckinsey/vizro --skill wiring-vizro-actions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires vizro, and includes references (resource) components.

What problem does it solve?

Adding interactive behavior to a Vizro dashboard — making a chart click filter other components, drilling through to a detail page, or exporting filtered data — requires wiring sources, controls, and targets correctly, and small mistakes (missing show_in_url, wrong custom_data, deprecated filter_interaction) silently break the app or raise build-time errors.

Core Features & Use Cases

  • Interaction Pattern Selection: A decision flow maps data shape and user needs to five named patterns — Hierarchical Drill-Down, Single-Page Drill-Down, Comparison Spotlight, Multi-Dimensional Slice, and Data Export — with explicit when-to-use and when-not-to-use criteria.
  • Source → Control → Target Wiring: Implements va.set_control actions on vm.Graph and vm.AgGrid sources that write into explicit vm.Filter or vm.Parameter controls, which then update target components.
  • Gotcha Prevention: Codifies fixes for common failures such as custom_data for non-positional columns, show_in_url=True for cross-page filters, hidden highlight Parameters with a "NONE" option, and Flex layouts for back buttons.
  • Use Case: A user building a sales dashboard wants clicking a rep row in an AgGrid table to navigate to a filtered detail page with a back button and an export button — the skill provides the complete working code for that drill-through.

Quick Start

Ask the AI to add a cross-filter so that clicking a bar in your Vizro chart filters the table below it.

Frequently Asked Questions about wiring-vizro-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make clicking a Vizro chart filter other components?

Add va.set_control(control="filter_id", value="y") to the chart's actions argument, then define a vm.Filter with that id and the target column. The click writes the clicked value into the filter, which updates its target components.

How do I add cross-page drill-through in a Vizro dashboard?

Set va.set_control on the source Graph or AgGrid pointing to a filter on the target page, and set show_in_url=True on that filter or Vizro raises a ValueError at build time. Add a back button with href="/" if the source is the first page.

Why does my Vizro cross-filter click do nothing?

The clicked column is likely not on a positional axis (x, y, z, lat, lon). Add custom_data="column" to the figure and use value="column" in set_control so the click carries that value.

Can I wrap Vizro built-in actions like export_data in vm.Action?

No. Built-in actions such as va.export_data() and va.set_control() must be passed directly into actions=; wrapping them in vm.Action raises an exception because built-ins already define their own inputs and outputs.

When should I use a sidebar filter instead of chart cross-filtering in Vizro?

Use a sidebar vm.Filter for view-only dashboards, simple filtering needs, small datasets with fewer than about five groups, or when users already know the value they want. Cross-filtering suits selection driven by visual patterns in the chart.

How do I highlight one entity in a Vizro chart without filtering data?

Use a custom @capture("graph") chart with a highlight_X argument wired to a hidden vm.Parameter via set_control. Include "NONE" as the first selector option so the chart starts unhighlighted and resets correctly.