echarts icon indicating copy to clipboard operation
echarts copied to clipboard

双数值轴划分的段数不同

Open CherishIt opened this issue 9 years ago • 3 comments

One-line summary [问题简述]

想画一个双数值轴的图,但是因为两个轴划分的段数不同,导致splitLine不能重合会显得很凌乱,不知道有没有比较好的方法能让两个轴的splitLine对齐

Expected behaviour [期望结果]

两个数值轴被分成相同的段数,splitLine重合

ECharts option [ECharts配置项]

option = {
    tooltip: {
        trigger: 'axis',
    },
    legend: {
        data:['蒸发量','降水量','平均温度']
    },
    xAxis: [
        {
            type: 'category',
            data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
        }
    ],
    yAxis: [
        {
            type: 'value',
            name: '水量',
            axisLabel: {
                formatter: '{value} ml'
            }
        },
        {
            type: 'value',
            name: '温度',
            axisLabel: {
                formatter: '{value} °C'
            }
        }
    ],
    series: [
        {
            name:'蒸发量',
            type:'bar',
            data:[2.0, 7.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
        },
        {
            name:'平均温度',
            type:'line',
            yAxisIndex: 1,
            data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
        }
    ]
}

Other comments [其他信息]

screen shot 2017-08-14 at 10 03 08 am

CherishIt avatar Aug 14 '17 02:08 CherishIt

源码中niceExtent这个方法最后一行添加 this._interval = (extent[1] - extent[0]) / opt.splitNumber;

不保证不出其他错误

luguokong avatar Aug 15 '17 06:08 luguokong

@luguokong 双y轴的是好了,,但是单y轴却长成下面这样

image 求教,,遇见过吗?

zjdschnappi avatar Aug 16 '17 07:08 zjdschnappi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 02 '20 21:04 stale[bot]