dev-QQq
方佳 博 2 years ago
parent fc94993f7f
commit 7b2d8f7c8e

@ -395,7 +395,6 @@ onMounted(() => {
var chartDom = document.getElementById("main");
var chartDom2 = document.getElementById("main2");
myChart = echarts.init(chartDom);
472;
myChart2 = echarts.init(chartDom2);
//
var option = {

@ -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("请模型参数进行设置!");
}

Loading…
Cancel
Save