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 labels render on each other

See original GitHub issue

When the graph is small and there are many ticks, some labels are rendered over each other

I see tickTotal is hard coded according to the width of the graph. I can set the tickTotal manually, but ideally I want it to be set automatically with any given data. Is there a recommended way to handle that case?

https://codesandbox.io/s/0owow0zpkp

(first graph has xType=“time”)

screen shot 2017-11-30 at 1 04 18 pm

UPDATE:

Just found out I can use tickLabelAngle and increase bottom margin. Is this the best approach?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mcnuttandrewcommented, Jul 23, 2018

I think there might another margin you don’t know about! Adding margin in style can be helpful, although it just adds margin around the inner svg. If you want to add internal margin, ie within the svg, you need to use the margin prop on the plot itself. (See https://uber.github.io/react-vis/documentation/api-reference/xy-plot for more). So your component might become something like

 <FlexibleWidthXYPlot
        height={size}
        xType={'ordinal'}
        yDomain={[0, data.outstanding]}
        margin={{bottom: 50}}
      >
    ....
   </FlexibleWidthXYPlot>
2reactions
mcnuttandrewcommented, Dec 13, 2017

Just found out I can use tickLabelAngle and increase bottom margin. Is this the best approach?

that is 100% what i would recommend. did that end up working out for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

xAxis.labels.allowOverlap | highcharts API Reference
How to handle overflowing labels on horizontal axis. If set to "allow" , it will not be aligned at all. By default it...
Read more >
How to render custom label colors for different xAxis labels?
Inside the XAxisRenderer.swift (not the XAxisRendererHorizontalBarChart like the other answer suggested) add this list with your colors ...
Read more >
Axes Labels Formatting | Axes and Grids
With AnyChart, you've got a full control over the axes labels: you can format them, tune visual appearance and position. All major settings...
Read more >
xAxis.labels - API Reference - Kendo UI Chart - Documentation
If set to true the chart will mirror the axis labels and ticks. If the labels are normally on the left side of...
Read more >
Asymptote FAQ - Section 6 Questions about 2D graphs
How can I draw x axis ticks on the right side, with the tick labels on the left ... How can I prevent...
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