TrackColorsMixin
Auto-generated @jbrowse/mobx-state-tree API for the current JBrowse release — see pluggable elements for concepts. Built into JBrowse core. View source.
The color-by state shared by every view that can draw more than one synteny track at once: the view-wide mode, the per-track overrides, and the palette that tells overlaid tracks apart.
A view supplies only colorableTrackConfigs — the dotplot walks its flat
tracks, a linear synteny view flattens levels. Everything downstream of
that list (palette assignment, mode resolution, legend rows) is identical, so
it lives here rather than being copied into both models.
Properties
| Member | Description |
|---|---|
colorBycolorBy: types.stripDefault(types.string, 'default') | The color-by mode the whole view renders with, unless a track overrides it in trackColorBy. |
trackColorBytrackColorBy: types.map(types.string) | trackId -> color-by mode for that track alone. Absent means the track follows the view-wide colorBy. |
trackColorstrackColors: types.map(types.string) | trackId -> explicit color under colorBy: 'track'. Absent means the track takes an automatic slot from the palette. |
showColorLegendshowColorLegend: types.stripDefault(types.boolean, false) | Show the floating color-by legend. Dismissible via the legend's close button; re-enable from the color-by (palette) menu. |
Volatiles
| Member | Description |
|---|---|
seenAttributeRangesseenAttributeRanges: {} as Record<string, AttributeRange> | The widest span each numeric channel has been seen to cover, over every fetch this view has taken — what keeps an attribute:<column> ramp from re-scaling under a pan. Widened by observeAttributeRanges, dropped by resetAttributeRanges, read through attributeRanges, which is where the reasoning is. |
Getters
| Member | Description |
|---|---|
colorableAttributesstring[] | Distinct numeric columns across the overlaid tracks, in first-seen order — two tracks declaring dn offer one dn mode, not two. |
attributeRangesRecord<string, AttributeRange> | The span each numeric channel covers: unioned over the loaded displays, and over every fetch this view has already taken (seenAttributeRanges). An attribute:<column> mode has no declared domain, so this is what its ramp scales to, what the legend labels it with, and — since it is the one domain — what the two cannot disagree about.MONOTONIC, which is the point. A fetch's payload reports the span of the slice it holds, and that slice is the snapped window: painting straight off it re-maps every feature onto the ramp each time a pan rolls the window over, so a ribbon in the middle of the ramp turns into one at the bottom while the reader is scrolling and its value has not changed. A domain that only ever widens still says what the reader is looking at — the legend prints the actual numbers — and settles instead of oscillating. Monotonic UNTIL A MODE IS PICKED, which is the way back: one window holding an outlier would otherwise compress the ramp for the rest of the session, and the union above is over the LOADED spans, so resetAttributeRanges rescales to what is on screen there and then.View-wide rather than per display because the floating legend is one box for the whole view: two displays scaling the same ramp from different spans would make that one legend lie about one of them. |
colorableTracksColorableTrack[] | colorableTrackConfigs paired with whatever color the user pinned. This is the single definition of "the tracks that get colors" — the palette, the legend and the palette menu all read it, so they cannot disagree about which tracks are in play. |
trackColorAssignmentsMap<string, string> | trackId -> the color it draws in under colorBy: 'track'. Assigned across the whole view rather than per display, so an automatic slot can't duplicate a color pinned on a sibling. |
uniformColorBySyntenyColorBy | undefined | The mode to report as "the view's mode" — undefined when tracks disagree, so the menu shows nothing checked and the legend says so instead of picking one track's answer for everyone. |
colorLegendChipsColorChip[] | Legend rows naming the overlaid tracks — non-empty only when they are colored by track, or by different modes. |
Methods
| Member | Description |
|---|---|
colorableTrackConfigs() => { trackId: string; name: string; }[] | The tracks that can take a palette slot, in paint order. Overridden by the composing view; a method rather than a getter because that is the form MST overrides cleanly. |
colorableAttributeNames() => string[] | Numeric columns the overlaid tracks declare (an ortholog table's attributeColumns), each of which the palette menu offers as its own mode. Overridden by the composing view, which is the only thing that can reach the track configs.From the CONFIG rather than from loaded data: the menu has to be right before the first fetch, and a track that declares a column carrying no values paints the default color anyway. |
loadedAttributeRanges() => Record<string, AttributeRange>[] | One entry per loaded display: the span each numeric channel actually covered in the data that display fetched. Overridden by the composing view, which is the only thing that can reach the displays. From loaded DATA rather than from the config, unlike colorableAttributeNames — a column's observed span is not declared anywhere, so nothing before the first fetch can answer it. |
resolveColorBy(trackId: string) => SyntenyColorBy | The mode one track renders with: its own override, else the view-wide mode. |
trackColorFor(trackId: string) => string |
Actions
| Member | Description |
|---|---|
observeAttributeRanges(ranges: Record<string, AttributeRange>) => void | Fold one fetch's observed attribute spans into the domain this view paints and labels its ramps with. Called by each display as its fetch lands, because the accumulation has to outlive the payload it came from: the previous window's span is gone from loadedAttributeRanges the moment the next one commits. |
resetAttributeRanges() => void | Forget the accumulated domain, leaving attributeRanges reporting what the LOADED fetches cover and nothing else.The way back from a monotonic domain, and the only one: a single window holding an outlier widens the ramp for the rest of the session, and attributeRanges unions the loaded spans over this, so a reset rescales to what is on screen without waiting for a refetch. Picking a mode is what calls it — the gesture a reader makes when the ramp is telling them nothing is to choose it again. |
setColorBy(value: SyntenyColorBy) => void | Set the view-wide mode. Clears every per-track override, so picking a mode from the top level of the palette menu really does mean "all tracks" — and rescales the ramp, which is the only way back from a domain one outlying window widened. |
setTrackColorBy(trackId: string, value: SyntenyColorBy | undefined) => void | Point one track at its own mode, or back at the view-wide one. |
setTrackColor(trackId: string, value: string | undefined) => void | Pin one track's color under colorBy: 'track', or release it back to an automatic palette slot. |
clearTrackColorSettings() => void | |
setShowColorLegend(value: boolean) => void |
Related links
- Guide: URL query parameter API