selecting-vizro-charts

Guides chart type selection, Plotly conventions, colors, KPI cards, and AG Grid tables for Vizro dashboards.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Choosing the wrong chart type or misusing Plotly Express in Vizro dashboards leads to misleading or visually broken visualizations, such as unaggregated bar charts stacking raw rows instead of summing values.

Core Features & Use Cases

  • Chart Selection Guidance: Decision tables mapping data questions (comparison, trend, distribution, correlation) to the right chart type, with explicit anti-patterns to avoid.
  • Plotly & Color Conventions: Rules for aggregation, sorting, axis cleanup, and when to let Vizro handle colors versus using vizro.themes palettes for AG Grid styling.
  • KPI Cards and Tables: Instructions for using built-in kpi_card figures and vm.AgGrid with dash_ag_grid, including when @capture("graph") custom functions are required.
  • Use Case: When building a Vizro dashboard and unsure whether a dataset needs a bar, line, or scatter chart, this Skill provides the decision criteria and the correct implementation pattern, including pre-aggregation inside custom chart functions.

Quick Start

Ask which chart type fits a dataset comparing regional revenue over time in a Vizro dashboard and how to implement it correctly.

Frequently Asked Questions about selecting-vizro-charts

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

FAQPage Schema
How do I choose the right chart type for my Vizro dashboard?

Match the chart to your data question: bar charts for comparing categories, line charts for trends over 12+ time points, pie charts only for 2-5 part-to-whole slices, histograms for distributions, and scatter plots for correlations. Avoid 3D charts, dual Y-axes, and pies with 6+ slices.

Why does my Plotly Express bar chart look broken in Vizro?

Plotly Express does not aggregate data, so passing detail-level rows stacks individual rows as separate rectangles instead of summing values. Write a @capture("graph") custom chart function that aggregates the data inside before plotting.

Should I set custom colors on Plotly charts in Vizro?

No. Plotly charts and KPI cards automatically use Vizro template color schemes, so do not set marker_color, hex codes, or color_discrete_sequence unless the user explicitly requests it. Only AG Grid needs manual colors via vizro.themes palettes.

How do I add a table to a Vizro dashboard?

Use vm.AgGrid with figure=dash_ag_grid(data_frame=...) from vizro.tables. Never use vm.Table, Dash DataTable, or fake tables with Plotly heatmaps. For custom column logic, write a @capture("ag_grid") function with data_frame as the argument name.

When should I use a custom chart function instead of standard Plotly Express?

Use @capture("graph") when you need aggregation or sorting before plotting, update_layout or update_traces calls, reference lines, parameter-driven logic, dual-axis charts, or multi-trace go.Figure compositions. Simple px charts expressible in YAML do not need custom functions.

Can I build KPI cards as custom charts in Vizro?

No. Use the built-in kpi_card or kpi_card_reference from vizro.figures inside a Figure model, with titles in the figure args. Custom chart implementations are only acceptable when the KPI is strictly impossible with built-ins, such as dynamically displaying text.