路线图更新动态数据解析

qianming 3 years ago
parent d222e26c54
commit 1c9b5b26a5

@ -110,6 +110,7 @@ export default {
// widge-table 表格(数据不要转)
// widget-stackchart 堆叠图
// widget-heatmap 热力图
// widget-mapline 中国地图-路线图
const chartType = params.chartType
if (
chartType == "widget-barchart" ||
@ -128,6 +129,8 @@ export default {
return this.stackChartFn(params.chartProperties, data)
} else if (chartType == "widget-coord") {
return this.coordChartFn(params.chartProperties, data)
} else if (chartType == "widget-mapline") {
return this.maplineChartFn(params.chartProperties, data)
} else {
return data
}
@ -247,6 +250,25 @@ export default {
ananysicData["series"] = series;
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) {
let newArr = [];
arr.forEach(item => {

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

Loading…
Cancel
Save