当设置了Media Query时,dataZoom的设置因为merge而丢失(3.1.x版) #2710

Closed
netwww1 opened this Issue Mar 2, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@netwww1

netwww1 commented Mar 2, 2016

如下示例,当删除media中默认option里的dataZoom时,y轴的缩放轴的默认设置就丢失了,恢复成echarts默认的各项设置值,该问题出现在3.1.x版本,3.0.2没有该问题(正常情况,不需要在默认option里加入dataZoom设置)。

// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));

// 指定图表的配置项和数据
var option = {
baseOption: {
    title: {
        text: 'ECharts 入门示例',
        left: 'center'
    },
    tooltip: { trigger: 'axis' },
    toolbox: {
        show : true,
        feature : {
            dataZoom: {},
            dataView: { readOnly: false },
            magicType: { show:false, type: ['line', 'bar'] },
            restore: {},
            saveAsImage: {}
        }
    },
    dataZoom: [
        {
            show: true,
            start: 0,
            end: 100,
            bottom: '8'
        },
        {
            type: 'inside',
            start: 0,
            end: 100
        },
        {
            show: true,
            yAxisIndex: 0,
            filterMode: 'empty',
            width: 12,
            handleSize: 8,
            showDataShadow: false,
            right: '2%'
        }
    ],
    legend: {
        data:['销量'],
        top: '36',
        left: 'center'
    },
    grid: {
        left: '12%',
        top: '72',
        right: '5%',
        bottom: '72'
    },
    xAxis: {
        data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
    },
    yAxis: {},
    series: [{
        name: '销量',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
    }]
},
media: [
    {
        option: {
            title: {
                left: 'center'
            },
            legend: {
                orient: 'horizontal'
            },
            grid: {
                top: '72'
            },
            // 如果删除此处 dataZoom,则y轴的缩放轴设置丢失
            dataZoom: [
                {
                },
                {
                },
                {
                    width: 12,
                    handleSize: 8,
                    showDataShadow: false,
                    right: '2%'
                }
            ]
        }
    },
    {
        query: {
            maxWidth: 400
        },
        option: {
            title: {
                left: 'left'
            },
            legend: {
                orient: 'vertical'
            },
            grid: {
                top: '90'
            }
        }
    }
]
};

// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);

@100pah 100pah added the bug label Mar 4, 2016

@100pah 100pah closed this in 340794c Mar 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment