Browse Source

首页地图

master
1181364@qq.com 2 years ago
parent
commit
6f62d1c2e0
  1. 935
      src/views/dashboard/components/HomeMap.vue

935
src/views/dashboard/components/HomeMap.vue

@ -4,496 +4,495 @@
<script> <script>
// import { // import {
// raiseOldWholeData, // raiseOldWholeData,
// exceptionSituation, // exceptionSituation,
// raiseOldmanSituation, // raiseOldmanSituation,
// weekDayCompare, // weekDayCompare,
// getMapDataTongji, // getMapDataTongji,
// bindFuWuLiang // bindFuWuLiang
// } from '@/api/tongji/kanBanJuJiaYangLao' // } from '@/api/tongji/kanBanJuJiaYangLao'
import * as echarts from 'echarts' import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize' import resize from './mixins/resize'
// import xt_data from '@/assets///geojson.json' // import xt_data from '@/assets///geojson.json'
import xt_data from '@/assets/全国/geojson.json' import xt_data from '@/assets/全国/geojson.json'
export default { export default {
mixins: [resize], mixins: [resize],
data() { data() {
return { return {
chartDatas2: [], chartDatas2: [],
chart: null, chart: null,
startCharts: null, startCharts: null,
charPie3currentIndex: 0, charPie3currentIndex: 0,
dataLen: 0 dataLen: 0
}
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
} }
} },
}, watch: {
mounted() { chartData: {
this.$nextTick(() => { deep: true,
this.initChart() handler(val) {
}) this.setOptions(val)
}, }
beforeDestroy() { }
if (!this.chart) { },
return mounted() {
} this.$nextTick(() => {
if (this.startCharts) { this.initChart()
clearInterval(this.startCharts) })
} },
this.chart.dispose() beforeDestroy() {
this.chart = null if (!this.chart) {
}, return
methods: { }
initChart() { if (this.startCharts) {
// getMapDataTongji().then(response => { clearInterval(this.startCharts)
// if (response.code === 20000) { }
// if ( this.chart.dispose()
// response.data !== null && this.chart = null
// response.data !== '' && },
// response.data !== undefined methods: {
// ) { initChart() {
// this.countyData = [] // getMapDataTongji().then(response => {
// for (var i = 0; i < response.data.length; i++) { // if (response.code === 20000) {
// var county = response.data[i] // if (
// this.countyData.push({ // response.data !== null &&
// name: county.title, // response.data !== '' &&
// value: county.departmentCount, // response.data !== undefined
// county: county // ) {
// }) // this.countyData = []
// console.log('chartDatas2', this.chartDatas2) // for (var i = 0; i < response.data.length; i++) {
// if (county.title === '') { // var county = response.data[i]
// this.chartDatas2.push({ // this.countyData.push({
// name: '', // name: county.title,
// value: [ // value: county.departmentCount,
// 114.597268, // county: county
// 37.096124, // })
// county.departmentCount, // console.log('chartDatas2', this.chartDatas2)
// county.personCount // if (county.title === '') {
// ] // this.chartDatas2.push({
// }) // name: '',
// } // value: [
// if (county.title === '') { // 114.597268,
// this.chartDatas2.push({ // 37.096124,
// name: '', // county.departmentCount,
// value: [ // county.personCount
// 114.565733, // ]
// 37.06169, // })
// county.departmentCount, // }
// county.personCount // if (county.title === '') {
// ] // this.chartDatas2.push({
// }) // name: '',
// } // value: [
// } // 114.565733,
// console.log('chartDatas2aaaa', this.chartDatas2) // 37.06169,
var _self = this // county.departmentCount,
const myChart = echarts.init(this.$refs.myEchart) // // county.personCount
this.chart = myChart // ]
window.onresize = myChart.resize // })
myChart.showLoading()
var option = {}
console.log(JSON.stringify(this.countyData))
this.countyData = [
{ 'name': '北京', 'value': '48', 'county': { 'title': '北京', 'jwd': '114.52153 , 38.04831', 'personCount': '22831', 'departmentCount': '48', 'ad': '110000' }},
{ 'name': '邢东新区', 'value': '4', 'county': { 'title': '邢东新区', 'jwd': '114.597268,37.096124', 'personCount': '806', 'departmentCount': '4', 'areaCode': '130591' }}]
// { 'name': '', 'value': '48', 'county': { 'title': '', 'jwd': '114.492019,37.061614', 'personCount': '22831', 'departmentCount': '48', 'areaCode': '130502' }},
// { 'name': '', 'value': '131', 'county': { 'title': '', 'jwd': '114.468435,37.059882', 'personCount': '12487', 'departmentCount': '131', 'areaCode': '130503' }},
// { 'name': '', 'value': '67', 'county': { 'title': '', 'jwd': '114.671936,37.120983', 'personCount': '10179', 'departmentCount': '67', 'areaCode': '130505' }},
// { 'name': '', 'value': '16', 'county': { 'title': '', 'jwd': '114.683762,37.005041', 'personCount': '3909', 'departmentCount': '16', 'areaCode': '130506' }},
// { 'name': '', 'value': '30', 'county': { 'title': '', 'jwd': '114.506873,37.444009', 'personCount': '4023', 'departmentCount': '18', 'areaCode': '130522' }},
// { 'name': '', 'value': '29', 'county': { 'title': '', 'jwd': '114.511523,37.287663', 'personCount': '6724', 'departmentCount': '19', 'areaCode': '130523' }},
// { 'name': '', 'value': '70', 'county': { 'title': '', 'jwd': '114.693382,37.483596', 'personCount': '1625', 'departmentCount': '7', 'areaCode': '130524' }},
// { 'name': '', 'value': '10', 'county': { 'title': '', 'jwd': '114.776348,37.350925', 'personCount': '44038', 'departmentCount': '10', 'areaCode': '130525' }},
// { 'name': '', 'value': '71', 'county': { 'title': '', 'jwd': '114.921027,37.618956', 'personCount': '13381', 'departmentCount': '71', 'areaCode': '130528' }},
// { 'name': '鹿', 'value': '55', 'county': { 'title': '鹿', 'jwd': '115.038782,37.21768', 'personCount': '8627', 'departmentCount': '55', 'areaCode': '130529' }},
// { 'name': '', 'value': '8', 'county': { 'title': '', 'jwd': '115.247537,37.526216', 'personCount': '212', 'departmentCount': '8', 'areaCode': '130530' }},
// { 'name': '广', 'value': '27', 'county': { 'title': '广', 'jwd': '115.142797,37.075548', 'personCount': '4903', 'departmentCount': '27', 'areaCode': '130531' }},
// { 'name': '', 'value': '39', 'county': { 'title': '', 'jwd': '115.029218,37.069404', 'personCount': '1884', 'departmentCount': '39', 'areaCode': '130532' }},
// { 'name': '', 'value': '14', 'county': { 'title': '', 'jwd': '115.272749,36.983272', 'personCount': '4831', 'departmentCount': '14', 'areaCode': '130533' }},
// { 'name': '', 'value': '25', 'county': { 'title': '', 'jwd': '115.668999,37.059991', 'personCount': '6240', 'departmentCount': '25', 'areaCode': '130534' }},
// { 'name': '西', 'value': '7', 'county': { 'title': '西', 'jwd': '115.498684,36.8642', 'personCount': '1903', 'departmentCount': '7', 'areaCode': '130535' }},
// { 'name': '', 'value': '22', 'county': { 'title': '', 'jwd': '114.565733,37.061690', 'personCount': '24184', 'departmentCount': '22', 'areaCode': '130571' }},
// { 'name': '', 'value': '24', 'county': { 'title': '', 'jwd': '115.398102,37.359668', 'personCount': '8200', 'departmentCount': '24', 'areaCode': '130581' }},
// { 'name': '', 'value': '23', 'county': { 'title': '', 'jwd': '114.504902,36.861903', 'personCount': '4745', 'departmentCount': '23', 'areaCode': '130582' }},
// { 'name': '', 'value': '4', 'county': { 'title': '', 'jwd': '114.597268,37.096124', 'personCount': '806', 'departmentCount': '4', 'areaCode': '130591' }}]
echarts.registerMap('xingtai', xt_data, {})
option = {
title: {
text: '全国仓库分布图',
// subtext: 'Data from www.census.gov',
left: 'center',
textStyle: {
fontSize: 24,
color: '#026193'
// fontWeight: 'bolder' //
},
show: true
},
tooltip: {
alwaysShowContent: true,
textStyle: {
fontSize: 12,
color: '#ccc'
},
trigger: 'item',
backgroundColor: '#242429cc',
formatter: function(params) {
const value = (params.value + '').split('.')
var valueStr = value[0].replace(
/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,
'$1,'
)
var personCount = 0
if (params.componentSubType === 'scatter') {
// debugger
valueStr = params.data.value[2]
personCount = params.data.value[3]
} else {
personCount = params.data.county.personCount
}
return (
params.name +
'<br/>老人数量: ' +
personCount +
'人<br/>' +
'机构数量:' +
valueStr +
'个'
)
}
},
// geo: {
// map: 'xingtai',
// aspectScale: 0.75,
// layoutCenter: ['50%', '50.5%'],
// layoutSize: '102%',
// silent: true,
// roam: false,
// z: 0,
// itemStyle: {
// normal: {
// areaColor: '#9db8d2',
// shadowColor: 'rgba(0, 0, 0, 1)',
// shadowBlur: 0,
// shadowOffsetX: 0,
// shadowOffsetY: 10,
// borderColor: 'rgba(0, 0, 0, 0.7)',
// borderWidth: 0.5
// },
// emphasis: {
// areaColor: '#2AB8FF',
// borderWidth: 1,
// color: 'green',
// label: {
// show: false
// }
// }
// } // }
// }, // }
geo: { // console.log('chartDatas2aaaa', this.chartDatas2)
show: true, var _self = this
map: 'xingtai', const myChart = echarts.init(this.$refs.myEchart) //
roam: false, this.chart = myChart
label: { window.onresize = myChart.resize
normal: { myChart.showLoading()
show: false var option = {}
console.log(JSON.stringify(this.countyData))
this.countyData = [
{ 'name': '北京市', 'value': '20', 'county': { 'title': '北京市' } },
{ 'name': '甘肃省', 'value': '40', 'county': { 'title': '甘肃省' } },
{ 'name': '四川省', 'value': '100', 'county': { 'title': '四川省' } },
{ 'name': '山西省', 'value': '200', 'county': { 'title': '山西省' } },
{ 'name': '辽宁省', 'value': '48', 'county': { 'title': '辽宁省' } },
{ 'name': '吉林省', 'value': '268', 'county': { 'title': '吉林省' } },
{ 'name': '陕西省', 'value': '369', 'county': { 'title': '陕西省' } },
{ 'name': '河北省', 'value': '500', 'county': { 'title': '河北省' } },
{ 'name': '山东省', 'value': '10', 'county': { 'title': '山东省' } },
{ 'name': '天津市', 'value': '356', 'county': { 'title': '天津市' } },
{ 'name': '河南省', 'value': '479', 'county': { 'title': '河南省' } },
{ 'name': '湖北省', 'value': '285', 'county': { 'title': '湖北省' } },
{ 'name': '重庆市', 'value': '190', 'county': { 'title': '重庆市' } },
{ 'name': '贵州省', 'value': '560', 'county': { 'title': '贵州省' } },
{ 'name': '福建省', 'value': '80', 'county': { 'title': '福建省' } },
{ 'name': '湖南省', 'value': '159', 'county': { 'title': '湖南省' } },
{ 'name': '江西省', 'value': '259', 'county': { 'title': '江西省' } },
{ 'name': '广东省', 'value': '359', 'county': { 'title': '广东省' } },
{ 'name': '海南省', 'value': '459', 'county': { 'title': '海南省' } },
{ 'name': '台湾省', 'value': '559', 'county': { 'title': '台湾省' } },
{ 'name': '江苏省', 'value': '80', 'county': { 'title': '江苏省' } },
{ 'name': '安徽省', 'value': '480', 'county': { 'title': '安徽省' } },
{ 'name': '上海市', 'value': '90', 'county': { 'title': '上海市' } },
{ 'name': '浙江省', 'value': '418', 'county': { 'title': '浙江省' } },
{ 'name': '云南省', 'value': '131', 'county': { 'title': '云南省' } },
{ 'name': '青海省', 'value': '4', 'county': { 'title': '青海省' } },
{ 'name': '广西壮族自治区', 'value': '428', 'county': { 'title': '广西壮族自治区' } },
{ 'name': '宁夏回族自治区', 'value': '248', 'county': { 'title': '宁夏回族自治区' } },
{ 'name': '西藏自治区', 'value': '138', 'county': { 'title': '西藏自治区' } },
{ 'name': '内蒙古自治区', 'value': '318', 'county': { 'title': '内蒙古自治区' } },
{ 'name': '新疆维吾尔自治区', 'value': '381', 'county': { 'title': '新疆维吾尔自治区' } },
{ 'name': '黑龙江省', 'value': '48', 'county': { 'title': '黑龙江省' } },
]
echarts.registerMap('xingtai', xt_data, {})
option = {
title: {
text: '全国仓库分布图',
// subtext: 'Data from www.census.gov',
left: 'center',
textStyle: {
fontSize: 24,
color: '#026193'
// fontWeight: 'bolder' //
}, },
emphasis: { show: true
show: false
}
}, },
itemStyle: { tooltip: {
normal: { alwaysShowContent: true,
areaColor: '#3c8dbc', // textStyle: {
borderColor: '#097bba' fontSize: 12,
color: '#ccc'
}, },
emphasis: { trigger: 'item',
areaColor: '#fbd456' // backgroundColor: '#242429cc',
formatter: function (params) {
const value = (params.value + '').split('.')
var valueStr = value[0].replace(
/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,
'$1,'
)
return (
params.name +
'<br/>仓库数量: ' +
valueStr +
'个'
)
} }
}
},
visualMap: {
show: false,
left: 'right',
bottom: 20,
min: 0,
max: 100,
text: ['高', '低'],
calculable: true,
textStyle: {
color: '#fff'
}, },
inRange: { // geo: {
color: ['#f37b1d', '#1e6ff0', '#6e41c7', '#34b157'],
symbolSize: [30, 100]
}
},
toolbox: {
show: false,
// orient: 'vertical',
left: 'left',
top: 'top',
feature: {
dataView: { readOnly: false },
restore: {},
saveAsImage: {}
}
},
textStyle: {
fontSize: 16
},
series: [
// {
// name: '',
// type: 'map',
// roam: true,
// map: 'xingtai', // map: 'xingtai',
// emphasis: { // aspectScale: 0.75,
// label: { // layoutCenter: ['50%', '50.5%'],
// show: true, // layoutSize: '102%',
// silent: true,
// roam: false,
// z: 0,
// itemStyle: {
// normal: {
// areaColor: '#9db8d2',
// shadowColor: 'rgba(0, 0, 0, 1)',
// shadowBlur: 0,
// shadowOffsetX: 0,
// shadowOffsetY: 10,
// borderColor: 'rgba(0, 0, 0, 0.7)',
// borderWidth: 0.5
// }, // },
// }, // emphasis: {
// label: { // areaColor: '#2AB8FF',
// show: true, // borderWidth: 1,
// // formatter: '{b}:{@score}' // color: 'green',
// }, // label: {
// data: this.countyData, // show: false
// }
// }
// }
// }, // },
{ geo: {
name: '机构数量', show: true,
type: 'map',
roam: false,
map: 'xingtai', map: 'xingtai',
roam: false,
label: { label: {
show: false normal: {
// formatter: '{b}:{@score}' show: false
},
emphasis: {
show: false
}
}, },
data: this.countyData, itemStyle: {
emphasis: { normal: {
areaColor: '#3c8dbc', //
borderColor: '#097bba'
},
emphasis: {
areaColor: '#fbd456' //
}
}
},
visualMap: {
show: false,
left: 'right',
bottom: 20,
min: 0,
max: 100,
text: ['高', '低'],
calculable: true,
textStyle: {
color: '#fff'
},
inRange: {
color: ['#f37b1d', '#1e6ff0', '#6e41c7', '#34b157'],
symbolSize: [30, 100]
}
},
toolbox: {
show: false,
// orient: 'vertical',
left: 'left',
top: 'top',
feature: {
dataView: { readOnly: false },
restore: {},
saveAsImage: {}
}
},
textStyle: {
fontSize: 16
},
series: [
// {
// name: '',
// type: 'map',
// roam: true,
// map: 'xingtai',
// emphasis: {
// label: {
// show: true,
// },
// },
// label: {
// show: true,
// // formatter: '{b}:{@score}'
// },
// data: this.countyData,
// },
{
name: '机构数量',
type: 'map',
roam: false,
map: 'xingtai',
label: { label: {
show: true, show: false
fontSize: 20, // formatter: '{b}:{@score}'
fontWeight: 'bolder'
}, },
itemStyle: { data: this.countyData,
// borderType: 'solid', emphasis: {
// borderWidth: 3, label: {
// borderColor: '#e83e11', show: true,
shadowBlur: 20, fontSize: 20,
shadowOffsetX: 5, fontWeight: 'bolder'
shadowOffsetY: 5 },
itemStyle: {
// borderType: 'solid',
// borderWidth: 3,
// borderColor: '#e83e11',
shadowBlur: 20,
shadowOffsetX: 5,
shadowOffsetY: 5
}
} }
} }
} // {
// { // //
// // // symbol: 'circle',
// symbol: 'circle', // symbolSize: 20,
// symbolSize: 20, // label: {
// label: { // normal: {
// normal: { // formatter: '{b}',
// formatter: '{b}', // position: 'right',
// position: 'right', // show: true
// show: true // // textStyle: {
// // textStyle: { // // color: '#f00',
// // color: '#f00', // // fontSize: 12
// // fontSize: 12 // // },
// // }, // },
// }, // emphasis: {
// emphasis: { // show: true
// show: true // }
// } // },
// }, // itemStyle: {
// itemStyle: { // color: '#fa3008',
// color: '#fa3008', // opacity: 1,
// opacity: 1, // borderColor: '#9603ea',
// borderColor: '#9603ea', // borderWidth: 1
// borderWidth: 1
// // normal: { // // normal: {
// // opacity : 1, // // opacity : 1,
// // borderColor: '#fa3008', // // borderColor: '#fa3008',
// // borderWidth: 1, // // borderWidth: 1,
// // color: '#ff' // // color: '#ff'
// // } // // }
// }, // },
// name: 'light', // name: 'light',
// type: 'scatter', // type: 'scatter',
// coordinateSystem: 'geo', // coordinateSystem: 'geo',
// data: this.chartDatas2 // data: this.chartDatas2
// }, // },
// { // {
// // // //
// name: 'Top 5', // name: 'Top 5',
// type: 'scatter', // type: 'scatter',
// coordinateSystem: 'geo', // coordinateSystem: 'geo',
// // symbol: 'pin', // // symbol: 'pin',
// // symbolSize: [50, 50], // // symbolSize: [50, 50],
// symbolOffset: [0, -12], // symbolOffset: [0, -12],
// symbol: 'image://home/markertu3.png', // symbol: 'image://home/markertu3.png',
// symbolSize: [30, 30], // symbolSize: [30, 30],
// label: { // label: {
// normal: { // normal: {
// show: false, // show: false,
// textStyle: { // textStyle: {
// color: '#ff0', // color: '#ff0',
// fontSize: 12 // fontSize: 12
// }, // },
// formatter(value) { // formatter(value) {
// return value.data.value[2] // // return value.data.value[2] //
// // return value.data.areaCount// // // return value.data.areaCount//
// } // }
// } // }
// }, // },
// itemStyle: { // itemStyle: {
// normal: { // normal: {
// opacity: 1, // opacity: 1,
// borderColor: '#fa3008', // borderColor: '#fa3008',
// borderWidth: 1, // borderWidth: 1,
// color: '#d800ff' // color: '#d800ff'
// // color: '#D8BC37' // // // color: '#D8BC37' //
// } // }
// }, // },
// data: this.chartDatas2, // data: this.chartDatas2,
// showEffectOn: 'render', // showEffectOn: 'render',
// rippleEffect: { // rippleEffect: {
// brushType: 'stroke' // brushType: 'stroke'
// }, // },
// hoverAnimation: true, // hoverAnimation: true,
// zlevel: 1 // zlevel: 1
// } // }
// { // {
// data: [ // data: [
// { name: '', value: [114.921027, 37.618956, 56] }, // { name: '', value: [114.921027, 37.618956, 56] },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '鹿', value: 0 }, // { name: '鹿', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '广', value: 0 }, // { name: '广', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '西', value: 0 }, // { name: '西', value: 0 },
// { name: '', value: 0 }, // { name: '', value: 0 },
// { name: '', value: 0 } // { name: '', value: 0 }
// ], // ],
// name: '', // name: '',
// type: 'effectScatter', // type: 'effectScatter',
// coordinateSystem: 'geo', // coordinateSystem: 'geo',
// // symbol: 'pin', // // // symbol: 'pin', //
// symbolSize: 20, // symbolSize: 20,
// label: { // label: {
// normal: { // normal: {
// show: true, // show: true,
// formatter: function(params) { // formatter: function(params) {
// return params.data.value[2] // return params.data.value[2]
// }, // },
// textStyle: { // textStyle: {
// color: '#fff', // color: '#fff',
// fontSize: 9 // fontSize: 9
// } // }
// } // }
// }, // },
// itemStyle: { // itemStyle: {
// normal: { // normal: {
// color: '#F62157' // '#F62157' // color: '#F62157' // '#F62157'
// } // }
// }, // },
// zlevel: 6 // zlevel: 6
// } // }
], ],
animation: true animation: true
} }
myChart.setOption(option) myChart.setOption(option)
myChart.hideLoading() myChart.hideLoading()
myChart.on('click', function(params) { myChart.on('click', function (params) {
var areaCode = params.data.county.areaCode var areaCode = params.data.county.areaCode
var name = params.name var name = params.name
var jwd = params.data.county.jwd var jwd = params.data.county.jwd
_self.$router.push({ _self.$router.push({
path: '/kanban/jujiayanglao2', path: '/kanban/jujiayanglao2',
query: { name: name, areaCode: areaCode, jwd: jwd } query: { name: name, areaCode: areaCode, jwd: jwd }
})
}) })
}) setTimeout(() => {
setTimeout(() => { myChart.resize()
myChart.resize() // alert('ok')
// alert('ok') }, 800)
}, 800)
var _this = this var _this = this
var isSet = true // var isSet = true //
_this.charPie3currentIndex = 0 _this.charPie3currentIndex = 0
// 2 // 2
this.chart.on('mouseover', function(param) { this.chart.on('mouseover', function (param) {
isSet = false isSet = false
// //
_this.chart.dispatchAction({ _this.chart.dispatchAction({
type: 'downplay', type: 'downplay',
seriesIndex: 0 seriesIndex: 0
// dataIndex: _this.charPie3currentIndex // dataIndex: _this.charPie3currentIndex
})
//
_this.chart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: param.dataIndex
})
// tooltip
_this.chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: param.dataIndex
})
}) })
// // 3
_this.chart.dispatchAction({ var chartHover = function () {
type: 'highlight', _this.dataLen = option.series[0].data.length
seriesIndex: 0, //
dataIndex: param.dataIndex _this.chart.dispatchAction({
}) type: 'downplay',
// tooltip seriesIndex: 0
_this.chart.dispatchAction({ // dataIndex: _this.charPie3currentIndex
type: 'showTip', })
seriesIndex: 0, _this.charPie3currentIndex =
dataIndex: param.dataIndex (_this.charPie3currentIndex + 1) % _this.dataLen
}) //
}) _this.chart.dispatchAction({
// 3 type: 'highlight',
var chartHover = function() { seriesIndex: 0,
_this.dataLen = option.series[0].data.length dataIndex: _this.charPie3currentIndex
// })
_this.chart.dispatchAction({ // tooltip
type: 'downplay', _this.chart.dispatchAction({
seriesIndex: 0 type: 'showTip',
// dataIndex: _this.charPie3currentIndex seriesIndex: 0,
}) dataIndex: _this.charPie3currentIndex
_this.charPie3currentIndex = })
(_this.charPie3currentIndex + 1) % _this.dataLen }
// clearInterval(_this.startCharts)
_this.chart.dispatchAction({ _this.startCharts = setInterval(chartHover, 2000)
type: 'highlight', // 4
seriesIndex: 0, this.chart.on('mouseout', function (param) {
dataIndex: _this.charPie3currentIndex if (!isSet) {
}) clearInterval(_this.startCharts)
// tooltip _this.startCharts = setInterval(chartHover, 2000)
_this.chart.dispatchAction({ isSet = true
type: 'showTip', }
seriesIndex: 0,
dataIndex: _this.charPie3currentIndex
}) })
} }
clearInterval(_this.startCharts)
_this.startCharts = setInterval(chartHover, 2000)
// 4
this.chart.on('mouseout', function(param) {
if (!isSet) {
clearInterval(_this.startCharts)
_this.startCharts = setInterval(chartHover, 2000)
isSet = true
}
})
} }
} }
} </script>
</script>
Loading…
Cancel
Save