apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.6k stars 19.62k forks source link

The axis name align way base on x/y axis line ? #9901

Closed xianghongai closed 5 years ago

xianghongai commented 5 years ago

General Questions

Issue Type

Issue Details

Expected Behavior

how-to-align-left-of-yaxis-that-name

Current Behavior

If the axis name too long, it will overflow the canvas.

Online Example

option = {
    xAxis: {
        type: 'category',
        name: `Axis name very very very very very very very very long`,
        nameLocation: 'start',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value',
        name: `Axis name very very very very very very very very long`,
        nameLocation: 'end',
        nameAlign: 'end',
        nameGap: 15,

    },
    series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line',
        smooth: true
    }]
};

Topics

Anything Else We Need to Know

PS: This issue template, the Issue Details section, <!-- DESCRIBE_HERE} --> tips message missing { chart.

Environment

Ovilia commented 5 years ago

Please use https://echarts.baidu.com/option.html#yAxis.nameTextStyle.align

xianghongai commented 5 years ago

yAxis nameTextStyle align is not working, color property in working.

yaxis nametextstyle align-not-working

option = {
    xAxis: {
        type: 'category',
        name: `xAxis very very very very very very very very long`,
        nameGap: 35,
        nameLocation: 'end',
        nameTextStyle: {
            color: '#00f',
            fontWeight: 'bolder',
            align: 'left',
            verticalAlign: 'left'
        },
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value',
        name: `yAxis very very very very very very very very long`,
        nameGap: 35,
        nameLocation: 'end',
        nameTextStyle: {
            color: '#f00',
            fontWeight: 'bolder',
            align: 'right'
        }
    },
    series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line',
        smooth: true
    }]
};
yangchao35071 commented 5 years ago

请问解决了吗? 我也是这个问题yAxis.nameTextStyle.align不生效, 但是低版本的echarts却可以

Ovilia commented 5 years ago

@yangchao35071 Not yet. Scheduled in v4.3.0.

wjhcc2018 commented 5 years ago

我也遇到这个问题了,大家解决了吗

zhouye0211 commented 5 years ago

我也遇到了这个问题,把y轴的name替换成title去设置或者用grid.left去调整。