echarts icon indicating copy to clipboard operation
echarts copied to clipboard

boundaryGap: [percent, percent] 没有达到预期的效果

Open andrewjavao opened this issue 9 years ago • 3 comments

One-line summary [问题简述]

I'm trying to use boundaryGap:['10%', '10%'] to avoid large empty space below or above the line in line charts(such like series [101, 100, 103, 99]), it works well for the max value of the axis, but for the min value, it just won't be bigger than '0', which left a lot empty spaces below the line. For example, series 101, 100, 103, 110, with a boundaryGap set to ['10%', '10%'], the range of axis i was expceting is 99 to 111, but as a result, echarts give me 0 to 111.

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: v3, v2 i tried it on http://echarts.baidu.com/demo.html, and in my own project, all the same
  • Browser version [浏览器类型和版本]: Chrome
  • OS Version [操作系统类型和版本]: Mac

Expected behaviour [期望结果]

with a boundaryGap set to ['10%', '100%'], and data [100, 101, 103, 110], the range of y-axis should be [99, 120], NOT [0, 120]

ECharts option [ECharts配置项]


option = {
    tooltip: {
        trigger: 'axis',
        position: function (pt) {
            return [pt[0], '10%'];
        }
    },
    title: {
        left: 'center',
        text: '大数据量面积图',
    },
    toolbox: {
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            restore: {},
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [1, 2, 3, 4]
    },
    yAxis: {
        type: 'value',
        boundaryGap: ['10%', '100%']
    },
    series: [
        {
            name:'模拟数据',
            type:'line',
            smooth:true,
            symbol: 'none',
            sampling: 'average',
            itemStyle: {
                normal: {
                    color: 'rgb(255, 70, 131)'
                }
            },
            data: [100, 101, 103, 110]
        }
    ]
};

andrewjavao avatar Apr 08 '17 05:04 andrewjavao

You should set yAxis.scale = true to achieve the result you expect. If you mean to strictly apply the defined gap, I opened another issue for that: #11964

maliayas avatar Jan 01 '20 22:01 maliayas

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Jan 01 '22 21:01 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Jan 09 '22 21:01 github-actions[bot]