Resize or Autosize Deneb Chart with Filter in Power BI

I have a visual box plot with deneb on my dashboard that displays productivity by product, categorized by year. It’s a visualization that includes many products, as you can see. On this page, users can select many products. However, when selecting one or a few, the box plot is shifted to the left and not centered as it should be. I’ve already tried using autosize, but since we have many products, I need to define the width with steps, and in this case, autosize does not apply. When selecting all products, I need to maintain the correct spacing, and when I select just one product or a few, the size is readjusted. How could I solve this problem?

DenebPowerBI.pbix (2.1 MB)
This is the expected outcome


It is being displayed like this

Thank you in advance if you can help me!
Best Regards,

Hi @renatamorcs.

I’m sure I’m missing something and don’t get your issue correctly. From what I understand so far, you want to set the width of each “step” in the boxplot; you already have a “width”: {“step”: 15} in your Vega-Lite JSON, so I simply adjusted the value.

(Also, as both your “Problem” and “Mockup” pages were Deneb, I’m not sure which one to use as a base, so chose “Problem”.)

I doubt this solves your issue, and perhaps a couple of marked-up screenshots showing what your desired outcome is both when 1 product is selected and when multiple products are selected would help to clarify.

Hope it helps.
Greg
eDNA Forum - Deneb Boxplot Width.pbix (2.1 MB)

When I select multiple products it should show the image below


If I select just one product, it should appear centered and not on the left as I showed in the first mockup.
So if I select just one product it is in the middle like the image below:

If I select more than one product it must readjust from left to center as in this second case where I select 2 products

However, using deneb from the Problem page, I only get this result

I hope I was able to explain my problem better

Hi @renatamorcs. OK, not sure how to (or if I can) do variable step width based on the number of products selected. To help the investigation, can you please construct a dimensional data model with a proper [Products] dimension and [Crop] fact table, or upload your dataset?

Thanks,
Greg

Follows pbix with the suggested data model
eDNA Forum - Deneb Boxplot Width.pbix (2.1 MB)

Still looks the same. I’ll instead export the data via DAX Studio and model. Then can start to look at the Deneb … more tomorrow.
Greg

Hi @renatamorcs.

Is this what you’re going for?

If so, just remove the “width-step-value” line from your code to get Vega-Lite to automatically center the selected products and calculate the step size.

Hope it helps.
Greg
eDNA Forum - Deneb Boxplot Width - V2.pbix (2.1 MB)

Hi Greg!!
Kind of … but still I need the user will be able select all products like the image bellow and that the chart size will be resize too. In this case, this is not happened without widht step defined … I thought that had other way for resolve this perhaps with what you said about divide the width with the count the products


I appreciate you time for try response this, maybe really it’s not possible configure the resize like the way I need…

Hi @renatamorcs

I had thought that Vega-Lite might permit an expression as width-step-expression but can only get width-step-value to work, so AFAIK it looks like you can’t have it both ways.

On first glance, I can’t see how selecting all products would help the user to make a decision, so perhaps stating that the visual should be limited to no more than, say, 5 products might be an option; you can then use the width-container syntax to automatically center and set the step size (but the visual will not scroll).

  "layer": [
    {
      "width": "container",
      "mark": {
        "type": "boxplot",
        "extent": "min-max",
        "ticks": true
      }
    }
  ],

You could then possibly add a different visual to display, for example, a bar chart of the maximum productivity of all products to help the user determine which products to select.

Hope it helps.
Greg
eDNA Forum - Deneb Boxplot Width - V3.pbix (2.1 MB)