How can I change the tooltip/signal font size in a Vega Word Cloud Graphic?

Viewed 17

I had a Problem with a word cloud graphic in vega. It was showing the words properly, but I wanted it to show how many times a word was mentioned when hovering the mouse over it. I managed to do so, but the font is way too small, and I cant figure out how to change it whatsoever.

I've looked at the documentation and couldn't find anything related to font size inside tooltip or signal. For generating the cloud I have the following code:

{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "data": [
    {
     "name": "default",
      "transform": [
        {
          "type": "formula", "as": "rotate",
          "expr": "[0, 90][~~(datum.index % 2)]"
        },
  {
          "type": "formula", "as": "weight",
          "expr": "if(datum.index==0, 600, 400)"
        },
        {
          "type": "wordcloud",
          "size": [{"signal": "width"}, {"signal": "height"}],
          "text": {"field": "$dimension0"},
          "fontSize": {"field": "$metric0"},
          "fontWeight": {"field": "weight"},
          "fontSizeRange": [{"signal": "(width+height)/96"}, {"signal": "(width+height)/24"}],
          "padding": {"value": 2},
          "rotate": {"field": "rotate"}
        }
      ]
    }
  ],
  "scales": [
    {
      "name": "color",
      "type": "ordinal",
      "domain": {"data": "default", "field": "$dimension0"},
      "scheme": "datastudio20"
    }
  ],

  "marks": [
    {
      "type": "text",
      "from": {"data": "default"},
      "encode": {
        "enter": {
          "text": {"field": "$dimension0"},
          "align": {"value": "center"},
          "baseline": {"value": "alphabetic"},
          "fill": {"scale": "color", "field": "$dimension0"}
        },
        "update": {
          "x": {"field": "x"},
          "y": {"field": "y"},
          "angle": {"field": "angle"},
          "fontSize": {"field": "fontSize"},
         "fontWeight": {"field": "weight"},
          "fillOpacity": {"value": 0.7}
        },
        "hover": {
          "fillOpacity": {"value": 1},
          "fontWeight": {"value": "bold"},
          "fontSize": { "value": 40},
          "tooltip": {
          "signal": "datum.$metric0",
          "fontweigth": { "value": "bold"}
          }
        }
      }
    }
  ]
}

The problem is, I couldnt generate a tooltip showing the number of occurences of each word. I've managed to show said number, but it is way too small to see, any way I can Increase the tootlip font size?

Here is the word-cloud

1 Answers
Related