鍍金池/ 問答/HTML/ 關(guān)于echarts y軸坐標刻度的問題

關(guān)于echarts y軸坐標刻度的問題

問題描述

需求是有一組數(shù)據(jù)data,dat.x為x軸時間橫坐標,data.y為y軸data,data.y的豎直范圍在1上下波動,現(xiàn)在需要將曲線圖的原點坐標的y坐標變?yōu)橐?起始,超出1的部分在x軸上方,低于1就在x軸下面,現(xiàn)在的曲線圖如下

問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法


圖片描述

相關(guān)代碼

// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)
var option = {

    tooltip: {
        trigger: 'axis',
    },
    xAxis : [ {
        show:true,
        type: 'category',
        boundaryGap: false,
        axisLine:{
            show:true,
        },
        axisTick:{
            show:false
        },
        axisLabel:{
            show:false
            },
        splitLine:{
            show:false,
        },
        data : strategyInfo.x
    } ],
    yAxis : [{
        show : true,
        axisLine : {
            show : true,
            lineStyle : {
                color : "#bae1e5"
            }
        },
        scale: true,
        axisTick : {
            show : true
        },
        axisLabel:{
            show:true
            },
        position : 'left',
        type : 'value',
        boundaryGap : [ 0, '15%' ],
        splitLine : {
            show : false,
            interval : 1000,
            lineStyle : {
                color : "#bae1e5"
            }
        },

    }],
    series : [ {
        name : '凈值',
        type : 'line',
        xAxisIndex : 0,
        yAxisIndex : 0,
        data : strategyInfo.y,
        smooth : true,
        symbol : 'none',
        sampling : 'average',
        itemStyle : {
            normal : {
                color : 'rgb(164, 215, 220)'
            }
        },
        areaStyle : {
            normal : {
                color : 'rgb(164, 215, 220)'
            }
        },
    } ]
};

你期待的結(jié)果是什么?實際看到的錯誤信息又是什么?

回答
編輯回答
安淺陌

可以試試設(shè)置xAxis.offset
不過這樣offset是個固定值,如果圖表大小發(fā)生變化不好做自適應(yīng)

2018年7月9日 02:19