|
|
|
|
@ -82,7 +82,7 @@
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="main-right">
|
|
|
|
|
<el-scrollbar height="500px" ref="scrollbar" style="padding: 20px">
|
|
|
|
|
<el-scrollbar height="590px" ref="scrollbar" style="padding: 20px">
|
|
|
|
|
<div>
|
|
|
|
|
<span style="font-weight: bold; font-size: 18px; color: #3596eb">分析数据:</span>
|
|
|
|
|
<el-table :data="tableData2" style="width: 98%; margin-top: 10px" :header-cell-style="headerCellStyle" height="350">
|
|
|
|
|
@ -103,6 +103,11 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="pdfRef" id="pdfRef" style="margin-top: 20px; display: flex" v-show="flagUP">
|
|
|
|
|
<div style="background: #ffffff">
|
|
|
|
|
<div id="main" style="width: 550px; height: 500px"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -398,10 +403,83 @@ const handleChange = (info) => {
|
|
|
|
|
fileList.value.push(info);
|
|
|
|
|
};
|
|
|
|
|
const flag = ref(false);
|
|
|
|
|
let myChart;
|
|
|
|
|
const getRandomColorHex = () => {
|
|
|
|
|
const randomValue = (min, max) => {
|
|
|
|
|
// 生成 min 到 max 之间的随机整数
|
|
|
|
|
const value = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
|
|
|
// 将整数转换为两位十六进制形式
|
|
|
|
|
return value.toString(16).padStart(2, "0");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 限制红色通道较低,绿色和蓝色通道较高
|
|
|
|
|
const r = randomValue(0, 128); // 红色通道较低 (0-128)
|
|
|
|
|
const g = randomValue(128, 255); // 绿色通道较高 (128-255)
|
|
|
|
|
const b = randomValue(128, 255); // 蓝色通道较高 (128-255)
|
|
|
|
|
|
|
|
|
|
return `#${r}${g}${b}`;
|
|
|
|
|
};
|
|
|
|
|
//图标添加数据
|
|
|
|
|
const addData = (myChart, newData, color) => {
|
|
|
|
|
// 获取当前的数据
|
|
|
|
|
let currentData = myChart.getOption().series[0].data || [];
|
|
|
|
|
// 添加新数据集,并为每个数据点单独设置颜色
|
|
|
|
|
if(input5.value[0]==="sales_forehead"){
|
|
|
|
|
newData.forEach((dataPoint) => {
|
|
|
|
|
currentData.push({
|
|
|
|
|
value: [dataPoint.sales_forehead, dataPoint.sales_volume],
|
|
|
|
|
itemStyle: { color: color },
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
newData.forEach((dataPoint) => {
|
|
|
|
|
currentData.push({
|
|
|
|
|
value: [dataPoint.sales_volume, dataPoint.sales_forehead],
|
|
|
|
|
itemStyle: { color: color },
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新图表
|
|
|
|
|
myChart.setOption({
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
data: currentData,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList();
|
|
|
|
|
optionData();
|
|
|
|
|
var chartDom = document.getElementById("main");
|
|
|
|
|
myChart = echarts.init(chartDom);
|
|
|
|
|
var option = {
|
|
|
|
|
dataset: [
|
|
|
|
|
{
|
|
|
|
|
source: [], // 初始时数据为空
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
tooltip: {
|
|
|
|
|
position: "top",
|
|
|
|
|
},
|
|
|
|
|
xAxis: {},
|
|
|
|
|
yAxis: {},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: "scatter",
|
|
|
|
|
encode: { tooltip: [0, 1] },
|
|
|
|
|
symbolSize: 8,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
borderColor: "#555",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
// 设置初始的配置
|
|
|
|
|
myChart.setOption(option);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const optionData = () => {
|
|
|
|
|
@ -532,35 +610,6 @@ const computation = () => {
|
|
|
|
|
userId: JSON.parse(getUserInfo()).userId,
|
|
|
|
|
};
|
|
|
|
|
loading1.value = true;
|
|
|
|
|
if (input4.value === "线性回归") {
|
|
|
|
|
if (input5.value.length > 1) {
|
|
|
|
|
proxy.$modal.msgError("y变量数量有误!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (input6.value.length != 2 || input6.value.length > 2) {
|
|
|
|
|
proxy.$modal.msgError("x变量数量有误!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
flagColumn.value = true;
|
|
|
|
|
tableData2.value.forEach((item) => {
|
|
|
|
|
sendData.y.push(item[input5.value[0]]);
|
|
|
|
|
sendData.x.push([item[input6.value[0]], item[input6.value[1]]]);
|
|
|
|
|
});
|
|
|
|
|
API.linearRegression(sendData).then((res) => {
|
|
|
|
|
tableLabel2.length = 0;
|
|
|
|
|
for (const key in res.data) {
|
|
|
|
|
tableLabel2.push({
|
|
|
|
|
label: key,
|
|
|
|
|
prop: key,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
let data = res.data;
|
|
|
|
|
data.slopes = data.slopes.join(",");
|
|
|
|
|
tableData3.value = [data];
|
|
|
|
|
predictionResults.value = "";
|
|
|
|
|
loading1.value = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (input5.value.length > 1) {
|
|
|
|
|
proxy.$modal.msgError("y变量数量有误!");
|
|
|
|
|
return;
|
|
|
|
|
@ -591,7 +640,16 @@ const computation = () => {
|
|
|
|
|
predictionResults.value = "";
|
|
|
|
|
loading1.value = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//表格
|
|
|
|
|
myChart.setOption({
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
data: [], // 清空数据
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
const bgColor = getRandomColorHex();
|
|
|
|
|
addData(myChart,tableData2.value,bgColor)
|
|
|
|
|
} else {
|
|
|
|
|
proxy.$modal.msgWarning("请模型参数进行设置!");
|
|
|
|
|
}
|
|
|
|
|
|