Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I want to add a label for the reference line that just says "today's date". When I try to add one it adds a label with today's date to every bubble. I would like a label for the reference line on top where it would be readable.
Here is my code:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"name": "dataset"},
"width": 950,
"height": 400,
"transform": [
{
"calculate": "now()",
"as": "today"
}
],
"encoding": {
"x": {
"field": "Date",
"type": "temporal",
"axis": {
"grid": false,
"format": "Q%q %Y"
}
},
"y": {
"field": "Prob",
"type": "quantitative"
}
},
"layer": [
{
"mark": {
"type": "circle",
"opacity": 0.8,
"stroke": "black",
"strokeWidth": 1
},
"encoding": {
"size": {
"field": "Amount",
"type": "quantitative"
},
"color": {
"field": "Group",
"type": "nominal"
}
}
},
{
"mark": {
"type": "circle",
"opacity": 0.8,
"stroke": "black",
"strokeWidth": 1
},
"encoding": {
"size": {
"field": "Amount",
"type": "quantitative",
"scale": {"rangeMax": 1000}
},
"color": {
"field": "Group",
"type": "nominal"
}
}
},
{
"mark": {
"type": "rule",
"opacity": 0.6
},
"encoding": {
"x": {
"field": "today",
"type": "temporal"
},
"size": {"value": 1},
"color": {"value": "grey"}
}
}
]
}
Answering my own question:
I created another layer inside the original layers that contained just the reference line and text mark for todays date. This is my code for the text mark:
{
"mark": {
"type": "text",
"align": "left",
"baseline": "bottom",
"dx":-15
},
"encoding": {
"text": {"value": "Today"},
"x": {
"field": "today",
"type": "temporal"
},
"y": {"value": 0}
}
}
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
218 | |
88 | |
83 | |
65 | |
56 |