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.

Axis name padding does not account for axis labels

See original GitHub issue

What problem does this feature solve?

Axis name padding is currently relative to the axis itself without accounting for other elements like axis labels, etc. Padding in the DOM is aware of all other elements and so ensures sufficient white space. This feature would consider all such elements and set the grid padding accordingly to automatically allow enough space for all elements that need to appear between the grid and the edge of the container – ensuring a predictable amount of whitespace around each element.

What does the proposed API look like?

It would remain the same as the current padding option, but would not be relative to the axis, it would instead be relative to the closest neighboring element.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
100pahcommented, Mar 27, 2019

It would remain the same as the current padding option

Do you mean the axisLabel.margin or nameGap or axisLabel.padding here ? Because I think there is no option named padding for axis name currently.

For the options above:

axisLabel.margin is not a good name (by historical reason) and might bring misleading to users. It actually means the gap between the axis label and the axis line.

axisLabel.padding indeed only consider itself only without the neighboring elements. It is implemented the same as other labels follow the “rich text” module.

ECharts does not have an overall layout system as DOM did in Normal Flow, Floats, etc., which layout DOM elements by the margin/padding automatically without overlap. The layout strategies in echarts are case by case, meeting each chart/component requirements. That makes the code easy to implement but probably less customizable and intelligent.

Go back to this issue. I think what we can do is:

  • Enhance the axis label and tick layout strategy to avoid overlap and more customizable and meet some certain requirements (especially in time axis)
  • Since the option grid.containLabel already makes the grid auto located considering the axis label without overflow the edge of the echarts area, we probably also need to take axis name into account in this layout (current not consider axis name yet).
  • For long axis name, indeed it needs a more intelligent auto adjustment when it will overflow the container.
1reaction
adrielsantiagocommented, Apr 17, 2019

grid.containLabel is great for dynamic axis labels, but as you already noted does not consider the axis name:

Since the option grid.containLabel already makes the grid auto located considering the axis label without overflow the edge of the echarts area, we probably also need to take axis name into account in this layout (current not consider axis name yet).

I think implementing this would indeed solve the issue I was noticing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axis name padding does not account for axis labels #10172
Axis name padding is currently relative to the axis itself without accounting for other elements like axis labels, etc. Padding in the DOM...
Read more >
Matplotlib - Move X-Axis label downwards, but not X-Axis Ticks
Is there any way to move only the x-axis label to underneath the three rows of figures? Nb: You may need to open...
Read more >
Axis title padding | CanvasJS Charts
I have a column chart with two Y axes. However, the space between the axis labels and the axis title is very small,...
Read more >
Axis in WPF Charts (SfChart) - Syncfusion
Learn here all about Axis support in Syncfusion WPF Charts (SfChart) ... VisibleLabels – Represents the axis label collection which are visible in...
Read more >
Axis | Vega-Lite
If set to "greedy" , a linear scan of the labels is performed, removing any labels that overlaps with the last visible label...
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