echarts map 时间轴的使用

先看一下效果:

 

时间轴的使用还是挺简单的,只是如果数据量大的话可能要做异步加载之类的比较麻烦

这里主要阐述timeline部分,其他的可以见我的上一篇文章,完整代码及数据见我的github,https://github.com/bolanlaike/echarts-map

使用timeline组件就得在option里上这个,data即为时间轴对应的数据,

timeline: {
                                bottom: '6%',
                                autoPlay: true,
                                data: ['2002-01-01', '2003-01-01', '2004-01-01']
                            },

和其他组件不同,使用timeline组件时option里多了options属性,options是一个数组,分别对应timeline.data里的时间 

options: [
                            { //option 1 对应timeline.data中第一项2002年
                                title: {
                                    text: '2002年统计值'
                                },
                                series: [
                                    {
                                        type: 'heatmap',
                                        coordinateSystem: 'geo',
                                        data: [[116.46, 39.92, 6000]],
                                    },
                                    {
                                        type: 'lines',
                                        coordinateSystem: 'geo',
                                        polyline: true,
                                        data: busLines,
                                        lineStyle: {
                                            normal: {
                                                opacity: 1,
                                                width: 2,
                                                color:'#DDDDDD'
                                            }
                                        },
                                        progressiveThreshold: 500,
                                        progressive: 200,
                                        zlevel: 10
                                    }, {
                                        type: 'lines',
                                        coordinateSystem: 'geo',
                                        polyline: true,
                                        data: busLines,
                                        lineStyle: {
                                            normal: {
                                                width: 0,
                                 //               color:'#FF0000'
                                            }
                                        },
                                        effect: {
                                            constantSpeed: 20,
                                            show: true,
                                            trailLength: 0.1,
                                            symbolSize: 1.5
                                        },
                                        zlevel: 999
                                    }]
                            },
                            {//option 2 对应timeline.data 中第二项2003年
                                title: {
                                    text: '2003年统计值'
                                },
                                series: [{
                                    type: 'heatmap',
                                    coordinateSystem: 'geo',
                                    data: [[116.46, 39.92, 8000]],
                                }, {
                                    type: 'lines',
                                    coordinateSystem: 'geo',
                                    polyline: true,
                                    data: busLines,
                                    lineStyle: {
                                        normal: {
                                            opacity: 1,
                                            width: 2,
                                            color:'#DDDDDD'
                                        }
                                    },
                                    progressiveThreshold: 500,
                                    progressive: 200,
                                    zlevel: 10
                                }, {
                                    type: 'lines',
                                    coordinateSystem: 'geo',
                                    polyline: true,
                                    data: busLines,
                                    lineStyle: {
                                        normal: {
                                            width: 0,
                                //            color:'#FF0000'
                                        }
                                    },
                                    effect: {
                                        constantSpeed: 20,
                                        show: true,
                                        trailLength: 0.1,
                                        symbolSize: 1.5
                                    },
                                    zlevel: 999
                                }]},
                                {// option 3 对应timeline.data中第三项 2004年
                                    title: {
                                        text: '2004年统计值'
                                    },
                                    series:[ {
                                        type: 'heatmap',
                                        coordinateSystem: 'geo',
                                        data: [[116.46, 39.92, 10000]],
                                    },{
                                    type: 'lines',
                                    coordinateSystem: 'geo',
                                    polyline: true,
                                    data: busLines,
                                    lineStyle: {
                                        normal: {
                                            opacity: 1,
                                            width: 2,
                                            color:'#DDDDDD'
                                        }
                                    },
                                    progressiveThreshold: 500,
                                    progressive: 200,
                                    zlevel: 10
                                }, {
                                    type: 'lines',
                                    coordinateSystem: 'geo',
                                    polyline: true,
                                    data: busLines,
                                    lineStyle: {
                                        normal: {
                                            width: 0,
                                  //          color:'#FF0000'
                                        }
                                    },
                                    effect: {
                                        constantSpeed: 20,
                                        show: true,
                                        trailLength: 0.1,
                                        symbolSize: 1.5
                                    },
                                    zlevel: 999
                                }
                                    ]
                                }
                                ]

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值