The horizontal space available to the standard bar chart visual in Power BI is divided into three areas (the category [the y axis], the value [the bar], and the data label); as well, long categories are often shortened (fewer characters and an ellipsis). With Deneb, we can avoid this overflow impact and maximize the horizontal space available for the bar by controlling the position of the category, and I enclose a Deneb/Vega-Lite template for such a space-saving bar chart.
This template illustrates a number of Deneb/Vega-Lite features, including:
- a shared Y “encoding” block outside the layered 3 marks (bar, category, data label)
- a “sort” block in the y axis encoding to display the bars in descending value order
- a Deneb formatting of data labels using Power BI formatting strings
- a Deneb formatting of x-axis labels using Power BI formatting strings
- optional properties (colour, fontSize, fontStyle, and fontWeight) to customize of the display the text marks as desired
The intent of this template is not to provide a finished visual, but rather to serve as a starting point for further custom visual development.
Also included is the sample PBIX using the Enterprise DNA Practice Dataset as a demo.
NOTE: This template is provided as-is for information purposes only, and its use is solely at the discretion of the end user; no responsibility is assumed by the author.
Greg
deneb.space_saving_bar_chart.0.2.json (4.5 KB)
Deneb Templates - Space-Saving Bar Chart.pbix (1.7 MB)