Skip to content
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

能否给axisPointer的label 增加一个align,而且 label 中的padding 设置并不生效,当左右两个值不相同时 #10569

Closed
CorruptKubCzh opened this issue May 29, 2019 · 2 comments · Fixed by #10585, OpenTMI/opentmi-default-gui#32 or DeviaVir/zenbot#2011 · May be fixed by dyna-dot/iClient-JavaScript-s#1
Assignees
Labels

Comments

@CorruptKubCzh
Copy link

What problem does this feature solve?

在使用axisPointer.label 时,如果 文字内容被要求多行显示时,可以不再是居中显示

What does the proposed API look like?

https://gallery.echartsjs.com/editor.html?c=xVszi2WnZ3&comment=0

app.title = '多 X 轴示例';
var colors = ['#5793f3', '#d14a61', '#675bba'];
option = {
color: colors,

tooltip: {
    trigger: 'none',
    axisPointer: {
        type: 'cross'
    }
},
legend: {
    data: ['2015 降水量', '2016 降水量']
},
grid: {
    top: 70,
    bottom: 90
},
xAxis: [{
        type: 'category',
        axisTick: {
            alignWithLabel: true
        },
        axisLine: {
            onZero: false,
            lineStyle: {
                color: colors[1]
            }
        },
        axisPointer: {
            label: {
                formatter: function(params) {
                    return '降水量 '   params.value  
                        (params.seriesData.length ? ':'   params.seriesData[0].data : '');
                },
                margin: 60,
                align: 'left',
                padding: [
                    5, // 上
                    60, // 右
                    5, // 下
                    0, // 左
                ]
            }
        },
        data: ["2016-1", "2016-2", "2016-3", "2016-4", "2016-5", "2016-6", "2016-7", "2016-8", "2016-9", "2016-10", "2016-11", "2016-12"]
    },
    {
        type: 'category',
        axisTick: {
            alignWithLabel: true
        },
        axisLine: {
            onZero: false,
            lineStyle: {
                color: colors[0]
            }
        },
        axisPointer: {
            label: {
                formatter: function(params) {
                    return '降水量  '   params.value  
                        (params.seriesData.length ? ':'   params.seriesData[0].data : '');
                }
            }
        },
        data: ["2015-1", "2015-2", "2015-3", "2015-4", "2015-5", "2015-6", "2015-7", "2015-8", "2015-9", "2015-10", "2015-11", "2015-12"]
    }
],
yAxis: [{
    type: 'value'
}],
series: [{
        name: '2015 降水量',
        type: 'line',
        xAxisIndex: 1,
        smooth: true,
        data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
    },
    {
        name: '2016 降水量',
        type: 'line',
        smooth: true,
        data: [3.9, 5.9, 11.1, 18.7, 48.3, 69.2, 231.6, 46.6, 55.4, 18.4, 10.3, 0.7]
    }
]

};

@echarts-bot
Copy link

echarts-bot bot commented May 29, 2019

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added new-feature pending We are not sure about whether this is a bug/new feature. waiting-for-help labels May 29, 2019
@Ovilia
Copy link
Contributor

Ovilia commented May 30, 2019

配置项中没有看到 align 选项,但是现在 padding 没有 work 可能是 bug

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