echarts icon indicating copy to clipboard operation
echarts copied to clipboard

yAxis.name如果有值会导致刻度值之间的距离不均等的问题

Open chensjmail opened this issue 10 years ago • 3 comments

问题简述 (One-line summary)

yAxis.name如果有值,在容器(div)小的时候会导致刻度值之间的距离不均等的问题 我测试的容器值为(width:500px,height:200px),因为是做手机显示的所以会有比较小的情况。 我把yAxis.name属性赋空或去掉就可以显示正常了。

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):2.2.0
  • 浏览器类型和版本 (Browser version):chrome 51.0.2704.63 (64-bit)
  • 操作系统类型和版本 (OS Version):ubuntu16.04

重现步骤 (Steps to reproduce)

1.有问题的option

option ={
    "tooltip":{
        "show":true,
        "trigger":"axis",
        "axisPointer":{
            "type":"shadow"
        }
    },
    "calculable":false,
    "xAxis":[{
        "type":"category",
        "data":["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
        "axisLabel":{
            "interval":0
        }
    }],
    "yAxis":[{
        "axisLine":{
            "show":false
        },
        "type":"value",
        "name":"客户总资产",
        "axisLabel":{
            "formatter":"{value}"
        }
    }, {
        "axisLine":{
            "show":false
        },
        "type":"value",
        "name":"增量",
        "axisLabel":{
            "formatter":"{value}"
        }
    }],
    "series":[{
        "name":"客户总资产",
        "yAxisIndex":0,
        "type":"bar",
        "data":[0.2, 0.5, 0.4, 0.3, 0.2, 0.9, 0.7, 0.8, 2.2, 0.6, 0.15, 0.28, 0.1],
        "itemStyle":{
            "normal":{
                "label":{
                    "show":true,
                    "position":"top"
                }
            }
        },
        "barWidth":20,
        "barGap":1
    }, {
        "name":"增量",
        "yAxisIndex":1,
        "type":"line",
        "data":[0.2, 0.3, -0.1, -0.1, -0.1, 0.7, -0.2, 0.1, 1.4, -1.6, -0.45, 0.13, -0.18],
        "symbol":"none"
    }],
    "color":["#8EBFEC", "#c0504D"],
    "grid":{
        "x":"10%",
        "width":"80%",
        "y":35,
        "y2":50,
        "borderWidth":0
    },
    "legend":{
        "x":"center",
        "y":"bottom",
        "itemWidth":30,
        "itemHeight":10,
        "data":[{
            "name":"客户总资产",
            "icon":"bar"
        }, {
            "name":"增量",
            "icon":"line"
        }]
    }
};

2.正常显示的option,只是把上面的option的yAxis.name属性改为""

option ={
    "tooltip":{
        "show":true,
        "trigger":"axis",
        "axisPointer":{
            "type":"shadow"
        }
    },
    "calculable":false,
    "xAxis":[{
        "type":"category",
        "data":["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
        "axisLabel":{
            "interval":0
        }
    }],
    "yAxis":[{
        "axisLine":{
            "show":false
        },
        "type":"value",
        "name":"",
        "axisLabel":{
            "formatter":"{value}"
        }
    }, {
        "axisLine":{
            "show":false
        },
        "type":"value",
        "name":"",
        "axisLabel":{
            "formatter":"{value}"
        }
    }],
    "series":[{
        "name":"客户总资产",
        "yAxisIndex":0,
        "type":"bar",
        "data":[0.2, 0.5, 0.4, 0.3, 0.2, 0.9, 0.7, 0.8, 2.2, 0.6, 0.15, 0.28, 0.1],
        "itemStyle":{
            "normal":{
                "label":{
                    "show":true,
                    "position":"top"
                }
            }
        },
        "barWidth":20,
        "barGap":1
    }, {
        "name":"增量",
        "yAxisIndex":1,
        "type":"line",
        "data":[0.2, 0.3, -0.1, -0.1, -0.1, 0.7, -0.2, 0.1, 1.4, -1.6, -0.45, 0.13, -0.18],
        "symbol":"none"
    }],
    "color":["#8EBFEC", "#c0504D"],
    "grid":{
        "x":"10%",
        "width":"80%",
        "y":35,
        "y2":50,
        "borderWidth":0
    },
    "legend":{
        "x":"center",
        "y":"bottom",
        "itemWidth":30,
        "itemHeight":10,
        "data":[{
            "name":"客户总资产",
            "icon":"bar"
        }, {
            "name":"增量",
            "icon":"line"
        }]
    }
};

期望结果 (Expected behaviour)

文档有这个属性值,我们有时候会使用这个属性

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

chensjmail avatar Jun 01 '16 10:06 chensjmail

新版本不存在这个问题

pissang avatar Jun 02 '16 02:06 pissang

@pissang 能不能具体到版本,那个版本修复了这个bug?

chensjmail avatar Jun 07 '16 06:06 chensjmail

3 之后

pissang avatar Jun 07 '16 07:06 pissang