echarts icon indicating copy to clipboard operation
echarts copied to clipboard

dataZoom在移动端拖放,坐标轴重画时,旧坐标轴依然存在,造成重影。

Open jjackychen opened this issue 10 years ago • 4 comments

问题简述 (One-line summary)

dataZoom在移动端拖放,坐标轴重画时,旧坐标轴依然存在,造成重影。

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):V3.1.10
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version): 华为MediaPad 10 Link+ Android版本:4.2.2 内核版本:3.0.8

重现步骤 (Steps to reproduce)

1.在移动端使用自带浏览器打开页面。 2.拖动横纵坐标的dataZoom。 3.出现旧的坐标轴依然存在,新的坐标轴重画,重影。

期望结果 (Expected behaviour)

解决坐标轴重影问题

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

            option = {
            title: {
                text: '温度(°C)',
                x: 'center'
            },
        legend: {
            show: true,
            right: '0',
            data: [
                '温度1','温度2','温度3'
            ]
        },
        tooltip: {
            trigger: 'axis',
            formatter: function(params) {
                var result = "";
                for (var i = 0; i < params.length; i++) {
                    var p = params[i];
                    var seriesName = p.seriesName;
                    if (typeof(p.value) == "undefined") {
                        result += seriesName + ',  <br />';
                    } else {
                        var date = new Date(p.value[0]);
                        var value = p.value;
                        result += seriesName.substring(0,seriesName.length - 2) + ', ' + date.toLocaleString() + ' ,' + p.value[1] + '<br />';
                    }
                }
                return result;
            }
        },
        xAxis: [{
            type: 'time'
        }],
        yAxis: [{
            type: 'value',
            axisLabel: {
                formatter: '{value} °C'
            }
        }],
        grid: {
            left: '6%',
            right: '9%',
            bottom: '9%',
            containLabel: true
        },
        dataZoom: [{
            type: 'inside',
            orient: 'horizontal',
          startValue:'2016/05/30 00:31:01',
          endValue:'2016/05/30 00:34:00'
        },{
            type: 'slider',
            orient: 'horizontal'

        },{
            type: 'inside',
            orient: 'vertical'
        },{
            type: 'slider',
            orient: 'vertical'
        }],
        series: [
            {
              name: '温度1',
              type: 'line',
              showSymbol: false,
              hoverAnimation: false,
              sampling: 'max',
              markLine: {
                symbol: ['none', 'none'],
                data: [{
                  name: '上限',
                  type: 'max',
                  yAxis: 31.0,
                  lineStyle: {
                    normal: {
                      color: '#FF3030'
                    }
                  },
                  label: {
                    normal: {
                      formatter: '{c}{b}'
                    }
                  }
                }, {
                  name: '下限',
                  type: 'min',
                  yAxis: 29.0,
                  lineStyle: {
                    normal: {
                      color: '#FF3030'
                    }
                  },
                  label: {
                    normal: {
                      formatter: '{c}{b}'
                    }
                  }
                }]
              },
              data: [
                ['2016/05/30 00:00:00', 31.0],
                ['2016/05/30 00:01:00', 31.0],
                ['2016/05/30 00:27:00', 30.6],
                ['2016/05/30 00:28:00', 30.5],
                ['2016/05/30 00:29:00', 30.5],
                ['2016/05/30 00:30:00', 30.5],
                ['2016/05/30 00:31:01', 30.5],
                ['2016/05/30 00:32:00', 30.6],
                ['2016/05/30 00:33:00', 30.6],
                ['2016/05/30 00:34:00', 30.6]
              ]
            }, 
            {
              name: '温度2',
              type: 'line',
              showSymbol: false,
              hoverAnimation: false,
              sampling: 'max',
              markLine: {
                symbol: ['none', 'none'],
                data: [{
                  name: '上限',
                  type: 'max',
                  yAxis: 31.0,
                  lineStyle: {
                    normal: {
                      color: '#FF3030'
                    }
                  },
                  label: {
                    normal: {
                      formatter: '{c}{b}'
                    }
                  }
                }, {
                  name: '下限',
                  type: 'min',
                  yAxis: 29.0,
                  lineStyle: {
                    normal: {
                      color: '#FF3030'
                    }
                  },
                  label: {
                    normal: {
                      formatter: '{c}{b}'
                    }
                  }
                }]
              },
              data: [
                ['2016/05/30 00:00:00', 30.6],
                ['2016/05/30 00:01:00', 30.7],
                ['2016/05/30 00:27:00', 30.7],
                ['2016/05/30 00:28:00', 30.6],
                ['2016/05/30 00:29:00', 30.7],
                ['2016/05/30 00:30:00', 30.7],
                ['2016/05/30 00:31:01', 30.7],
                ['2016/05/30 00:32:00', 30.8],
                ['2016/05/30 00:33:00', 30.8],
                ['2016/05/30 00:34:00', 30.9]
              ]
            }, 
            {
            name: '温度3',
            type: 'line',
            showSymbol: false,
            hoverAnimation: false,
            sampling: 'max',
            markLine: {
              symbol: ['none', 'none'],
              data: [{
                name: '上限',
                type: 'max',
                yAxis: 31.0,
                lineStyle: {
                  normal: {
                    color: '#FF3030'
                  }
                },
                label: {
                  normal: {
                    formatter: '{c}{b}'
                  }
                }
              }, {
                name: '下限',
                type: 'min',
                yAxis: 29.0,
                lineStyle: {
                  normal: {
                    color: '#FF3030'
                  }
                },
                label: {
                  normal: {
                    formatter: '{c}{b}'
                  }
                }
              }]
            },
            data: [
              ['2016/05/30 00:00:00', 30.8],
              ['2016/05/30 00:01:00', 30.8],
              ['2016/05/30 00:27:00', 30.9],
              ['2016/05/30 00:28:00', 30.9],
              ['2016/05/30 00:29:00', 30.9],
              ['2016/05/30 00:30:00', 31.0],
              ['2016/05/30 00:31:01', 30.7],
              ['2016/05/30 00:32:00', 30.8],
              ['2016/05/30 00:33:00', 30.8],
              ['2016/05/30 00:34:00', 30.9]
            ]}
      ]};

其他信息 (Other comments)

jjackychen avatar Jul 04 '16 02:07 jjackychen

试下http://blog.csdn.net/lufy_legend/article/details/17498837 这里提到的解决办法

pissang avatar Jul 04 '16 03:07 pissang

尝试过http://blog.csdn.net/lufy_legend/article/details/17498837 这里提到bug一的解决办法,canvas外层的div需要设定属性style="overflow:visible;-webkit-transform: translateZ(0);没有效果。

jjackychen avatar Jul 04 '16 03:07 jjackychen

似乎是加载的时候画了两张图,在setOption后再clearRect可以解决问题

jjackychen avatar Jul 05 '16 03:07 jjackychen

@jjackychen 在setOption后再clearRect可以解决问题,这种方式能解决 label 重影的问题吗?

savioryu avatar Jul 11 '17 09:07 savioryu