Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Abhijith19
New Contributor

Deneb: How to set a minimum width with dynamic step sizing?

Iโ€™m using a Deneb visual to display the number of tickets across different venues as a bar chart. The number of venues varies depending on the filter selection.

Currently, Iโ€™m using "width": { "step": 70 } so that the chart adjusts dynamically with the number of venues. This works fine when there are many venues, since the chart shows a horizontal scrollbar as expected.

However, when only a small number of venues are selected (for example, just 1 or 2), the chart becomes very narrow and leaves a large amount of white space on the right-hand side.

Is there a way to set a minimum width for the visual (or another approach) so that it doesnโ€™t shrink too much when only a few categories are selected?

1 REPLY 1
BeaBF
Valued Contributor III

@Abhijith19 Hi!

Option 1: Use container width and let Vega-Lite fill space

"width": "container"

This tells the chart to always fill the width of the Deneb visual.

 

 

Option 2: Use a calculated width with step and a minimum

If you want both scrollbars and a minimum width, you can compute it in a signal (requires Vega, not just Vega-Lite). In Deneb, you can switch to a Vega spec:

"width": { "signal": "max(availableWidth, 70 * domain('x').length)" }

 
  • domain('x').length โ†’ number of categories in your x-axis.

  • 70 * โ€ฆ โ†’ your step-based width.

  • max(availableWidth, โ€ฆ) โ†’ enforces a minimum.

  • In Deneb, availableWidth corresponds to the actual visual size.

BBF


๐Ÿ’ก Did I answer your question? Mark my post as a solution!

๐Ÿ‘ Kudos are appreciated

๐Ÿ”ฅ Proud to be a Super User!

Community News image 1920X1080.png

 

Helpful resources

Announcements
Top Solution Authors
Users online (11,584)