Skip to content

Filtering out zero/null values in tooltip and sort the tooltip by field values  #9152

@sfc-gh-cheliu

Description

@sfc-gh-cheliu

I'd like to add a feature to hide/filter out zero/null values in the tooltip, and potentially sort the tooltip by the value of each field/column. Here's an example:
example
Basically I want to hide type3 and type5 in the tooltip, and sort the remaining by descending order of Value.

Since I'm not familiar with altair/vega libraries, so this might not be the best approach, but my thought is to add a new parameter/condition in altair and passing this to the tooltip object, so that when the frontend receives this signal, it will hide the values I don't want to see in the tooltip and possibly sort the values.

I found 2 places that can be modified:

  1. https://github.com/vega/vega-lite/blob/4ba3b93e575df97ffe56713287b40d6c55b18340/src/compile/mark/encode/tooltip.ts
  2. https://github.com/vega/vega-tooltip/blob/5f805fb8a6e76e3e58d2541e51b6106bcc133f11/src/Handler.ts

Any guidance and suggestions are welcome. Thanks! cc @joelostblom @jakevdp as well as core vega-lite developers @kanitw @domoritz @arvind @jheer

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions