|
|
@ -112,6 +112,7 @@ export default {
|
|
|
|
// widget-heatmap 热力图
|
|
|
|
// widget-heatmap 热力图
|
|
|
|
// widget-mapline 中国地图-路线图
|
|
|
|
// widget-mapline 中国地图-路线图
|
|
|
|
// widget-radar 雷达图
|
|
|
|
// widget-radar 雷达图
|
|
|
|
|
|
|
|
// widget-select 下拉框
|
|
|
|
const chartType = params.chartType
|
|
|
|
const chartType = params.chartType
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
chartType == "widget-barchart" ||
|
|
|
|
chartType == "widget-barchart" ||
|
|
|
@ -134,13 +135,15 @@ export default {
|
|
|
|
return this.linemapChartFn(params.chartProperties, data)
|
|
|
|
return this.linemapChartFn(params.chartProperties, data)
|
|
|
|
} else if (chartType == "widget-radar") {
|
|
|
|
} else if (chartType == "widget-radar") {
|
|
|
|
return this.radarChartFn(params.chartProperties, data)
|
|
|
|
return this.radarChartFn(params.chartProperties, data)
|
|
|
|
|
|
|
|
} else if (chartType == "widget-select") {
|
|
|
|
|
|
|
|
return this.selectChartFn(params.chartProperties, data)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 柱状图、折线图、柱线图
|
|
|
|
// 柱状图、折线图、柱线图
|
|
|
|
barOrLineChartFn(chartProperties, data) {
|
|
|
|
barOrLineChartFn(chartProperties, data) {
|
|
|
|
const ananysicData = {};
|
|
|
|
const analysisData = {};
|
|
|
|
const xAxisList = [];
|
|
|
|
const xAxisList = [];
|
|
|
|
const series = [];
|
|
|
|
const series = [];
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
for (const key in chartProperties) {
|
|
|
@ -163,13 +166,13 @@ export default {
|
|
|
|
series.push(obj);
|
|
|
|
series.push(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData["xAxis"] = xAxisList;
|
|
|
|
analysisData["xAxis"] = xAxisList;
|
|
|
|
ananysicData["series"] = series;
|
|
|
|
analysisData["series"] = series;
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//堆叠图
|
|
|
|
//堆叠图
|
|
|
|
stackChartFn(chartProperties, data) {
|
|
|
|
stackChartFn(chartProperties, data) {
|
|
|
|
const ananysicData = {};
|
|
|
|
const analysisData = {};
|
|
|
|
const series = [];
|
|
|
|
const series = [];
|
|
|
|
//全部字段字典值
|
|
|
|
//全部字段字典值
|
|
|
|
const types = Object.values(chartProperties)
|
|
|
|
const types = Object.values(chartProperties)
|
|
|
@ -196,13 +199,13 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData["xAxis"] = xAxisList;
|
|
|
|
analysisData["xAxis"] = xAxisList;
|
|
|
|
ananysicData["series"] = series;
|
|
|
|
analysisData["series"] = series;
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 饼图、漏斗图
|
|
|
|
// 饼图、漏斗图
|
|
|
|
piechartFn(chartProperties, data) {
|
|
|
|
piechartFn(chartProperties, data) {
|
|
|
|
const ananysicData = [];
|
|
|
|
const analysisData = [];
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
const obj = {};
|
|
|
|
const obj = {};
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
for (const key in chartProperties) {
|
|
|
@ -213,12 +216,12 @@ export default {
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData.push(obj);
|
|
|
|
analysisData.push(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
widgettext(chartProperties, data) {
|
|
|
|
widgettext(chartProperties, data) {
|
|
|
|
const ananysicData = [];
|
|
|
|
const analysisData = [];
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
const obj = {};
|
|
|
|
const obj = {};
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
for (const key in chartProperties) {
|
|
|
@ -228,13 +231,13 @@ export default {
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData.push(obj);
|
|
|
|
analysisData.push(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 坐标系数据解析
|
|
|
|
// 坐标系数据解析
|
|
|
|
coordChartFn(chartProperties, data) {
|
|
|
|
coordChartFn(chartProperties, data) {
|
|
|
|
const ananysicData = {};
|
|
|
|
const analysisData = {};
|
|
|
|
let series = [];
|
|
|
|
let series = [];
|
|
|
|
//全部字段字典值
|
|
|
|
//全部字段字典值
|
|
|
|
const types = Object.values(chartProperties)
|
|
|
|
const types = Object.values(chartProperties)
|
|
|
@ -245,17 +248,17 @@ export default {
|
|
|
|
//x轴数值去重,y轴去重
|
|
|
|
//x轴数值去重,y轴去重
|
|
|
|
const xAxisList = this.setUnique(data.map(item => item[xAxisField]))
|
|
|
|
const xAxisList = this.setUnique(data.map(item => item[xAxisField]))
|
|
|
|
const yAxisList = this.setUnique(data.map(item => item[yAxisField]))
|
|
|
|
const yAxisList = this.setUnique(data.map(item => item[yAxisField]))
|
|
|
|
ananysicData["xAxis"] = xAxisList;
|
|
|
|
analysisData["xAxis"] = xAxisList;
|
|
|
|
ananysicData["yAxis"] = yAxisList;
|
|
|
|
analysisData["yAxis"] = yAxisList;
|
|
|
|
for (const i in data) {
|
|
|
|
for (const i in data) {
|
|
|
|
series[i] = [data[i][xAxisField], data[i][yAxisField], data[i][dataField]];
|
|
|
|
series[i] = [data[i][xAxisField], data[i][yAxisField], data[i][dataField]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData["series"] = series;
|
|
|
|
analysisData["series"] = series;
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 中国地图。路线图数据解析,适合source、target、value
|
|
|
|
// 中国地图。路线图数据解析,适合source、target、value
|
|
|
|
linemapChartFn(chartProperties, data) {
|
|
|
|
linemapChartFn(chartProperties, data) {
|
|
|
|
const ananysicData = [];
|
|
|
|
const analysisData = [];
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
const obj = {};
|
|
|
|
const obj = {};
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
for (const key in chartProperties) {
|
|
|
@ -268,12 +271,13 @@ export default {
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
obj["value"] = data[i][key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ananysicData.push(obj);
|
|
|
|
analysisData.push(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 雷达图
|
|
|
|
radarChartFn(chartProperties, data) {
|
|
|
|
radarChartFn(chartProperties, data) {
|
|
|
|
const ananysicData = {};
|
|
|
|
const analysisData = {};
|
|
|
|
// 字段名
|
|
|
|
// 字段名
|
|
|
|
const radarField = [];
|
|
|
|
const radarField = [];
|
|
|
|
let nameField;
|
|
|
|
let nameField;
|
|
|
@ -286,10 +290,37 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 拿到数值
|
|
|
|
// 拿到数值
|
|
|
|
ananysicData["name"] = nameField;
|
|
|
|
analysisData["name"] = nameField;
|
|
|
|
ananysicData["keys"] = radarField;
|
|
|
|
analysisData["keys"] = radarField;
|
|
|
|
ananysicData["value"] = data;
|
|
|
|
analysisData["value"] = data;
|
|
|
|
return ananysicData;
|
|
|
|
return analysisData;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 下拉框
|
|
|
|
|
|
|
|
selectChartFn(chartProperties, data){
|
|
|
|
|
|
|
|
let valueField;
|
|
|
|
|
|
|
|
let labelField;
|
|
|
|
|
|
|
|
for (const key in chartProperties) {
|
|
|
|
|
|
|
|
if (chartProperties[key] == "value") {
|
|
|
|
|
|
|
|
valueField = key;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chartProperties[key] == "label") {
|
|
|
|
|
|
|
|
labelField = key;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (valueField == null && labelField != null) {
|
|
|
|
|
|
|
|
valueField = labelField;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (labelField == null && valueField != null) {
|
|
|
|
|
|
|
|
labelField = valueField
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const analysisData = [];
|
|
|
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
const obj = {};
|
|
|
|
|
|
|
|
obj["value"] = data[i][valueField];
|
|
|
|
|
|
|
|
obj["label"] = data[i][labelField];
|
|
|
|
|
|
|
|
analysisData.push(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return analysisData;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setUnique(arr) {
|
|
|
|
setUnique(arr) {
|
|
|
|
let newArr = [];
|
|
|
|
let newArr = [];
|
|
|
|