visualizationvega-litevegavega-lite-apivega-embed

How I make dissapper text value on Condition in VegaLite Chart


I am trying to create a group bar chart with text value over the bar, Chart seems good when there is no zero value, but when there is zero value in data then bar not make but label (text) are visible 0 i want if value is zero then no bar and no text will appear in chart. I try with apply condition on text opacity /fontsize like - "opacity": {"expr": "datum['percentage']== 0 ? 0 :1"} it work but i want it dynamic not dependent on field. I try with "opacity":{"expr": "datum.value== 0 ? 0 :1"} with out depending on field ,but not getting required view. How i can disappaer text value without depending on field name Editor link


Solution

  • What you are asking for is not possible. You need to refer to the field name to make this work.