Forum Discussion

Doug7983's avatar
Doug7983
Helper II
2 years ago
Solved

Deneb | Vega-Lite tooltip issue

With much help from giammariam , I have a Deneb custom visual that is exactly what I want--except for the tooltip. Deneb is displaying the tooltip for the highlighted null data point as 0.0%. I would...
  • giammariam's avatar
    giammariam
    2 years ago

    Thanks Doug7983, try the following:

     

    1. In the top transform array add the following: 

     

        ,
        {
          "calculate": "isValid(datum['Growth (MoYaM)']) ? format(datum['Growth (MoYaM)'], '.1%') : ''",
          "as": "Growth (MoYaM) Tooltip"
        },
        {
          "calculate": "isValid(datum['Growth (WDC)']) ? format(datum['Growth (WDC)'], '.1%') : ''",
          "as": "Growth (WDC) Tooltip"
        }

     

    Note - if you want it to show null or n/a, replace the '' with null or 'n/a'. As it is currently, it will just be blank

     

    2. Update the tooltip to the following:

     

          "tooltip": [
            {"field": "Category", "type": "nominal"},
            {"field": "Date", "type": "temporal"},
            {"field": "Growth (MoYaM) Tooltip", "title": "Growth (MoYaM)", "type": "nominal"},
            {"field": "Growth (WDC) Tooltip", "title": "Growth (WDC)", "type": "nominal"}
          ],

     

     

     

    Let me know if this works