Forum Discussion
Deneb Visual Vegalite - Duplicate labels (Month-Year) on X axis
Hello Experts,
I am creating a PBI custom visual using Deneb Vegalite and I am facing problem with X axis labels. Visual is shown in the attched image.
On X axis, I have Date type column named 'Date_Roadmap' which I have formatted to show in month-year format. On Y axis, I am showing release name. As marks I am showing milestones (C1, C2 etc) for those releases.
Problem - Today, visual generating as same labels on X axis as many times as I have Milestones (marks) in same month. For e.g. I have 3 milestones in month of June for different date in same month June. So, on X axis, it is generating same label June 2023 for 3 times instead of one.
Expected Output:
I would like to show marks based on dates at same positions but on X axis, I would like to show unique labels for Month-Year.
Here is my code for your reference. Month-Year label could be at center, start or end.
regards
8 Replies
- giammariam
Solution Sage
Hey malpani, does changing the "type" under the x encoding from "nominal" to "temporal" solve it? If not, I'll be happy to look further. I'd just need some data that is structured similarly to your actual data (here's how).
- malpani
Helper II
Hi giammariam
Thank you for looking into this. I tried earlier with temporal as well but that doesn't help and also reduces the gap between labels and marks which makes it overlapping.Here is the link to sample PBIx file for your reference.
- giammariam
Solution Sage
Hi malpani, thanks for the .pbix. For both of your x-axes keep the type as temporal and make sure you set
"timeUnit": "yearmonth",
Going by your formatting, I'm assuming you only want the month and year. This should get rid of the duplicates.If this is enough to get you going please consider liking this reply and choosing it as the solution. Otherwise, I'm happy to help further.
- malpani
Helper II
Hi giammariam
Thanks for your help.But I expect the marks shown by date and axis labels by unique Month-Year.
As you see, if you change both X axis encoding to temporal, marks overlap with each other.
We had two marks in July C3 and C5 but with temporal they overlap with each other which is not readable.
So, I would like to keep the same position for C3 and C5 by date in a month but when it comes to label show only once per month.- malpani
Helper II
Hi giammariam : Do you think it is possible to have month-Year on X axis but marks shown by dates.
What if we calculate Month-Year column Date column Power Query or by DAX and then use that column ?