echarts icon indicating copy to clipboard operation
echarts copied to clipboard

当X轴的类型为time时,在IE11下时间以日期形式传值时绘制不出图形

Open WebsonLeo opened this issue 10 years ago • 4 comments

问题简述 (One-line summary)

在IE11下,X轴的类型为time是,series中的data每个数据的横坐标值为“2016-08-31 16:00:00”这种形式时,绘制不出折线图

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts 3.2.1):
  • 浏览器类型和版本 (Chrome 版本 52.0.2743.116 m):
  • 操作系统类型和版本 (windows7 专业版):

重现步骤 (Steps to reproduce)

1.将X轴置为time类型 2.设置data的数值为以下形式:"data": [["07-05 10:32:36", 847], ["07-05 10:32:39", 991], ["07-05 10:32:42", 67], ["07-05 10:32:45", 891], ["07-05 10:32:48", 979], ["07-05 10:32:51", 708], ["07-05 10:32:54", 371], ["07-05 10:32:57", 584]]

期望结果 (Expected behaviour)

能够和Chrome一样绘制出图形

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

可能在将字符串转成Date类型时出了问题。

ECharts配置项 (ECharts option)

option = {
    "tooltip": {
        "show": true,
        "trigger": "axis",
        "enterable": true
    },
    "legend": {
        "show": true,
        "textStyle": {
            "align": "center"
        },
        "orient": "vertical",
        "itemGap": 10,
        "data": ["NUM",
        "AVERAGE",
        "MAX",
        "LENGTH",
        "MIN",
        "SUM"],
        "top": "center",
        "right": "right"
    },
    "dataZoom": [{
        "show": false
    }],
    "xAxis": [{
        "show": true,
        "axisLine": {
            "show": true,
            "lineStyle": {
                "color": "#e5e5e5",
                "width": 1,
                "type": "solid"
            }
        },
        "axisTick": {
            "show": false
        },
        "splitLine": {
            "show": false
        },
        "type": "time",
        "boundaryGap": false,
        "data": [],
        "axisLabel": {

        },
        "name": ""
    }],
    "yAxis": [{
        "type": "value",
        "show": true,
        "axisLine": {
            "show": false
        },
        "splitNumber": 5,
        "splitLine": {
            "show": true,
            "lineStyle": {
                "color": ["#cfcfcf"],
                "width": 1,
                "type": "dotted"
            }
        },
        "max": 3400,
        "name": "",
        "scale": true
    }],
    "series": [{
        "name": "NUM",
        "type": "line",
        "yAxisIndex": 0,
        "smooth": true,
        "showSymbol": false,
        "symbol": "emptyCircle",
        "showAllSymbol": true,
        "symbolSize": 4,
        "data": [["07-05 10:32:36",
        847],
        ["07-05 10:32:39",
        991],
        ["07-05 10:32:42",
        67],
        ["07-05 10:32:45",
        891],
        ["07-05 10:32:48",
        979],
        ["07-05 10:32:51",
        708],
        ["07-05 10:32:54",
        371],
        ["07-05 10:32:57",
        584]],
        "itemStyle": {
            "normal": {
                "barBorderRadius": [7,
                7,
                0,
                0]
            },
            "emphasis": {
                "barBorderRadius": [7,
                7,
                0,
                0]
            }
        },
        "markPoint": {
            "label": {
                "normal": {

                }
            },
            "tooltip": {
                "show": false
            },
            "data": [{
                "name": "max",
                "type": "max",
                "itemStyle": {
                    "normal": {
                        "color": ""
                    }
                }
            },
            {
                "name": "min",
                "type": "min",
                "itemStyle": {
                    "normal": {
                        "color": ""
                    }
                }
            }]
        }
    }],
    "grid": {
        "borderColor": "#eee",
        "borderWidth": 0,
        "top": 20,
        "right": 128.04,
        "bottom": 35,
        "left": 45
    },
    "title": {
        "show": true,
        "text": "",
        "subtext": ""
    }
}


其他信息 (Other comments)

image

WebsonLeo avatar Aug 31 '16 08:08 WebsonLeo

试下 3.2.3 呢?有修过这个问题

pissang avatar Aug 31 '16 08:08 pissang

@pissang 在官网的实例中试也不行。。

WebsonLeo avatar Aug 31 '16 09:08 WebsonLeo

将2016-08-31 16:00:00,换成new Date(2016,8,31,16,0,0),试一下!我的是可以的!

daoyuanjiao avatar Aug 31 '16 23:08 daoyuanjiao

@daoyuanjiao 嗯嗯,谢谢你的回答,这样的确可以,不过需要我再代码里做转换了,但是现在代码的流程比较固定,不太好做这个转换,所以想知道有没有更简单的解决办法

WebsonLeo avatar Sep 01 '16 01:09 WebsonLeo