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.nameGap and yAxis.nameGap should be set automatically given grid.containLabel

See original GitHub issue

xAxis.nameGap and yAxis.nameGap should be set automatically given grid.containLabel; this would provide the user with an easy way to display his/her axis name in a way that it doesn’t visually interfere with the axis labels

One-line summary [问题简述]

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

When containLabel is selected, and a name for the xAxis or the yAxis has been specified, these should always fit on the graph’s rendering, taking into account the ‘rotate’ property of the axis labels.

ECharts option [ECharts配置项]

if:

option = {
    grid.containLabel = true
    xAxis.axisLabel.rotate: someValue
    yAxis.axisLabel.rotate: someValue
}

then:

option = {
    grid.containLabel : true
    xAxis.axisLabel.rotate: someValue
    yAxis.axisLabel.rotate: someValue
    xAxis.nameGap : auto //should be set automatically
    yAxis.nameGap :  auto //should be set automatically
}

Other comments [其他信息]

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

22reactions
jbadillacommented, Oct 26, 2018

Here is how echarts behaves by default:

screen shot 2018-10-26 at 11 25 19 am

Here’s how it should behave:

screen shot 2018-10-26 at 11 27 43 am

This has to be done by setting the xAxis.nameGap property to something reasonable

10reactions
100pahcommented, Oct 29, 2018

Currenly containLabel only considered axis labels, but not consider axis name.

@jbadilla

This axis lable is visually unpleasant because the default nameGap is 0.

Another issue #9286 gave a related situation that the axis name might overflow the rendering area.

To make the layout wisely, I think two enhancements can be taken into accout (and the two enhancement might be independent with each other in implementation):

(A) Enhanse the layout calculation of axis name: adjust it based on axis label and viewport.

Keep the current behaviors of nameLocation and nameGap, and add a new option nameLocationAdjust (or some likely name), which enable axis name to be auto adjusted to avoid interfering with axis labels and overflow the viewport, following the strategy below:

Procedure X: Layout axis name by the given nameLoation and nameGap, and then adjust it to avoid interfering with axis labels. Finally the relative location of axis name with axis line get. Detailedly, in this case, nameGap is not the gap with axis line any more, but actually is the gap with the bounding rect of both axis line and axis labels.

Procedure X will be executed twices if containLabel is set, the same as current implementation: 1. The first execution is before the “coordinate system update stage”, based on the estinamed axis label layout. 2. The second execution is on the “cartesian rendering stage”, based on the accrate axis label layout.

Procedure Y: Ajust the axis name to avoid overflowing the viewport (if it makes the axis name interfere with axis labels again, leave them there). Notice the overflow also need to be taken into account when nameLocation is start or end, like #9286 issued, which enables that when two cartesian exists axes align with each other without dynamic axis names overflow.

Procedure Y is only be executed in the “cartesian rendering stage”, after Procedure X executed.

(B) Enhanse the cartesian rect determine calculation when containLabel

Currently containLabel has considdered axis label (and rotation). We should make it take into account the located axis name also, whatever the (A) is implemented or not.

But the logic looks not neat, a little complecated 😦

What do you think @pissang

Read more comments on GitHub >

github_iconTop Results From Across the Web

xAxis.nameGap and yAxis.nameGap should be set ...
xAxis.nameGap and yAxis.nameGap should be set automatically given grid.containLabel; this would provide the user with an easy way to display ...
Read more >
[GitHub] jbadilla commented on issue #9265: xAxis.nameGap ...
jbadilla commented on issue #9265: xAxis.nameGap and yAxis.nameGap should be set automatically given grid.containLabel URL: ...
Read more >
[GitHub] [incubator-echarts] jbadilla edited a comment on issue # ...
[GitHub] [incubator-echarts] jbadilla edited a comment on issue #9265: xAxis.nameGap and yAxis.nameGap should be set automatically given grid.containLabel.
Read more >
org.apache.echarts.dev - 2018 October - 979 messages
[GitHub] Ovilia commented on issue #9265: xAxis.nameGap and yAxis.nameGap should be set automatically given grid.containLabel - GitBox.
Read more >
How can I always keep all YAXIS visible no matter if series ...
Data is main block for render visual layer. When you change data — visual layer will changed. Hide series by set transparency color...
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