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.
{
showAllFields: false
}
{
showAllFields: null
}
This seemed a good way to get a quick, useful tooptip - showing only the variables included in the encoding.
{
showAllFields: true
}
{
showAllFields: false,
fields: [
{field: "Name"},
{field: "Origin"},
{field: "Miles_per_Gallon", title: "MPG"},
{field: "Horsepower"}
]
}
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.
https://cdn.jsdelivr.net/npm/vega@3.2.1
https://cdn.jsdelivr.net/npm/vega-lite@2.3.1
https://cdn.jsdelivr.net/npm/vega-embed@3.2.0
https://cdn.jsdelivr.net/npm/vega-tooltip@0.7.0
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js