htmlewislulu-html-ppt-skill/templates/single-page/chart-radar.html

32 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="utf-8"><title>Chart · Radar</title>
<link rel="stylesheet" href="../../assets/fonts.css">
<link rel="stylesheet" href="../../assets/base.css">
<link rel="stylesheet" id="theme-link" href="../../assets/themes/minimal-white.css">
<link rel="stylesheet" href="../../assets/animations/animations.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
</head><body class="single">
<div class="deck"><section class="slide is-active" data-title="Radar chart">
<p class="kicker">Chart · 雷达图</p>
<h2 class="h2">把 html-ppt 和竞品放一张图</h2>
<div class="card mt-l" style="height:520px;padding:28px"><canvas id="c"></canvas></div>
<script>
addEventListener('DOMContentLoaded',()=>{
const css=getComputedStyle(document.documentElement);
const a1=css.getPropertyValue('--accent').trim();
const a2=css.getPropertyValue('--accent-2').trim();
const text2=css.getPropertyValue('--text-2').trim();
new Chart(document.getElementById('c'),{type:'radar',
data:{labels:['上手','美观','自定义','性能','导出','生态'],
datasets:[
{label:'html-ppt',data:[9,9,10,10,9,6],borderColor:a1,backgroundColor:a1+'33',borderWidth:3,pointRadius:5},
{label:'reveal.js',data:[8,7,9,8,8,10],borderColor:a2,backgroundColor:a2+'22',borderWidth:3,pointRadius:5}]},
options:{plugins:{legend:{labels:{color:text2}}},
scales:{r:{suggestedMin:0,suggestedMax:10,ticks:{color:text2,backdropColor:'transparent'},
pointLabels:{color:text2,font:{size:14}},grid:{color:'rgba(0,0,0,.08)'},angleLines:{color:'rgba(0,0,0,.08)'}}}}});
});
</script>
</section></div>
<script src="../../assets/runtime.js"></script>
</body></html>