echarts [Feature] scale problem

vwhgwdsa  于 5个月前  发布在  Echarts
关注(0)|答案(1)|浏览(112)

What problem does this feature solve?

When displaying a curve in a coordinate system, the coordinate scale is often determined from the bottom end of the vertical coordinate or the leftmost end of the horizontal coordinate. Now we want the scale to expand in both directions with the origin as the reference point. As shown in the following figure, how can we let the program automaticall set the vertical coordinate scale interval being 6, but the scale displayed is -12, -6, 0, 6, 12?

What does the proposed API look like?

Now we want the scale to expand in both directions with the origin as the reference point. As shown in the following figure, how can we let the program automaticall set the vertical coordinate scale interval being 6, but the scale displayed is -12, -6, 0, 6, 12?

holgip5t

holgip5t1#

I can't think of how to force using -2 as the origin of yAxis. You can only do this (which is probably not what you want):

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisLine: {
      onZero: false,
    }
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, -230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

相关问题