- Home
- Deneb gallery
- Dynamic Pareto Chart
Dynamic Pareto Chart
Dynamic Pareto chart with Deneb: bars from largest to smallest, the cumulative %, and everything past 80% of sales in another colour.
💡 When to use it
When you need to prioritise and there are too many candidates: which products, customers or incidents make up the bulk of the total, and which are noise.
Vega-Lite pareto ✓ Cross-filter✓ Tooltip✓ Context menu✓ Selection
Live preview
Rendered with sample data · Vega/Vega-Lite🖱️ Live cross-filter — click a mark and the others filter or dim right here (Deneb's runtime reused, MIT). Just like in Power BI.
Loading preview… Preview rendered with the runtime of Deneb · MIT © Daniel Marsh-Patrick
The sample data and the chart's own titles stay as they ship in the spec.
🧩 Fields it expects
-
__0__Product text -
__1__Total Ventas number measure -
__2__Acumulado de ventas Por Producto number measure -
__3__% Acumulado de Ventas por Producto number measure
Drag your fields into Values in this order.
How to use it in Power BI
- Add the Deneb visual to your report and open its editor.
- Drag your fields into Values in this order: Product , Total Ventas , Acumulado de ventas Por Producto , % Acumulado de Ventas por Producto .
- Paste the spec (the «Copy spec» button above) into Deneb's JSON editor.
- Map your columns and adjust it to taste. The native interactivity is already set up.
See the full spec: Vega-Lite
spec.vega-lite.json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Las barras van de mayor a menor y la línea acumula el porcentaje: donde cruza el 80 % tienes los pocos productos que explican casi toda la venta. El resto se colorea aparte para que se vea de un vistazo dónde dejas de ganar. Por CSalcedoDataBI · https://csalcedodatabi.com/deneb/diagramas-pareto",
"usermeta": {
"deneb": {
"build": "1.6.2.1",
"metaVersion": 1,
"provider": "vegaLite",
"providerVersion": "5.16.3"
},
"interactivity": {
"tooltip": true,
"contextMenu": true,
"selection": true,
"highlight": true,
"dataPointLimit": 50
},
"information": {
"name": "Gráfico de Pareto Dinámico",
"description": "Esta plantilla permite la creación de un gráfico de Pareto dinámico, el cual puede ser personalizado según las necesidades del usuario. Los campos de datos y medidas son ejemplos y pueden ser reemplazados para adaptarse a diferentes categorías y métricas. Autor: Cristobal Salcedo Beltrán.",
"author": "Cristobal Salcedo Beltrán",
"uuid": "267e3e24-a51c-4d9c-9474-4fb34725506b",
"generated": "2024-05-27T21:20:00.612Z"
},
"dataset": [
{
"key": "__0__",
"name": "Product",
"description": "Este campo categórico puede ser reemplazado por cualquier otro, según las necesidades del usuario",
"type": "text",
"kind": "column"
},
{
"key": "__1__",
"name": "Total Ventas",
"description": "Esta medida representa el total de ventas acumuladas. Puede ser remplazada por cualquier otra medida, según las necesidades del usuario",
"type": "numeric",
"kind": "measure"
},
{
"key": "__2__",
"name": "Acumulado de ventas Por Producto",
"description": "Muestra el total acumulado de ventas para cada producto. Descripción opcional para el usuario final. Puede ser remplazada por cualquier otra medida, según las necesidades del usuario",
"type": "numeric",
"kind": "measure"
},
{
"key": "__3__",
"name": "% Acumulado de Ventas por Producto",
"description": "Indica el porcentaje acumulado de ventas por producto. Descripción opcional para el usuario final. Puede ser remplazada por cualquier otra medida, según las necesidades del usuario",
"type": "numeric",
"kind": "measure"
}
]
},
"config": {
"view": {
"stroke": "transparent"
},
"line": {
"strokeWidth": 3,
"strokeCap": "round",
"strokeJoin": "round"
},
"text": {
"font": "Segoe UI",
"fontSize": 18,
"fill": "#605E5C"
},
"axis": {
"ticks": false,
"grid": false,
"domain": false,
"labelColor": "#605E5C",
"labelFontSize": 18
},
"axisX": {
"labelPadding": 5,
"labelAngle": 0
},
"axisY": {
"labelPadding": 10,
"labels": false
}
},
"data": {
"name": "dataset"
},
"title": {
"text": "Ventas por producto (Principio de Pareto)",
"subtitle": "'Muestra la contribución de los productos al total de ventas",
"fontSize": 20,
"color": "#333333"
},
"layer": [
{
"mark": {
"type": "bar",
"tooltip": true,
"color": {
"expr": "datum['__3__']<=0.8?'#7F7F7F': '#D62728'"
}
},
"encoding": {
"y": {
"field": "__1__"
},
"opacity": {
"condition": {
"test": {
"field": "__selected__",
"equal": "off"
},
"value": 0.3
},
"value": 1
}
}
},
{
"mark": {
"type": "line",
"interpolate": "linear",
"color": "blue",
"point": {
"color": "#1F77B4",
"filled": false,
"fill": "white"
}
},
"encoding": {
"y": {
"field": "__3__"
}
}
},
{
"mark": {
"type": "text",
"color": "#333333",
"yOffset": -16
},
"encoding": {
"text": {
"field": "__3__",
"format": "0.0%",
"formatType": "pbiFormat"
},
"y": {
"field": "__3__"
}
}
},
{
"mark": {
"type": "text",
"color": "#333333",
"yOffset": -8
},
"encoding": {
"text": {
"field": "__1__",
"format": "$#0,0",
"formatType": "pbiFormat"
},
"y": {
"field": "__1__"
}
}
},
{
"mark": {
"type": "bar"
},
"encoding": {
"y": {
"field": "__1__"
},
"color": {
"field": "__3__",
"type": "nominal",
"scale": {
"domain": [
"0% - 80%",
"80% - 100%"
],
"range": [
"#7F7F7F",
"#D62728"
]
},
"legend": {
"title": "Principio de Pareto",
"orient": "top",
"padding": 10,
"labelFont": "Helvetica Neue, Arial",
"labelFontSize": 14,
"symbolType": "square",
"symbolSize": 100
}
}
}
}
],
"resolve": {
"scale": {
"y": "independent"
}
},
"encoding": {
"x": {
"field": "__0__",
"type": "nominal",
"sort": {
"field": "__1__",
"op": "max",
"order": "descending"
}
},
"y": {
"type": "quantitative",
"axis": {
"title": " "
}
}
}
}