图上标注R2和RMSE指标
parent
8022a67f3a
commit
db69c3a73c
|
@ -174,7 +174,7 @@ export default {
|
|||
tDatas: null,
|
||||
midValue: 10,
|
||||
erExpression: null,
|
||||
erR2: "0.037207",
|
||||
erR2: "r² = 0.037207",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -323,6 +323,10 @@ export default {
|
|||
}
|
||||
// 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);
|
||||
var option = {
|
||||
title: {
|
||||
|
@ -334,6 +338,7 @@ export default {
|
|||
grid: {
|
||||
right: "15%",
|
||||
bottom: "25%",
|
||||
height: "50%",
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
|
@ -400,7 +405,7 @@ export default {
|
|||
},
|
||||
],
|
||||
legend: {
|
||||
top: 20,
|
||||
top: 50,
|
||||
right: 45,
|
||||
// selectedMode: false,
|
||||
data: [
|
||||
|
@ -408,14 +413,19 @@ export default {
|
|||
name: "erExpression",
|
||||
icon: "circle",
|
||||
},
|
||||
// {
|
||||
// name: "r2",
|
||||
// icon: "circle",
|
||||
// },
|
||||
{
|
||||
name: "r2",
|
||||
icon: "circle",
|
||||
},
|
||||
{
|
||||
name:"RMSE",
|
||||
icon: "circle",
|
||||
}
|
||||
],
|
||||
formatter: (name) => {
|
||||
if (name === "erExpression") return this.erExpression;
|
||||
else if (name === "r2") return this.erR2;
|
||||
else if(name ==="RMSE") return rmseValue;
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
|
@ -449,6 +459,12 @@ export default {
|
|||
type: "scatter",
|
||||
data: data,
|
||||
},
|
||||
{
|
||||
name: "RMSE",
|
||||
symbolSize: 10,
|
||||
type: "scatter",
|
||||
// data: data,
|
||||
},
|
||||
{
|
||||
name: "erExpression",
|
||||
type: "line",
|
||||
|
|
Loading…
Reference in New Issue