🧱

Gráfico de barras apiladas con esquinas redondeadas

Gráfico de barras apiladas con esquinas redondeadas. Basado en un ejemplo oficial de Vega-Lite y adaptado para Deneb en Power BI; ten en cuenta que la interactividad de cross-filter es limitada cuando se usa ‘aggregate’.

Vega-Lite stacked-bar intermedio ✓ Tooltip ✓ Context menu

Vista previa en vivo

Render con datos de muestra · Vega/Vega-Lite
Cargando vista previa…

Vista previa renderizada con el runtime de Deneb · MIT © Daniel Marsh-Patrick

🔽 Descargar .pbix 🔽 Descargar spec .json

🧩 Campos que espera

  1. __0__ Date dateTime
  2. __1__ Category texto

Arrastra tus campos a Values en este orden.

🎯 Técnica

Motor
Vega-Lite 5.16.3
Marks
bar, text
Power BI
pbiColorNominal, pbiFormat

Cómo usarlo en Power BI

  1. Agrega el visual Deneb a tu reporte e ingresa a su editor.
  2. Arrastra tus campos a Values en este orden: Date , Category .
  3. Pega el spec (botón «Copiar spec» arriba) en el editor JSON de Deneb.
  4. Mapea tus columnas y ajusta a tu gusto. La interactividad nativa ya viene configurada.
Ver el spec Vega-Lite completo
spec.vega-lite.json
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "usermeta": {
    "deneb": {
      "build": "1.6.2.1",
      "metaVersion": 1,
      "provider": "vegaLite",
      "providerVersion": "5.16.3"
    },
    "interactivity": {
      "tooltip": true,
      "contextMenu": true,
      "selection": false,
      "highlight": false,
      "dataPointLimit": 50
    },
    "information": {
      "name": "Stacked Bar Chart With Rounded Corners",
      "description": "Based on an official Vega-Lite example and adapted for use in Deneb within Power BI, it should be noted that cross-filtering interactivity is limited when using 'aggregate'. Author: Cristobal Salcedo Beltran. Contact: contacto@csalcedodatabi.com.",
      "author": "Cristobal Salcedo Beltran",
      "uuid": "43117c42-9880-4a5e-9526-27d9a4954b1d",
      "generated": "2024-07-16T22:46:34.108Z"
    },
    "dataset": [
      {
        "key": "__0__",
        "name": "Date",
        "description": "",
        "type": "dateTime",
        "kind": "column"
      },
      {
        "key": "__1__",
        "name": "Category",
        "description": "",
        "type": "text",
        "kind": "column"
      }
    ]
  },
  "config": {
    "axisY": {
      "labelFontSize": 18,
      "tickCount": 6,
      "gridDash": [
        4,
        8
      ]
    },
    "axisX": {
      "labelFontSize": 18,
      "offset": 1,
      "labelExpr": "[pbiFormat(datum.value,'MMM')]"
    },
    "legend": {
      "orient": "top",
      "labelFontSize": 18
    }
  },
  "description": "Based on an official Vega-Lite example and adapted for use in Deneb within Power BI, it should be noted that cross-filtering interactivity is limited when using 'aggregate'. Author: Cristobal Salcedo Beltran. Contact: contacto@csalcedodatabi.com.",
  "data": {
    "name": "dataset"
  },
  "title": {
    "text": "Weather Distribution by Month",
    "fontSize": 30
  },
  "name": "Mark_BarChart",
  "mark": {
    "type": "bar",
    "cornerRadiusTopLeft": 15,
    "cornerRadiusTopRight": 15,
    "tooltip": true
  },
  "encoding": {
    "x": {
      "timeUnit": "month",
      "field": "__0__",
      "type": "ordinal",
      "title": null
    },
    "y": {
      "aggregate": "count",
      "type": "quantitative",
      "title": null
    },
    "color": {
      "field": "__1__",
      "type": "nominal",
      "scale": {
        "domain": [
          "sun",
          "fog",
          "drizzle",
          "rain",
          "snow"
        ],
        "scheme": "pbiColorNominal"
      },
      "title": null
    }
  }
}
¡Contáctame!