Files
zszq-trs/YLErpWeb/wwwroot/Statics/html/PvLifeChart.html
T
2024-05-09 14:06:26 +08:00

59 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>组合Pv曲线</title>
<script type="text/javascript" src="../../Statics/libs/echarts/echarts.min.js"></script>
<script type="text/javascript" src="../../Statics/libs/echarts/echarts-gl.min.js"></script>
</head>
<body>
<div>
<h3 style="text-align:center">组合Pv曲线</h3>
<div id="PvLifeChart" style="height:400px;width:700px;margin:0 auto"></div>
</div>
</body>
<script type="text/javascript">
var line = JSON.parse(window.sessionStorage.getItem("pricing_life_lines"));
if (line) {
var myChart = echarts.init(document.getElementById('PvLifeChart'));
var option = {
xAxis: {
type: 'value',
min: line[0][0].X,
max: line[0][line[0].length - 1].X
},
yAxis: {
type: 'value'
},
series: [{
name: 'Pv',
type: 'line',
symbol: 'none',
smooth: true
}, {
name: 'Payoff',
type: 'line',
symbol: 'none',
}, {
name: 'Pv t/2',
type: 'line',
symbol: 'none',
smooth: true
}],
legend: {
data: ['Pv', 'Pv t/2', 'Payoff']
},
};
for (var i = 0; i < 3; ++i) {
option.series[i].data = [];
for (var j = 0; j < line[i].length; ++j) {
option.series[i].data.push([line[i][j].X.toFixed(2), line[i][j].Y.toFixed(2)]);
}
}
myChart.clear();
myChart.setOption(option);
}
</script>
</html>