如何在echarts折线图中的标题后获取换行符?

时间:2018-07-18 04:53:51

标签: echarts

我想在标题后添加新行,有人可以帮助我该怎么做吗? 在这里,我设置的选项是

option ={
title: 'test content regarding the line chart'
}

由于标题很长,因此成为传奇人物 尝试过,

option ={
title: 'test content regarding the line chart \n'
}

不会锻炼...

谢谢

1 个答案:

答案 0 :(得分:0)

您做对了。只需使用'\n'添加另一行,您就可以在线使用eChart编辑器对其进行测试。 更改标题时,请注意子文本的位置。在标题末尾插入或删除新行。

https://ecomfe.github.io/echarts-examples/public/editor.html

您可以使用以下示例:

option = {
title: {
    text: ' Inserting a break on title \n and another break here \n',
    subtext: 'We also have the subtext'
},
tooltip: {
    trigger: 'axis',
    axisPointer: {
        type: 'shadow'
    }
},
legend: {
    data: ['Production']
},
grid: {
    containLabel: true
},
xAxis: {
    type: 'value',
    data: ['abc','xyz'],
    boundaryGap: [0, 0.01]
},
yAxis: {
    type: 'category',
    data: ['Month 1','Month 2']
},
series: {
        name: 'Production',
        type: 'bar',
        data: [70,80],
        isBiggerOrEqual: true
    }};