Skip to content

Line chart: Numeric X-axis missing last tick, points misaligned #5015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lovasoa opened this issue Apr 21, 2025 · 2 comments · May be fixed by #5045
Open

Line chart: Numeric X-axis missing last tick, points misaligned #5015

lovasoa opened this issue Apr 21, 2025 · 2 comments · May be fixed by #5045
Labels
bug Something isn't working

Comments

@lovasoa
Copy link

lovasoa commented Apr 21, 2025

Description

The x-axis in line charts doesn't display all tick values correctly, especially when using numeric values as x values across multiple series. The last x value (5) is missing from the axis, and data points are misaligned with their corresponding tick marks.

I had previously reported a similar issue regarding x-axis tick misalignment in bar charts: #4858

Steps to Reproduce

  1. Create a line chart with multiple series
  2. Use numeric values as x values (1, 2, 4, 5)
  3. Observe the x-axis rendering and data point alignment

Expected Behavior

The x-axis should display all unique x values (1, 2, 4, 5) as tick marks, and data points should align with their corresponding tick marks.

Actual Behavior

The x-axis only shows 1, 2, 3, 4 as ticks, omitting 5. Additionally:

  • The data point for 2 appears before the 2 tick mark
  • The data point for 5 is incorrectly positioned above the 4 tick mark

Screenshots

Screencast.From.2025-04-21.19-20-16.mp4

Reproduction Link

https://codepen.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-/pen/pvvygbg?editors=0010

var options = {
  "chart": {
    "type": "line"
  },
  "series": [
    {
      "name": "A",
      "data": [
        {
          "x": 1,
          "y": 1
        },
        {
          "x": 2,
          "y": 2
        }
      ],
    },
    {
      "name": "B",
      "data": [
        {
          "x": 4,
          "y": 4
        },
        {
          "x": 5,
          "y": 5
        }
      ],
    }
  ]
};

var chart = new ApexCharts(document.querySelector("#chart"), options);

chart.render();

Initially reported in sqlpage/SQLPage#883

@lovasoa
Copy link
Author

lovasoa commented May 19, 2025

I just tested on the latest version and the bug is still there.

@junedchhipa , do you think I can help resolve this ? Do you have pointers to where the problem may be in the code ?

@lovasoa
Copy link
Author

lovasoa commented May 24, 2025

up ! I'm willing to help ! Where do you think I should look first ?

lovasoa added a commit to lovasoa/apexcharts.js that referenced this issue May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant