New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min max 支持回调函数 #6465

Closed
liuliangsir opened this Issue Aug 18, 2017 · 9 comments

Comments

Projects
None yet
6 participants
@liuliangsir
Copy link

liuliangsir commented Aug 18, 2017

One-line summary [问题简述]

非category轴把min设置成dataMin boundaryGap失效
存在一些需求,需要在把min设置成dataMin的情况下,boundaryGap仍然有效

Version & Environment [版本及环境]

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

Expected behaviour [期望结果]

图片左边为期望的结果

qq 20170816171257
)

ECharts option [ECharts配置项]

option = {
     yAxis: {
         min: function (val) {},
         max: function (val) {}
    }
}

Other comments [其他信息]

@Ovilia

This comment has been minimized.

Copy link
Contributor

Ovilia commented Aug 21, 2017

@liuliangsir 可以具体说一下“需要在把min设置成dataMin的情况下,boundaryGap仍然有效”是指什么需求吗?

boundaryGap 在设置了 min、max 的情况下有效;或者 min、max 支持回调函数应该都能满足这个需求对吧?

@liuliangsir

This comment has been minimized.

Copy link
Author

liuliangsir commented Aug 21, 2017

@Ovilia 我们希望在进行缩放的时候,y轴的最大值以及最小值能够根据可见区域内容蜡烛图的最高点以及最低点进行动态变化,所以把y轴min max设置成dataMin dataMax就能满足需求,但是我们希望蜡烛图的最高点以及最低点能够跟y轴最大值以及最小值有一定的留白,所以boundaryGap满足我们的需求,但是这两个配置不能同时生效
我觉得为了向下兼容的话,还是让min、max 支持回调函数吧

@Ovilia

This comment has been minimized.

Copy link
Contributor

Ovilia commented Aug 21, 2017

你这个需求如果不设 min、max 只设 boundaryGap 会有什么问题?不设也会自动根据最大最小值加一定的留白吗?

@liuliangsir

This comment has been minimized.

Copy link
Author

liuliangsir commented Aug 21, 2017

如果不设置min max的话,我使用splitLine绘制的线条有可能不会出现,原因如下:
这是因为线条的起点纵坐标或者终点纵坐标可能超出y轴的原始数据的范围,线条可能画不出来
所以我们需要把线条的起点纵坐标以及终点纵坐标加入到计算y轴最大值以及最小值当中去

不过我使用了custom之后,解决线条画不出来的问题

我们希望的是,不但能够根据在可视区域内蜡烛图的最高点以及最低点来决定y轴的最大值、最小值

而且还需要蜡烛图的最高点以及最低点能够跟绘制有一定的留白

那么也就回到了min max 与 boundaryGap的矛盾体里面啦

蜡烛图交互

@Ovilia

This comment has been minimized.

Copy link
Contributor

Ovilia commented Aug 21, 2017

明白了,近期会支持的~

@Ovilia Ovilia closed this in c2839a4 Aug 22, 2017

Ovilia added a commit that referenced this issue Aug 22, 2017

@liuliangsir liuliangsir changed the title min max 支持回掉函数 min max 支持回调函数 Aug 23, 2017

@Aryalina

This comment has been minimized.

Copy link

Aryalina commented Nov 6, 2017

为什么使用了min回调函数,坐标轴的刻度就不显示了呢?

@Ovilia

This comment has been minimized.

Copy link
Contributor

Ovilia commented Nov 6, 2017

@Aryalina 你怎么写的回调函数?应该类似这样:

max: function (value) {
    return value.max + 2;
},

注意这里要用 value.max 而不是 value

@hepeifang

This comment has been minimized.

Copy link

hepeifang commented Oct 30, 2018

回调函数写的
min: function (value) {
return value.min - 10
}
刻度仍然不显示
前提:min: 'dataMin'使用正常,且仅修改'dataMin'为function(){}

@lyon007

This comment has been minimized.

Copy link

lyon007 commented Nov 26, 2018

@hepeifang 你解决了吗, 我也是这个问题,同样的代码,demo中可以,放在我项目中就是不行
version: 4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment