路线图更新动态数据解析

qianming 3 years ago
parent d222e26c54
commit 1c9b5b26a5

@ -110,6 +110,7 @@ export default {
// widge-table 表格(数据不要转) // widge-table 表格(数据不要转)
// widget-stackchart 堆叠图 // widget-stackchart 堆叠图
// widget-heatmap 热力图 // widget-heatmap 热力图
// widget-mapline 中国地图-路线图
const chartType = params.chartType const chartType = params.chartType
if ( if (
chartType == "widget-barchart" || chartType == "widget-barchart" ||
@ -128,6 +129,8 @@ export default {
return this.stackChartFn(params.chartProperties, data) return this.stackChartFn(params.chartProperties, data)
} else if (chartType == "widget-coord") { } else if (chartType == "widget-coord") {
return this.coordChartFn(params.chartProperties, data) return this.coordChartFn(params.chartProperties, data)
} else if (chartType == "widget-mapline") {
return this.maplineChartFn(params.chartProperties, data)
} else { } else {
return data return data
} }
@ -247,6 +250,25 @@ export default {
ananysicData["series"] = series; ananysicData["series"] = series;
return ananysicData; return ananysicData;
}, },
// 中国地图。路线图数据解析适合source、target、value
maplineChartFn(chartProperties, data) {
const ananysicData = [];
for (let i = 0; i < data.length; i++) {
const obj = {};
for (const key in chartProperties) {
const value = chartProperties[key];
if (value === "source") {
obj["source"] = data[i][key];
} else if (value === "target") {
obj["target"] = data[i][key];
} else {
obj["value"] = data[i][key];
}
}
ananysicData.push(obj);
}
return ananysicData;
},
setUnique(arr) { setUnique(arr) {
let newArr = []; let newArr = [];
arr.forEach(item => { arr.forEach(item => {

@ -207,7 +207,6 @@ export default {
orient: 'vertical', orient: 'vertical',
top: 'bottom', top: 'bottom',
left: 'right', left: 'right',
//data:[' Top10', ' Top10', '广 Top10'],
textStyle: { textStyle: {
color: '#fff' color: '#fff'
}, },
@ -268,6 +267,7 @@ export default {
}, },
lineStyle: { lineStyle: {
normal: { normal: {
// + 线
color: '#ffa022', color: '#ffa022',
width: 1, width: 1,
opacity: 0.4, opacity: 0.4,
@ -296,6 +296,7 @@ export default {
}, },
itemStyle: { itemStyle: {
normal: { normal: {
//
color: '#46bee9' color: '#46bee9'
} }
}, },
@ -356,16 +357,6 @@ export default {
} }
return res; return res;
}, },
transData(data) {
let res = [];
for (let i = 0; i < data.length; i++) {
res.push({
name: data[i].target,
value: data[i].value,
})
}
return res;
},
editorOptions() { editorOptions() {
this.setOptionsTitle(); this.setOptionsTitle();
this.setOptionsData(); this.setOptionsData();
@ -407,8 +398,7 @@ export default {
name: dataItem.target, name: dataItem.target,
value: geoCoordMap[dataItem.target].concat([dataItem.value]) value: geoCoordMap[dataItem.target].concat([dataItem.value])
} }
}), });
console.log(series)
}, },
dynamicDataFn(val, refreshTime) { dynamicDataFn(val, refreshTime) {
if (!val) return; if (!val) return;

Loading…
Cancel
Save