Add sign status for Lagrange.Core

This commit is contained in:
远野千束 2024-05-11 01:00:13 +08:00
parent f22f8f772a
commit 7fbfafe2db

View File

@ -12,6 +12,16 @@ data.forEach((item) => {
document.body.appendChild(signChartDiv) document.body.appendChild(signChartDiv)
let signChart = echarts.init(document.getElementById(chartID)) let signChart = echarts.init(document.getElementById(chartID))
let timeCount = []
item["counts"].forEach((count, index) => {
// 计算平均值index - 1的count + index的count + index + 1的count /3
if (index > 0) {
timeCount.push((item["counts"][index] - item["counts"][index - 1]))
}
})
console.log(timeCount)
signChart.setOption( signChart.setOption(
{ {
@ -26,14 +36,26 @@ data.forEach((item) => {
type: 'category', type: 'category',
data: item["times"].map(timestampToTime), data: item["times"].map(timestampToTime),
}, },
yAxis: { yAxis: [
type: 'value', {
min: Math.min(...item["counts"]), type: 'value',
}, min: Math.min(...item["counts"]),
},
{
type: 'value',
min: Math.min(...timeCount),
}
],
series: [ series: [
{ {
data: item["counts"], data: item["counts"],
type: 'line' type: 'line',
yAxisIndex: 0
},
{
data: timeCount,
type: 'line',
yAxisIndex: 1
} }
] ]
} }