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>
// import {
// raiseOldWholeData,
// exceptionSituation,
// raiseOldmanSituation,
// weekDayCompare,
// getMapDataTongji,
// bindFuWuLiang
// } from '@/api/tongji/kanBanJuJiaYangLao'
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
// import xt_data from '@/assets///geojson.json'
import xt_data from '@/assets/全国/geojson.json'
export default {
mixins: [resize],
data() {
return {
chartDatas2: [],
chart: null,
startCharts: null,
charPie3currentIndex: 0,
dataLen: 0
}
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
// import {
// raiseOldWholeData,
// exceptionSituation,
// raiseOldmanSituation,
// weekDayCompare,
// getMapDataTongji,
// bindFuWuLiang
// } from '@/api/tongji/kanBanJuJiaYangLao'
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
// import xt_data from '@/assets///geojson.json'
import xt_data from '@/assets/全国/geojson.json'
export default {
mixins: [resize],
data() {
return {
chartDatas2: [],
chart: null,
startCharts: null,
charPie3currentIndex: 0,
dataLen: 0
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
if (this.startCharts) {
clearInterval(this.startCharts)
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
// getMapDataTongji().then(response => {
// if (response.code === 20000) {
// if (
// response.data !== null &&
// response.data !== '' &&
// response.data !== undefined
// ) {
// this.countyData = []
// for (var i = 0; i < response.data.length; i++) {
// var county = response.data[i]
// this.countyData.push({
// name: county.title,
// value: county.departmentCount,
// county: county
// })
// console.log('chartDatas2', this.chartDatas2)
// if (county.title === '') {
// this.chartDatas2.push({
// name: '',
// value: [
// 114.597268,
// 37.096124,
// county.departmentCount,
// county.personCount
// ]
// })
// }
// if (county.title === '') {
// this.chartDatas2.push({
// name: '',
// value: [
// 114.565733,
// 37.06169,
// county.departmentCount,
// county.personCount
// ]
// })
// }
// }
// console.log('chartDatas2aaaa', this.chartDatas2)
var _self = this
const myChart = echarts.init(this.$refs.myEchart) //
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
// }
// }
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
if (this.startCharts) {
clearInterval(this.startCharts)
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
// getMapDataTongji().then(response => {
// if (response.code === 20000) {
// if (
// response.data !== null &&
// response.data !== '' &&
// response.data !== undefined
// ) {
// this.countyData = []
// for (var i = 0; i < response.data.length; i++) {
// var county = response.data[i]
// this.countyData.push({
// name: county.title,
// value: county.departmentCount,
// county: county
// })
// console.log('chartDatas2', this.chartDatas2)
// if (county.title === '') {
// this.chartDatas2.push({
// name: '',
// value: [
// 114.597268,
// 37.096124,
// county.departmentCount,
// county.personCount
// ]
// })
// }
// if (county.title === '') {
// this.chartDatas2.push({
// name: '',
// value: [
// 114.565733,
// 37.06169,
// county.departmentCount,
// county.personCount
// ]
// })
// }
// },
geo: {
show: true,
map: 'xingtai',
roam: false,
label: {
normal: {
show: false
// }
// console.log('chartDatas2aaaa', this.chartDatas2)
var _self = this
const myChart = echarts.init(this.$refs.myEchart) //
this.chart = myChart
window.onresize = myChart.resize
myChart.showLoading()
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: false
}
show: true
},
itemStyle: {
normal: {
areaColor: '#3c8dbc', //
borderColor: '#097bba'
tooltip: {
alwaysShowContent: true,
textStyle: {
fontSize: 12,
color: '#ccc'
},
emphasis: {
areaColor: '#fbd456' //
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,'
)
return (
params.name +
'<br/>仓库数量: ' +
valueStr +
'个'
)
}
}
},
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,
// geo: {
// map: 'xingtai',
// emphasis: {
// label: {
// show: true,
// 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
// },
// },
// label: {
// show: true,
// // formatter: '{b}:{@score}'
// },
// data: this.countyData,
// emphasis: {
// areaColor: '#2AB8FF',
// borderWidth: 1,
// color: 'green',
// label: {
// show: false
// }
// }
// }
// },
{
name: '机构数量',
type: 'map',
roam: false,
geo: {
show: true,
map: 'xingtai',
roam: false,
label: {
show: false
// formatter: '{b}:{@score}'
normal: {
show: false
},
emphasis: {
show: false
}
},
data: this.countyData,
emphasis: {
itemStyle: {
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: {
show: true,
fontSize: 20,
fontWeight: 'bolder'
show: false
// formatter: '{b}:{@score}'
},
itemStyle: {
// borderType: 'solid',
// borderWidth: 3,
// borderColor: '#e83e11',
shadowBlur: 20,
shadowOffsetX: 5,
shadowOffsetY: 5
data: this.countyData,
emphasis: {
label: {
show: true,
fontSize: 20,
fontWeight: 'bolder'
},
itemStyle: {
// borderType: 'solid',
// borderWidth: 3,
// borderColor: '#e83e11',
shadowBlur: 20,
shadowOffsetX: 5,
shadowOffsetY: 5
}
}
}
}
// {
// //
// symbol: 'circle',
// symbolSize: 20,
// label: {
// normal: {
// formatter: '{b}',
// position: 'right',
// show: true
// // textStyle: {
// // color: '#f00',
// // fontSize: 12
// // },
// },
// emphasis: {
// show: true
// }
// },
// itemStyle: {
// color: '#fa3008',
// opacity: 1,
// borderColor: '#9603ea',
// borderWidth: 1
// {
// //
// symbol: 'circle',
// symbolSize: 20,
// label: {
// normal: {
// formatter: '{b}',
// position: 'right',
// show: true
// // textStyle: {
// // color: '#f00',
// // fontSize: 12
// // },
// },
// emphasis: {
// show: true
// }
// },
// itemStyle: {
// color: '#fa3008',
// opacity: 1,
// borderColor: '#9603ea',
// borderWidth: 1
// // normal: {
// // opacity : 1,
// // borderColor: '#fa3008',
// // borderWidth: 1,
// // color: '#ff'
// // }
// },
// name: 'light',
// type: 'scatter',
// coordinateSystem: 'geo',
// data: this.chartDatas2
// },
// {
// //
// name: 'Top 5',
// type: 'scatter',
// coordinateSystem: 'geo',
// // symbol: 'pin',
// // symbolSize: [50, 50],
// symbolOffset: [0, -12],
// symbol: 'image://home/markertu3.png',
// symbolSize: [30, 30],
// label: {
// normal: {
// show: false,
// textStyle: {
// color: '#ff0',
// fontSize: 12
// },
// formatter(value) {
// return value.data.value[2] //
// // return value.data.areaCount//
// }
// }
// },
// itemStyle: {
// normal: {
// opacity: 1,
// borderColor: '#fa3008',
// borderWidth: 1,
// color: '#d800ff'
// // color: '#D8BC37' //
// }
// },
// data: this.chartDatas2,
// showEffectOn: 'render',
// rippleEffect: {
// brushType: 'stroke'
// },
// hoverAnimation: true,
// zlevel: 1
// }
// {
// data: [
// { 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: '',
// type: 'effectScatter',
// coordinateSystem: 'geo',
// // symbol: 'pin', //
// symbolSize: 20,
// label: {
// normal: {
// show: true,
// formatter: function(params) {
// return params.data.value[2]
// },
// textStyle: {
// color: '#fff',
// fontSize: 9
// }
// }
// },
// itemStyle: {
// normal: {
// color: '#F62157' // '#F62157'
// }
// },
// zlevel: 6
// }
],
animation: true
}
myChart.setOption(option)
myChart.hideLoading()
myChart.on('click', function(params) {
var areaCode = params.data.county.areaCode
var name = params.name
var jwd = params.data.county.jwd
_self.$router.push({
path: '/kanban/jujiayanglao2',
query: { name: name, areaCode: areaCode, jwd: jwd }
// // normal: {
// // opacity : 1,
// // borderColor: '#fa3008',
// // borderWidth: 1,
// // color: '#ff'
// // }
// },
// name: 'light',
// type: 'scatter',
// coordinateSystem: 'geo',
// data: this.chartDatas2
// },
// {
// //
// name: 'Top 5',
// type: 'scatter',
// coordinateSystem: 'geo',
// // symbol: 'pin',
// // symbolSize: [50, 50],
// symbolOffset: [0, -12],
// symbol: 'image://home/markertu3.png',
// symbolSize: [30, 30],
// label: {
// normal: {
// show: false,
// textStyle: {
// color: '#ff0',
// fontSize: 12
// },
// formatter(value) {
// return value.data.value[2] //
// // return value.data.areaCount//
// }
// }
// },
// itemStyle: {
// normal: {
// opacity: 1,
// borderColor: '#fa3008',
// borderWidth: 1,
// color: '#d800ff'
// // color: '#D8BC37' //
// }
// },
// data: this.chartDatas2,
// showEffectOn: 'render',
// rippleEffect: {
// brushType: 'stroke'
// },
// hoverAnimation: true,
// zlevel: 1
// }
// {
// data: [
// { 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: '',
// type: 'effectScatter',
// coordinateSystem: 'geo',
// // symbol: 'pin', //
// symbolSize: 20,
// label: {
// normal: {
// show: true,
// formatter: function(params) {
// return params.data.value[2]
// },
// textStyle: {
// color: '#fff',
// fontSize: 9
// }
// }
// },
// itemStyle: {
// normal: {
// color: '#F62157' // '#F62157'
// }
// },
// zlevel: 6
// }
],
animation: true
}
myChart.setOption(option)
myChart.hideLoading()
myChart.on('click', function (params) {
var areaCode = params.data.county.areaCode
var name = params.name
var jwd = params.data.county.jwd
_self.$router.push({
path: '/kanban/jujiayanglao2',
query: { name: name, areaCode: areaCode, jwd: jwd }
})
})
})
setTimeout(() => {
myChart.resize()
// alert('ok')
}, 800)
setTimeout(() => {
myChart.resize()
// alert('ok')
}, 800)
var _this = this
var isSet = true //
_this.charPie3currentIndex = 0
// 2
this.chart.on('mouseover', function(param) {
isSet = false
//
_this.chart.dispatchAction({
type: 'downplay',
seriesIndex: 0
// dataIndex: _this.charPie3currentIndex
var _this = this
var isSet = true //
_this.charPie3currentIndex = 0
// 2
this.chart.on('mouseover', function (param) {
isSet = false
//
_this.chart.dispatchAction({
type: 'downplay',
seriesIndex: 0
// dataIndex: _this.charPie3currentIndex
})
//
_this.chart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: param.dataIndex
})
// tooltip
_this.chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: param.dataIndex
})
})
//
_this.chart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: param.dataIndex
})
// tooltip
_this.chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: param.dataIndex
})
})
// 3
var chartHover = function() {
_this.dataLen = option.series[0].data.length
//
_this.chart.dispatchAction({
type: 'downplay',
seriesIndex: 0
// dataIndex: _this.charPie3currentIndex
})
_this.charPie3currentIndex =
(_this.charPie3currentIndex + 1) % _this.dataLen
//
_this.chart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: _this.charPie3currentIndex
})
// tooltip
_this.chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: _this.charPie3currentIndex
// 3
var chartHover = function () {
_this.dataLen = option.series[0].data.length
//
_this.chart.dispatchAction({
type: 'downplay',
seriesIndex: 0
// dataIndex: _this.charPie3currentIndex
})
_this.charPie3currentIndex =
(_this.charPie3currentIndex + 1) % _this.dataLen
//
_this.chart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: _this.charPie3currentIndex
})
// tooltip
_this.chart.dispatchAction({
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
}
})
}
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