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

折线图,series的data数组为单个点时(或者多个点,但是值相同),y轴boundaryGap无效 #4417

Closed
Gyanxie opened this Issue Nov 7, 2016 · 12 comments

Comments

Projects
None yet
3 participants
@Gyanxie

Gyanxie commented Nov 7, 2016

问题简述 (One-line summary)

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):echart 3
  • 浏览器类型和版本 (Browser version): chrome 53.0.2785.143
  • 操作系统类型和版本 (OS Version): window 7

重现步骤 (Steps to reproduce)

1.上述option运行的结果为异常情况,
2.将option的series data 替换为[1,2]后,运行的结果为正常情况
3.对比两次结果中,y轴的最大长度

期望结果 (Expected behaviour)

y轴设置boundaryGap 后,正常延长到设定的百分比

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {
    title: {
        text: '测试'
    },
    xAxis: {
        type: 'category',
         data: [1,2,3,4]
    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, '100%']
    },
    series: [{
        name: '模拟数据',
        type: 'line',
        data: [1],
        markPoint:{
            symbol: "pin",
            symbolOffset: [0, -8],
            symbolSize: "30",
            data: [{
                type:'max',
                name: 'item'
            }]
            }
    }]
}

其他信息 (Other comments)

上图给的代码是发生问题的代码,结果如下:
image

仅仅修改series的data为:[1,2]后(原来是[1]),显示正常:

image

@Ovilia Ovilia self-assigned this Mar 17, 2017

@nthuida

This comment has been minimized.

Show comment
Hide comment
@nthuida

nthuida Apr 6, 2017

我也遇到相同的问题,请问下解决了没有?

nthuida commented Apr 6, 2017

我也遇到相同的问题,请问下解决了没有?

@Gyanxie

This comment has been minimized.

Show comment
Hide comment

Gyanxie commented Apr 6, 2017

@nthuida 没有解决

@Ovilia

This comment has been minimized.

Show comment
Hide comment
@Ovilia

Ovilia Apr 6, 2017

Contributor

boundaryGap 的百分比,是相对于数据最大值和最小值只差进行缩放的,那么如果只有一个数据的时候,你们期望怎么缩放呢?

Contributor

Ovilia commented Apr 6, 2017

boundaryGap 的百分比,是相对于数据最大值和最小值只差进行缩放的,那么如果只有一个数据的时候,你们期望怎么缩放呢?

@nthuida

This comment has been minimized.

Show comment
Hide comment
@nthuida

nthuida Apr 6, 2017

我的理解是,只有一个数据时,相当于最大值和最小值相等,缩放就按照那个值,应该没影响吧 @Ovilia

nthuida commented Apr 6, 2017

我的理解是,只有一个数据时,相当于最大值和最小值相等,缩放就按照那个值,应该没影响吧 @Ovilia

@Gyanxie

This comment has been minimized.

Show comment
Hide comment
@Gyanxie

Gyanxie Apr 6, 2017

@Ovilia
一开始我以为计算方法是这样的:
Y轴正向延长值: 最大正值*boundaryGap
Y轴负向延长值:|最小负值|*boundaryGap

Gyanxie commented Apr 6, 2017

@Ovilia
一开始我以为计算方法是这样的:
Y轴正向延长值: 最大正值*boundaryGap
Y轴负向延长值:|最小负值|*boundaryGap

@Ovilia

This comment has been minimized.

Show comment
Hide comment
@Ovilia

Ovilia Apr 7, 2017

Contributor

我觉得 @Gyanxie 的表述是合理的, @nthuida 你是同样的意思吧?

Contributor

Ovilia commented Apr 7, 2017

我觉得 @Gyanxie 的表述是合理的, @nthuida 你是同样的意思吧?

@nthuida

This comment has been minimized.

Show comment
Hide comment
@nthuida

nthuida Apr 7, 2017

OK 但是当值都相同时,boundaryGap没有生效 @Ovilia

nthuida commented Apr 7, 2017

OK 但是当值都相同时,boundaryGap没有生效 @Ovilia

@Ovilia

This comment has been minimized.

Show comment
Hide comment
@Ovilia

Ovilia Apr 7, 2017

Contributor

@nthuida 这是同一个问题,缩放会根据 最大值 减去 最小值 进行缩放,所以只有一个值和当值一样的时候,处理是相同的。

Contributor

Ovilia commented Apr 7, 2017

@nthuida 这是同一个问题,缩放会根据 最大值 减去 最小值 进行缩放,所以只有一个值和当值一样的时候,处理是相同的。

@nthuida

This comment has been minimized.

Show comment
Hide comment
@nthuida

nthuida Apr 7, 2017

哦,那我理解错了,那有没有其他的配置,当值相同时,使Y轴可以延长

nthuida commented Apr 7, 2017

哦,那我理解错了,那有没有其他的配置,当值相同时,使Y轴可以延长

@Ovilia

This comment has been minimized.

Show comment
Hide comment
@Ovilia

Ovilia Apr 7, 2017

Contributor

@nthuida @Gyanxie 如果逻辑是这样的,能不能满足你们的需求:

  • 如果数据是 [0, 10],boundaryGap 是 '20%',则坐标轴范围是 [0, 12];
  • 如果数据是 [0, 10],boundaryGap 是 [0, '20%'],则坐标轴范围是 [0, 12];
  • 如果数据是 [10] 或 [10, 10, 10],boundaryGap 是 '20%',则坐标轴范围是 [0, 12];
  • 如果数据是 [10] 或 [10, 10, 10],boundaryGap 是 [0, '20%'],则坐标轴范围是 [0, 12];
  • 如果数据是 [0, -10],boundaryGap 是 '20%',则坐标轴范围是 [-12, 0];
  • 如果数据是 [0, -10],boundaryGap 是 ['20%', 0],则坐标轴范围是 [-12, 0];
  • 如果数据是 [-10] 或 [-10, -10, -10],boundaryGap 是 '20%',则坐标轴范围是 [-12, 0];
  • 如果数据是 [-10] 或 [-10, -10, -10],boundaryGap 是 ['20%', 0],则坐标轴范围是 [-12, 0]。
Contributor

Ovilia commented Apr 7, 2017

@nthuida @Gyanxie 如果逻辑是这样的,能不能满足你们的需求:

  • 如果数据是 [0, 10],boundaryGap 是 '20%',则坐标轴范围是 [0, 12];
  • 如果数据是 [0, 10],boundaryGap 是 [0, '20%'],则坐标轴范围是 [0, 12];
  • 如果数据是 [10] 或 [10, 10, 10],boundaryGap 是 '20%',则坐标轴范围是 [0, 12];
  • 如果数据是 [10] 或 [10, 10, 10],boundaryGap 是 [0, '20%'],则坐标轴范围是 [0, 12];
  • 如果数据是 [0, -10],boundaryGap 是 '20%',则坐标轴范围是 [-12, 0];
  • 如果数据是 [0, -10],boundaryGap 是 ['20%', 0],则坐标轴范围是 [-12, 0];
  • 如果数据是 [-10] 或 [-10, -10, -10],boundaryGap 是 '20%',则坐标轴范围是 [-12, 0];
  • 如果数据是 [-10] 或 [-10, -10, -10],boundaryGap 是 ['20%', 0],则坐标轴范围是 [-12, 0]。
@Gyanxie

This comment has been minimized.

Show comment
Hide comment

Gyanxie commented Apr 7, 2017

@Ovilia 可以

@nthuida

This comment has been minimized.

Show comment
Hide comment

nthuida commented Apr 7, 2017

可以 @Gyanxie @Ovilia

@Ovilia Ovilia closed this in a03481d Apr 7, 2017

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