0

I'm using visx/d3 to build a line chart.

Depending on the data, the first x axis tick/label might be very close to the Y axis line. Our design team wants a little "overlap" in the x/y axis lines, but in cases where the first x tick label is too far left, it looks bad.

I effectively need a way to ensure the first x tick value is always a sufficient distance from the first data point so that the first x axis tick position is always a good distance from the left - or other suggestions if you can think of anything.

Changing how tick values are calculated or the number of them doesn't help because the chance of a tick value being close to a data value remains.

Here is a chart with data that causes this issue:

enter image description here

Here is a chart with data that does not:

enter image description here

It's a problem because we don't want labels too close to the Y axis, partly because it looks bad but also because we have x/y axis line "overlaps" for design purposes, and the bottom of the y axis line overlaps the x label if it's too far left.

helion3
  • 34,737
  • 15
  • 57
  • 100

0 Answers0