All examples By author By category About

ijlyttle

vega-tooltip, in its "old" incarnation

The vega-tooltip JS library is now part of vega-embed; I write these words ignorant of the "new" way of doing things. I am writing this do document the behavior of the "old" way of doing things, so that I could refer to it if I need to.

Using the "old" way, there seems to be four operating modes for tooltips, as shown in these tooltip specifications.

None

{
  showAllFields: false
}

Encoding

{
  showAllFields: null
}

This seemed a good way to get a quick, useful tooptip - showing only the variables included in the encoding.

All

{
  showAllFields: true
}

Custom

{
  showAllFields: false,
  fields: [
    {field: "Name"},
    {field: "Origin"},
    {field: "Miles_per_Gallon", title: "MPG"},
    {field: "Horsepower"}
  ]
}

Wishlist for tooltips

This may already be in place, but I think it would be useful to be able to specify that the tooltip respect the order of the fields array. If we can specify that a field can be a value or the name of a variable (I think I read something about that), then we could image a fileld have a value of <hr>, giving us a way to introduce some formatting.