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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
patBear
Helper I
Helper I

help with fillOpacity in Deneb

I'm struggling to learn Power BI, and in this case specifically Deneb.  I'm grateful for help on this last piece to get my project to completion.  I'm aiming for this sort of look except with project names on the bars (which I've deleted due to sensitivity).  Of note is the opacity feature to highlight the selected tier.  Currently, I have the correct number of bolded bars, they just all show at the bottom of each stack rather than on the correct bars.  Using my dataset, I have a measure to compute the total [=CALCULATE(COUNT(table[name]), VALUES(table[group]))] and a slicer on "tier."

patBear_0-1655153118475.png

My vega lite code is approximately this.  How do I tweak the fillOpacity so it would bold the correct bars?

{
  "data": {
    "values": [
      {"name": "A", "group": "Low", "tier": "Tier 3"},
      {"name": "B", "group": "Low", "tier": "Tier 1"},
      {"name": "C", "group": "Med", "tier": "Tier 1"},
      {"name": "D", "group": "High", "tier": "Tier 2"},
      {"name": "E", "group": "High", "tier": "Tier 3"},
      {"name": "F", "group": "High", "tier": "Tier 1"}
    ]
  },
  "layer": [
    {
      "mark": {
        "type": "bar",
        "stroke": "black",          
        "strokeWidth": 1,
        "tooltip": true
      },
      "encoding": {
        "y": {
          "field": "total",
          "type": "quantitative"
        }
      },
      "fill": {
        "field": "group",
        "type": "nominal",
        "scale": {
          "domain": [
            "Low",
            "Med",
            "High"
          ],
          "range": [
            "#e15759",
            "#ffff00",
            "#59a14f"
          ]
        }
      },
      "fillOpacity": {
        "field": "Opacity"
      }
    }
  ]
},
{
  "mark": {"type": "text", "dy": -10},
  "encoding": {
    "text": {
      "field": "total",
      "type": "quantitative",
      "aggregate": "sum"
    },
    "y": {
      "field": "total",
      "type": "quantitative",
      "aggregate": "sum"
    }
  }
},
{
  "mark": {"type": "text"},
  "encoding": {
    "text": {
      "field": "name",
      "type": "nominal"
    },
    "y": {
      "field": "total",
      "type": "quantitative",
      "stack": true,
      "bandPosition": 0.5
    }
  }
}

 

2 REPLIES 2
Anonymous
Not applicable

Hi @patBear ,

Please refer to the following thread:

Deneb Faceted Chart Size 

  • when you use the facet channel, you aren't able to have things dynamically size.manual heights/widths are needed for the spec to drive how each facet should resolve.

If I have misunderstood your meaning, please provide more details. 

 

 

 Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm focused on the fillOpacity function and getting it to highlight the correct bars.  I've created a more clearly stated question with working code: see highlighting bars in Deneb - fillOpacity - Microsoft Power BI Community

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.