plotly / plotly/plotly.js

Duplicate Keys on X-Axis with Date Format and formatTick

Offen
#7,041 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P2
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

When plotting a chart using Plotly with a small dataset and specifying the x-axis type as date, along with a custom formatTick function, the x-axis displays duplicate keys. This issue creates a confusing and cluttered appearance, as shown in the example provided below.

Steps to Reproduce:

Create a chart with the x-axis type set to date.
Use a small dataset with date values.
Specify a custom formatTick function for the x-axis.
Example:

You can see the issue in the following CodePen example:
CodePen Example

Expected Behavior:

The x-axis should display unique date values without any duplicates, even for small datasets, ensuring a clean and accurate representation of the data.

Actual Behavior:

The x-axis shows duplicate date values, leading to a misleading visualization.

Environment:

Plotly.js version: plotly.js-dist-min@2.32.0
Browser: chrome
Operating System: windows

This issue significantly impacts the readability of charts, especially when dealing with smaller datasets where clear and distinct x-axis labels are crucial.

Additional information:
by specifying type as category or explicitly specilfying tickvals and ticktext doesn't suit well for large dataset.
Screenshot

Screenshot 2024-07-02 210025

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das verlinkte CodePen-Beispiel mit Plotly.js 2.32.0 auszuführen, und vergleiche die Beschriftungen der date-axis mit und ohne die benutzerdefinierte formatTick-Funktion. Verfolge die Tick-Generierung und das Formatierungsverhalten der date-axis, die für die wiederholten Beschriftungen verantwortlich sind. Als erledigt gilt die Aufgabe, wenn kleine Datensätze mit Datumsangaben eindeutige, gut lesbare Beschriftungen der x-axis rendern, ohne category axes oder explizite tickvals und ticktext zu benötigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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