question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xaxis tickAmount auto adjustment

See original GitHub issue

Hi there!

Is there any way to make the xaxis’ tickAmount adjust itself to the series data length (minus 1 for the ticks to be aligned with the labels) in case there is only one serie or two series with the same length present on the Spline Area Charts options object?

I did try leaving it on undefined but, it didn’t worked as the ticks remained on different coordinates in relation to the x-axis while making the xaxis.type = “categories” and sending the chart two series with the same length (without them having to necessarily be “datetime” objects).

I did find a workaround by calculating the xaxis.tickAmount as array.length - 1 and leaving the padding on 0 for the chart to begin and end it’s path on the elements xaxis limits but, I would like to know if there is a cleaner way to do this rather than calculating the ticks with a formula.

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
junedchhipacommented, Oct 14, 2018

Ok, got your point.

I have added an option in xaxis.tickAmount: 'dataPoints' which will set the tickAmount to the number of datapoints in the series.

You will have to config your xaxis like this

xaxis: {
  type: 'datetime',
  tickAmount: 'dataPoints',
  labels: {
    hideOverlappingLabels: false
  }
}

The additional hideOverlappingLabels: false will prevent hiding some labels if they overlap (as hideOverlappingLabels is true by default)

This will be released in v2.1.5 in core apexcharts library.

0reactions
andresumanzorcommented, Oct 14, 2018

Got it, thank you! @junedchhipa

Read more comments on GitHub >

github_iconTop Results From Across the Web

xAxis.tickAmount | highcharts API Reference
When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or...
Read more >
xaxis - ApexCharts.js
Note: tickAmount doesn't have any effect when xaxis.type = datetime ... Setting this options takes the y-axis out of the plotting area.
Read more >
Apexcharts - How to change the y-axis step size value and ...
You can change number of intervals with tickAmount ... #chart { max-width: 650px; margin: 35px auto; } <div id="chart"></div> <script ...
Read more >
X-axis options — ax_xaxis • apexcharter - GitHub Pages
tickAmount. Number of Tick Intervals to show. min. Lowest number to be set for the x-axis. The graph drawing beyond this number will...
Read more >
ApexCharts card - A highly customizable graph card
As individual graphs the Y axis auto scales nicely, starting at around 18 centrigrade and rising to around 23. As soon as I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found