Skip to content

x axis ticks are misaligned in bar charts that have more than 10 ticks #5086

@lovasoa

Description

@lovasoa

Description

Steps to Reproduce

  1. Create a bar chart with more than 10 bars. For instance, a bar chart with 11 bars :
new ApexCharts(chart_div, {
  chart: { type: "bar" },
  series: [{
      data: [1,2,3,4,5,6,7,8,9,10,11].map(x => ({x, y:x}))
  }]
}).render();
  1. Observe the placement of x axis ticks

Expected Behavior

Each tick should fall below a bar. The x axis values should be regular.

Actual Behavior

The x axis ticks are: 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 (6 is missing)

Image

Ticks 0 and 11 line up perfectly under their bars. Everything in between is “pulled” toward the chart’s center around the missing 6.

  • Ticks 1–5 each sit slightly to the right of their bar centers.
  • There is no tick 6 at all.
  • Ticks 7–10 each sit slightly to the left of their bar centers.
  • The maximum offset occurs right around where the 6 should be; the further you move toward that gap, the larger the shift.
Image

Screenshots

Image

Reproduction Link

https://codepen.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-/pen/yyBJvMq

This is a followup on #4858

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions