Vega vs. Vega-Lite Issues

Have any of you that are working with Deneb ventured into Vega yet (as opposed to Vega-Lite)? I wanted to explore some of the additional capabilities of Vega, but I’m running into a severe lack of documentation and examples to help me through what seems like a couple of very basic issues.

The first issue I’m having is related to setting the color of a mark. In Vega-Lite, I can use an expression to dynamically set the color of the mark. For example, both of these are valid ways in which I have successfully set the color of a “bar” mark in Vega-Lite:

"color": {"value": {"expr": "pbiColor(3)"}
"style": {
   "DefaultStyle": {
      "color": {"expr": "datum['Year'] === datum['maxYear'] ? pbiColor(5) : pbiColor(3)"}
   }
}

In Vega, however, color is set using the “fill” property (instead of “color”), and it does not want to accept any value calculated by an expression. At first I thought it might be the pbiColor() function, but even if I replace that with pre-defined values like “white” or “blue”, or a hex code like “#00FF00” it doesn’t work.

Does anyone know what I’m doing wrong? Or can you confirm that this is an issue with the Vega spec itself and not user error?

Thanks!

Hi @Dave. I doubt there’s an issue with the Vega spec; I’ve mostly used Vega-Lite, so will defer to @dm-p for further comment on the colour syntax in Deneb for Vega.
Greg

1 Like

In Vega you need to use signal as a value property of a mark.

I’m currently on leave so can’t provide more detail, but the doc link shouod cover it and lots of examples on the Vega site use signals bindings and should help with the syntax

1 Like

Thanks, @dm-p! That helps a lot! I need to get a better understanding of signals since that is not a concept used in Vega-Lite. That solved my issue about using an expression to set the fill property. I’m sure I will have many more questions as I dig into Vega.

P.S. Deneb is awesome! Thanks for such a valuable contribution to the Power BI world!

1 Like