图上标注R2和RMSE指标
parent
8022a67f3a
commit
db69c3a73c
|
@ -174,7 +174,7 @@ export default {
|
||||||
tDatas: null,
|
tDatas: null,
|
||||||
midValue: 10,
|
midValue: 10,
|
||||||
erExpression: null,
|
erExpression: null,
|
||||||
erR2: "0.037207",
|
erR2: "r² = 0.037207",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -323,6 +323,10 @@ export default {
|
||||||
}
|
}
|
||||||
// const x_limit = Math.abs(Math.max(...xArr) / xArr.length);
|
// const x_limit = Math.abs(Math.max(...xArr) / xArr.length);
|
||||||
//多项式回归
|
//多项式回归
|
||||||
|
let wcpf = data.map(a=>{
|
||||||
|
return Math.pow((a[1]-a[0]),2)
|
||||||
|
}).reduce((acc, curr) => acc + curr, 0);
|
||||||
|
let rmseValue = "RMSE = "+ Math.sqrt(wcpf/data.length);
|
||||||
let myRegression = this.echartRegression("polynomial", data, 1);
|
let myRegression = this.echartRegression("polynomial", data, 1);
|
||||||
var option = {
|
var option = {
|
||||||
title: {
|
title: {
|
||||||
|
@ -334,6 +338,7 @@ export default {
|
||||||
grid: {
|
grid: {
|
||||||
right: "15%",
|
right: "15%",
|
||||||
bottom: "25%",
|
bottom: "25%",
|
||||||
|
height: "50%",
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -400,7 +405,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
legend: {
|
legend: {
|
||||||
top: 20,
|
top: 50,
|
||||||
right: 45,
|
right: 45,
|
||||||
// selectedMode: false,
|
// selectedMode: false,
|
||||||
data: [
|
data: [
|
||||||
|
@ -408,14 +413,19 @@ export default {
|
||||||
name: "erExpression",
|
name: "erExpression",
|
||||||
icon: "circle",
|
icon: "circle",
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// name: "r2",
|
name: "r2",
|
||||||
// icon: "circle",
|
icon: "circle",
|
||||||
// },
|
},
|
||||||
|
{
|
||||||
|
name:"RMSE",
|
||||||
|
icon: "circle",
|
||||||
|
}
|
||||||
],
|
],
|
||||||
formatter: (name) => {
|
formatter: (name) => {
|
||||||
if (name === "erExpression") return this.erExpression;
|
if (name === "erExpression") return this.erExpression;
|
||||||
else if (name === "r2") return this.erR2;
|
else if (name === "r2") return this.erR2;
|
||||||
|
else if(name ==="RMSE") return rmseValue;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
@ -449,6 +459,12 @@ export default {
|
||||||
type: "scatter",
|
type: "scatter",
|
||||||
data: data,
|
data: data,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "RMSE",
|
||||||
|
symbolSize: 10,
|
||||||
|
type: "scatter",
|
||||||
|
// data: data,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "erExpression",
|
name: "erExpression",
|
||||||
type: "line",
|
type: "line",
|
||||||
|
|
Loading…
Reference in New Issue