Hi All,
I used for this workout ideas from:
@Greg Template: Deneb Template - Donut KPI Chart - Deneb Showcase - Enterprise DNA Forum
@Greg solution for workout 001 and his option 2: Deneb Workout 01 - Line Chart with Smoothing - Workouts / Deneb - Enterprise DNA Forum
My solution:
Code:
{
"width": 260,
"height": 200,
"title": {
"text": "Deneb Workout 03",
"subtitle": "KPI Donut Chart",
"subtitleFontStyle": "italic",
"anchor": "start",
"align": "left",
"font": "Verdana",
"fontSize": 16,
"fontWeight": "bold",
"offset": 20
},
"data": {"name": "dataset"},
"transform": [
{
"calculate": "2*PI*datum['Percentage Actual vs Budget']",
"as": "Ring1_Theta2"
}
],
"params": [
{
"name": "_colour",
"value": "#0F4C81",
"bind": {
"input": "color",
"name": "colour: "
}
},
{
"name": "_RingOuterRadius",
"value": 80
},
{
"name": "_RingInnerRadius",
"value": 100
}
],
"layer": [
{
"name": "RING OPAQUE BACKGROUND",
"mark": {
"type": "arc",
"outerRadius": {
"expr": "_RingOuterRadius"
},
"innerRadius": {
"expr": "_RingInnerRadius"
},
"theta": 0,
"theta2": {"expr": "2 * PI"}
},
"encoding": {
"color": {
"value": {"expr": "_colour"}
},
"opacity": {"value": 0.3}
}
},
{
"name": "RING",
"mark": {
"type": "arc",
"tooltip": true,
"outerRadius": {
"expr": "_RingOuterRadius"
},
"innerRadius": {
"expr": "_RingInnerRadius"
},
"theta": 0,
"theta2": {
"expr": "datum.Ring1_Theta2"
},
"cornerRadius": 10
},
"encoding": {
"color": {
"value": {"expr": "_colour"}
},
"tooltip": [
{
"field": "Percentage Actual vs Budget",
"title": "Actual vs Budget",
"format": "#%",
"formatType": "pbiFormat"
}
]
}
},
{
"name": "VALUE",
"mark": {
"type": "text",
"fontSize": 24
},
"encoding": {
"text": {
"field": "Percentage Actual vs Budget",
"type": "nominal",
"format": "#%",
"formatType": "pbiFormat"
},
"color": {"value": "#000000"}
}
},
{
"name": "LABEL",
"mark": {
"type": "text",
"fontSize": 12,
"dx": 0,
"dy": 20
},
"encoding": {
"text": {
"field": "Percentage Description",
"type": "nominal"
},
"color": {"value": "#000000"}
}
}
]
}