This commit is contained in:
satori 2024-12-07 07:45:46 +08:00
parent 8c54737e5f
commit 0dcdcfa256

View File

@ -12,6 +12,9 @@
background: #fafafa; background: #fafafa;
border-radius: .5rem; border-radius: .5rem;
border-spacing: 10px; border-spacing: 10px;
font-feature-settings: normal;
font-family: ui-sans-serif, -apple-system, system-ui, Segoe UI, Helvetica, Apple Color Emoji, Arial, sans-serif, Segoe UI Emoji, Segoe UI Symbol;
font-variation-settings: normal;
} }
</style> </style>
</head> </head>
@ -22,7 +25,10 @@
import { createElement, div, table, thead, tbody, tr, th, td } from '@laniakeasupercluster/widgets' import { createElement, div, table, thead, tbody, tr, th, td } from '@laniakeasupercluster/widgets'
const rest = await fetch('http://localhost:2000/api').then(res => res.json()) const rest = await fetch('http://localhost:2000/api').then(res => res.json())
document.body.appendChild(div.childs([ const metrics = await fetch('http://localhost:2000/api/metrics').then(res => res.json())
const context = createElement({ width: '1000px', height: '300px' }, 'canvas')
document.body.appendChild(div.w(1000).childs([
table.childs([ table.childs([
thead.childs([ thead.childs([
tr.childs([ tr.childs([
@ -44,11 +50,11 @@
td.text(row.shuju) td.text(row.shuju)
])) ]))
) )
]) ]),
context
])) ]))
const metrics = await fetch('http://localhost:2000/api/metrics').then(res => res.json())
const context = createElement({ width: 800, height: 200 }, 'canvas')
new Chart(context, { new Chart(context, {
type: 'line', type: 'line',
@ -71,8 +77,6 @@
} }
}) })
document.body.appendChild(context)
</script> </script>
</body> </body>