Zhuzhenguang
Zhuzhenguang

Reputation: 31

How to implement a margin between start point and 0 scale on y-axis on Echarts?

I am building up a bar chart using Echarts, Dose anyone know how to implement a margin between start point and 0 scale on y-axis?

The expect effects of y-axis like this

Upvotes: 1

Views: 2680

Answers (1)

Zhuzhenguang
Zhuzhenguang

Reputation: 31

This has been solved.

xAxis: {
    type: 'category',
    data: {},
    axisTick: {
      //...
    },
    axisLine: {
        onZero: false // This is important, so x axis can start from non-zero number
    }
},
yAxis: {
    splitLine: { show: false },
    max: 'dataMax',
    type: 'value',
    min: -7 // This is also important, y axis can start from a negative number
}

Upvotes: 2

Related Questions