mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 21:30:54 +00:00
✨ Add sign status for Lagrange.Core
This commit is contained in:
3
liteyuki/resources/lagrange_sign/metadata.yml
Normal file
3
liteyuki/resources/lagrange_sign/metadata.yml
Normal file
@ -0,0 +1,3 @@
|
||||
name: Sign Status
|
||||
description: for Lagrange
|
||||
version: 2024.4.26
|
@ -0,0 +1,4 @@
|
||||
.sign-chart {
|
||||
height: 400px;
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
}
|
41
liteyuki/resources/lagrange_sign/templates/js/sign_status.js
Normal file
41
liteyuki/resources/lagrange_sign/templates/js/sign_status.js
Normal file
@ -0,0 +1,41 @@
|
||||
// 数据类型声明
|
||||
// import * as echarts from 'echarts';
|
||||
|
||||
let data = JSON.parse(document.getElementById("data").innerText) // object
|
||||
const signChartDivTemplate = document.importNode(document.getElementById("sign-chart-template").content, true)
|
||||
data.forEach((item) => {
|
||||
let signChartDiv = signChartDivTemplate.cloneNode(true)
|
||||
let chartID = item["name"]
|
||||
// 初始化ECharts实例
|
||||
// 设置id
|
||||
signChartDiv.querySelector(".sign-chart").id = chartID
|
||||
document.body.appendChild(signChartDiv)
|
||||
|
||||
let signChart = echarts.init(document.getElementById(chartID))
|
||||
|
||||
signChart.setOption(
|
||||
{
|
||||
animation: false,
|
||||
title: {
|
||||
text: item["name"],
|
||||
textStyle: {
|
||||
color: '#000000' // 设置标题文本颜色为红色
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: item["times"],
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: Math.min(...item["counts"]),
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: item["counts"],
|
||||
type: 'line'
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
})
|
22
liteyuki/resources/lagrange_sign/templates/sign_status.html
Normal file
22
liteyuki/resources/lagrange_sign/templates/sign_status.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Liteyuki Status</title>
|
||||
<link rel="stylesheet" href="./css/card.css">
|
||||
<link rel="stylesheet" href="./css/fonts.css">
|
||||
<link rel="stylesheet" href="./css/sign_status.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<template id="sign-chart-template">
|
||||
<div class="info-box sign-chart">
|
||||
</div>
|
||||
</template>
|
||||
<div class="data-storage" id="data">{{ data | tojson }}</div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js"></script>
|
||||
<script src="./js/sign_status.js"></script>
|
||||
<script src="./js/card.js"></script>
|
||||
</body>
|
Reference in New Issue
Block a user