Apexcharts.js: tickAmount doesn't work for x axis type: 'category'

Created on 26 Sep 2019  路  10Comments  路  Source: apexcharts/apexcharts.js

Codepen

https://codepen.io/ThirdSign/pen/pozBRrw

Explanation

  • What is the behavior you expect?
    The tickAmount option should set the number of ticks

  • What is happening instead?
    It's not setting the number of ticks

  • What error message are you getting?
    There's no error message

feature-request xaxis

Most helpful comment

Please add to the documentation that tick amount does not work if you are using xaxis categories.

All 10 comments

As you have numerical values in the x-axis, you should change the xaxis.type: numeric
Once you do that, tickAmount will work.

Thanks for the quick response.

Updating the values to strings, the problem persists. I've updated the code pen.

@junedchhipa, the problem still persists. Could you look again?

Please add to the documentation that tick amount does not work if you are using xaxis categories.

I'm encountering the same problem. However, I have irregular time data for the x-axis, meaning if I set it to numeric, the distance between data points becomes irregular (in some places it's grouped together and in others data points are very far apart). How do I make all the data points equal distance apart If I'm using numeric? Thanks!

Added support for tickAmount in category x-axis.
A new version 3.20.1 will be released soon with this enhancement.

Added support for tickAmount in category x-axis.
A new version 3.20.1 will be released soon with this enhancement.

Are there any updates on this?

Hi, this is still not working.

chart: {
     type: 'line',
},
xaxis: {
      type: 'category',
      categories: [
        'Apr 30, 2020',
        'May 31, 2020',
        'Jun 30, 2020',
        'Jul 31, 2020',
        'Aug 31, 2020',
        'Sep 30, 2020',
      ],
      tickAmount: 2,
      title: {
        text: 'Days',
      },
},
series: {
    data: [1, 2, 3, 4, 5, 6]
}

This shows me Apr 30, 2020 , Jun 30, 2020 and Aug 31, 2020 . This should should only 2 ticks not 3.

Hi, this is still not working.

chart: {
     type: 'line',
},
xaxis: {
      type: 'category',
      categories: [
        'Apr 30, 2020',
        'May 31, 2020',
        'Jun 30, 2020',
        'Jul 31, 2020',
        'Aug 31, 2020',
        'Sep 30, 2020',
      ],
      tickAmount: 2,
      title: {
        text: 'Days',
      },
},
series: {
    data: [1, 2, 3, 4, 5, 6]
}

This shows me Apr 30, 2020 , Jun 30, 2020 and Aug 31, 2020 . This should should only 2 ticks not 3.

Same here.
Have you sorted it somehow?

Any updates on this?

I also noticed an issue here where tickAmount does not work on bar charts(horizontal: true) when using a category array. It does however work on column charts, although not to the exact amount as others have already indicated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maasha picture maasha  路  3Comments

rcoundon picture rcoundon  路  3Comments

Sumon-miazi picture Sumon-miazi  路  3Comments

piyushSinghalDemo picture piyushSinghalDemo  路  3Comments

drew-dulgar picture drew-dulgar  路  3Comments