plotly / plotly/plotly.js

Duplicate Keys on X-Axis with Date Format and formatTick

Đang mở
#7,041 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P2
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy ví dụ CodePen được liên kết với Plotly.js 2.32.0 và so sánh các nhãn của date-axis khi có và không có hàm formatTick tùy chỉnh. Truy vết quá trình tạo tick và hành vi định dạng của date-axis chịu trách nhiệm cho các nhãn bị lặp. Hoàn thành khi các tập dữ liệu ngày tháng nhỏ hiển thị các nhãn x-axis duy nhất, dễ đọc mà không yêu cầu category axes hoặc tickvals và ticktext được chỉ định tường minh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.