1. 程式人生 > >echarts X軸顯示不全

echarts X軸顯示不全

專案中有遇到X軸顯示不全的問題:


程式碼如下:

"xAxis": {
    "axisLine": {
        "lineStyle": {
            "color": "#fcead4",
"fontSize": 14
}
    },
"type": "category",
"data": ["打算花多少錢","實際花多少錢","肥料","農藥","工具","種苗","裝置","人工","灌溉","其他"],
"boundaryGap": true,
"axisTick": {
        "show": false
},
"axisLabel": {
        "margin"
: 8, "textStyle": { "color": "#676767" } } },

解決辦法:

"axisLabel": {
    "margin": 8,
"interval":0,//解決程式碼
"textStyle": {
        "color": "#676767"
}
}

這個是座標軸刻度標籤的顯示間隔,預設情況下會採用標籤不重疊的策略間隔顯示標籤,在這可以直接設定為0強制顯示所有標籤


ok  希望可以幫助到大家!