diff --git a/liteyuki/resources/lagrange_sign/templates/js/sign_status.js b/liteyuki/resources/lagrange_sign/templates/js/sign_status.js index 2452ce27..2d957d64 100644 --- a/liteyuki/resources/lagrange_sign/templates/js/sign_status.js +++ b/liteyuki/resources/lagrange_sign/templates/js/sign_status.js @@ -12,6 +12,16 @@ data.forEach((item) => { document.body.appendChild(signChartDiv) 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( { @@ -26,14 +36,26 @@ data.forEach((item) => { type: 'category', data: item["times"].map(timestampToTime), }, - yAxis: { - type: 'value', - min: Math.min(...item["counts"]), - }, + yAxis: [ + { + type: 'value', + min: Math.min(...item["counts"]), + }, + { + type: 'value', + min: Math.min(...timeCount), + } + ], series: [ { data: item["counts"], - type: 'line' + type: 'line', + yAxisIndex: 0 + }, + { + data: timeCount, + type: 'line', + yAxisIndex: 1 } ] }