vega icon indicating copy to clipboard operation
vega copied to clipboard

Label transform override text's opacity

Open chanwutk opened this issue 3 years ago • 0 comments

{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "width": 100,
  "height": 100,
  "data": [
    {
      "name": "table",
      "values": [12]
    }
  ],
  "marks": [
    {
      "type": "text",
      "from": {"data": "table"},
      "encode": {
        "enter": {
          "x": {"value": 30},
          "y": {"value": 30},
          "text": {"value": "label"},
          "opacity": {"value": 0.1}
        }
      },
      "transform": [
        {
          "type": "label",
          "size": {"signal": "[width, height]"}
        }
      ]
    }
  ]
}

Link to the spec: https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAB3GgBN6aAQAYZ8GmSwr1IBUkwpUAbVDikCOGhBGmAG2sziSewzgQ0JgIwAmALoAvv4yyABOANaepqCYAJ441uiYcAAemNIgAGZhbAhooAZGNnaOIIEycOJQbApJoFUpYQUgqS0ubkkAzKoVIHHtru5oPX0p6YOdNvZITHD25TJsOEhQdAOooB3DqKqU3oGHMphhSOIQWWxh+TG2CUkgM3MLMhA0AF71IG9kFgvoJnkShgUgABJptJh-OVgrCgA

What happened?:

  • Label-transform use opacity:0 for hidden label and opacity:1 for shown label. This also override the original opacity value of the text

Todo:

  • Same fix as #3336, we should remember the original opacity on the first time label-transform runs.

chanwutk avatar Nov 08 '21 20:11 chanwutk