Reputation: 31
I am new to using Vega-lite through Deneb in Power BI. I am creating a bubble chart as a timeline view. I included my code below. The size of the bubbles in based on value, the date is the x-axis, and the prob is the y-axis. Everything works perfectly except the tooltip. For ID#, instead of showing the number it shows "False". If I put ID# in the labels for each bubble it shows the number just fine, so I'm not sure why it's showing "False" instead of the ID number in the tooltip. Thanks!
I based my chart off this one: https://vega.github.io/vega-lite/examples/circle_natural_disasters.html
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"name": "dataset"
},
"width": 950,
"height": 400,
"encoding": {
"x": {
"field": "Date",
"type": "temporal",
"axis": {"grid": false, "format":"Q%q %Y", "title":"Date"}
},
"y": {
"field": "Prob",
"type": "quantitative",
"axis": {"title": "Prob"}
},
"tooltip" : [
{"field":"Title", "type": "nominal"},
{"field":"ID#", "type":"nominal"},
{"field":"Amount", "type": "quantitative"},
{"field":"Description", "type":"nominal"}
]
},
"layer":[{
"mark":{
"type": "circle",
"opacity": 0.8,
"stroke": "black",
"strokeWidth": 1
},
"encoding": {
"size": {
"field": "Amount",
"type": "quantitative",
"title": "",
"legend": "",
"scale": {"rangeMax": 5000}
},
"color": {
"field": "Type",
"type": "nominal"
}
}
},
{
"mark":{
"type": "text",
"align": "left",
"baseline": "top",
"dx": 5,
"limit":200,
"angle":-25
},
"encoding": {
"text":{"field":"Title", "type":"nominal"}
}
}
]
}
I tried putting ID# in the tooltip but instead of showing the ID#, it just shows the word "False" for ID# for all bubbles in the chart.
Upvotes: 3
Views: 266
Reputation: 87
I'm not allowed to share any file by my company but I can reproduce the tooltip showing false instead of a value with only the following data in Power Bi
Date | Factory | Value |
---|---|---|
2024-01-01 | 0001 | 100 |
2024-01-01 | AB50 | 120 |
2024-01-05 | AB50 | 125 |
2024-01-07 | 0001 | 130 |
And the following Vega Lite code in Deneb
{
"data": {"name": "dataset"},
"mark": "point",
"encoding": {
"x": {
"field": "Date",
"type": "temporal"
},
"y": {
"field": "Value",
"type": "quantitative"
},
"tooltip": [
{
"field": "Factory",
"type": "nominal"
}
]
}
}
The tooltip then shows false when Factory is '0001'.
It is not an answer I know, but my reputation is too low to make a comment in the original question where @davidebacci asks for a sample file.
Using Deneb 1.6.2.1 in Power Bi Version: 2.127.1080.0 64-bit (March 2024) the tooltip also shows false when Factory = '0001' when using this Vega-Lite code that includes the data:
{
"data": {
"values": [
{"Date": "2024-01-01", "Factory": "0001", "Value": 100},
{"Date": "2024-01-02", "Factory": "AB50", "Value": 100},
{"Date": "2024-01-03", "Factory": "0001", "Value": 100},
{"Date": "2024-01-04", "Factory": "AB50", "Value": 100}
]
},
"mark": "point",
"encoding": {
"x": {
"field": "Date",
"type": "temporal"
},
"y": {
"field": "Value",
"type": "quantitative"
},
"tooltip": [
{
"field": "Factory",
"type": "nominal"
}
]
}
}
Upvotes: 1
Reputation: 2451
Alyssa answered this question herself:
For anyone with this issue: changing the data type fixed this problem for me! I had it stored as text because I didn't want PBI to automatically summarize it. When I changed it to a numerical data type in PBI it fixed my problem in Deneb.
Upvotes: 0