Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[FEATURE]: Allow fitbounds to use only a subset of traces

Offen
#8,076 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
javascript

Rechercherichtung

Start by tracing how scattergeo handles layout.geo.fitbounds and gathers locations, then read the linked discussion in issue #8046. Define how a trace-selection option should work while keeping unselected routes visible, and verify the selected-route extent, including antimeridian-crossing routes, without changing the broader view.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement feature P3 size: 3

Summary

I would like to request a way to control which traces participate in the fitbounds calculation.

The current behavior is correct in the sense that fitbounds considers all relevant traces in the graph. However, for interactive maps with multiple routes, it would be useful to fit the view to a selected trace (or subset of traces) while keeping the other traces visible.

Related issue

This feature request follows from the discussion in the closed issue:

plotly/plotly.js#8046

More specifically, this follows from camdecoster's comment on #8046.

Use case

I am building an interactive flight-route map using scattergeo.

The map contains many flight routes. When the user selects one route, I would like to:

  1. Keep all routes visible.
  2. Fit/zoom the map to the selected route only.
  3. Keep the other routes visible, but exclude them from the calculation used to determine the fitted view.

This is particularly important for routes crossing the antimeridian.

For example, a route from Vancouver (YVR) to Seoul (ICN) crosses the antimeridian. If this is the only trace in the graph, fitbounds: 'locations' correctly fits the route and rotates the map to the Pacific.

However, when all the other routes are present, fitbounds considers their locations as well, resulting in a much wider/global view.

Current workaround

I tried temporarily removing the other routes, fitting the map to the selected route, and then adding the other routes back.

The first two steps work correctly:

  1. Remove/disable the other routes.
  2. Fit the view to the selected route.

However, as soon as the other routes are added back, fitbounds recalculates using all traces and the view immediately returns to the wider extent.

I also tried making the other routes transparent, but opacity does not exclude their locations from the fitbounds calculation.

I therefore currently have to choose between fitting the map correctly to the selected route and keeping all routes in the graph.

Proposed feature

It would be useful to have a way to specify which traces should participate in the fitbounds calculation.

For example, conceptually something like:

layout: {
    geo: {
        fitbounds: 'locations',
        fitbounds_traces: [3, 7]
    }
}
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
21

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus plotly/plotly.js

Alle Issues in plotly/plotly.js

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.