Skip to content

Commit

Permalink
feat: tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
etowahadams committed May 6, 2024
1 parent 7e91c63 commit 8b349db
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion docs/user-interaction.md → docs/user-interaction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: User Interaction
---
import {TableWrapper} from '@site/react-components/DocComponments/table'
import GoslingSchema from './assets/gosling.schema.json'

## Zooming and Panning
<!-- [:link: source code](https://github.com/gosling-lang/gosling.js/blob/43626eaf21417bf36128a405dceeaa6ee00d0851/src/core/gosling.schema.ts#L7) -->
Expand Down Expand Up @@ -131,4 +133,38 @@ Users can use **brushing** to select a subset of the data items using a rectangl
... // other tracks
]
}
```
```

## Tooltip

A track can take a `"tooltip"` property to show a tooltip when the user hovers over the track. The tooltip can display the values of the data fields in the track. The tooltip property takes an array of objects, where each objects has the following properties:

<TableWrapper GoslingSchema={GoslingSchema} objName="Tooltip" />

Here is an example of a tooltip being used in a track definition:

<img src='/img/doc_images/tooltip.png' width='300' />

Corresponding specification:

```javascript
"tracks": [
{
...,
// highlight-start
"tooltip": [
{"field": "start", "type": "genomic", "alt": "Start Position"},
{"field": "end", "type": "genomic", "alt": "End Position"},
{
"field": "peak",
"type": "quantitative",
"alt": "Value",
"format": ".2"
},
{"field": "sample", "type": "nominal", "alt": "Sample"}
],
// highlight-end
}
]

```
Binary file added static/img/doc_images/tooltip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8b349db

Please sign in to comment.