堆叠图显示问题修复

isqianming 3 years ago
parent be07c66c6d
commit 6956310442

@ -106,7 +106,6 @@ export default {
analysisChartsData(params, data) { analysisChartsData(params, data) {
// widget-barchart 柱线图、widget-linechart 折线图、 widget-barlinechart 柱线图 // widget-barchart 柱线图、widget-linechart 折线图、 widget-barlinechart 柱线图
// widget-piechart 饼图、widget-funnel 漏斗图 // widget-piechart 饼图、widget-funnel 漏斗图
// widget-gauge 仪表盘
// widget-text 文本框 // widget-text 文本框
// widge-table 表格(数据不要转) // widge-table 表格(数据不要转)
// widget-stackchart 堆叠图 // widget-stackchart 堆叠图
@ -170,28 +169,8 @@ export default {
const dataField = Object.keys(chartProperties)[types.indexOf('bar')] const dataField = Object.keys(chartProperties)[types.indexOf('bar')]
//x轴数值去重y轴去重 //x轴数值去重y轴去重
const xAxisList = this.setUnique(data.map(item => item[xAxisField])) const xAxisList = this.setUnique(data.map(item => item[xAxisField]))
console.log(xAxisList)
const yAxisList = this.setUnique(data.map(item => item[yAxisField])) const yAxisList = this.setUnique(data.map(item => item[yAxisField]))
console.log(yAxisList) const dataGroup = this.setGroupBy(data, yAxisField)
for (const i in yAxisList) {
const dataArray = new Array(yAxisList.length).fill(0)
for (const j in xAxisList) {
for (const k in data) {
if (data[k][xAxisField] == yAxisList[i] ) {
if (data[k][xAxisField] == xAxisList[j]) {
dataArray[j] = data[k][dataField]
}
}
}
}
series.push({
name: yAxisList[i],
type: "bar",
data: dataArray,
})
}
console.log(series)
/* const dataGroup = this.setGroupBy(data, yAxisField)
for (const key in chartProperties) { for (const key in chartProperties) {
if (chartProperties[key] !== 'yAxis' && !chartProperties[key].startsWith('xAxis')) { if (chartProperties[key] !== 'yAxis' && !chartProperties[key].startsWith('xAxis')) {
Object.keys(dataGroup).forEach(item => { Object.keys(dataGroup).forEach(item => {
@ -206,7 +185,7 @@ export default {
}) })
}) })
} }
}*/ }
ananysicData["xAxis"] = xAxisList; ananysicData["xAxis"] = xAxisList;
ananysicData["series"] = series; ananysicData["series"] = series;
return ananysicData; return ananysicData;
@ -228,25 +207,6 @@ export default {
} }
return ananysicData; return ananysicData;
}, },
/*gaugeFn(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 === "name") {
obj["name"] = data[i][key];
} else {
obj["value"] = data[i][key];
}
}
if (!obj["unit"]) {
obj["unit"] = "%";
}
ananysicData.push(obj);
}
return ananysicData[0];
},*/
widgettext(chartProperties, data) { widgettext(chartProperties, data) {
const ananysicData = []; const ananysicData = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {

@ -594,10 +594,8 @@ export const widgetBarStack = {
{"axis":"2021-07-25","name":"A","data":"12"}, {"axis":"2021-07-25","name":"A","data":"12"},
{"axis":"2021-07-25","name":"B","data":"20"}, {"axis":"2021-07-25","name":"B","data":"20"},
{"axis":"2021-07-26","name":"B","data":"5"}, {"axis":"2021-07-26","name":"B","data":"5"},
{"axis":"2021-07-26","name":"C","data":"20"},
{"axis":"2021-07-27","name":"A","data":"15"}, {"axis":"2021-07-27","name":"A","data":"15"},
{"axis":"2021-07-27","name":"B","data":"30"}, {"axis":"2021-07-27","name":"B","data":"30"},
{"axis":"2021-07-27","name":"C","data":"5"}
], ],
}, },
{ {

@ -614,10 +614,8 @@ export const widgetLineStack = {
{"axis":"2021-07-25","name":"A","data":"12"}, {"axis":"2021-07-25","name":"A","data":"12"},
{"axis":"2021-07-25","name":"B","data":"20"}, {"axis":"2021-07-25","name":"B","data":"20"},
{"axis":"2021-07-26","name":"B","data":"5"}, {"axis":"2021-07-26","name":"B","data":"5"},
{"axis":"2021-07-26","name":"C","data":"20"},
{"axis":"2021-07-27","name":"A","data":"15"}, {"axis":"2021-07-27","name":"A","data":"15"},
{"axis":"2021-07-27","name":"B","data":"30"}, {"axis":"2021-07-27","name":"B","data":"30"},
{"axis":"2021-07-27","name":"C","data":"5"}
], ],
}, },
{ {

Loading…
Cancel
Save