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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.