| 1 | <!DOCTYPE html> |
| 2 | <html lang="zh-CN"><head><meta charset="utf-8"><title>Chart · Line</title> |
| 3 | <link rel="stylesheet" href="../../assets/fonts.css"> |
| 4 | <link rel="stylesheet" href="../../assets/base.css"> |
| 5 | <link rel="stylesheet" id="theme-link" href="../../assets/themes/minimal-white.css"> |
| 6 | <link rel="stylesheet" href="../../assets/animations/animations.css"> |
| 7 | <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script> |
| 8 | </head><body class="single"> |
| 9 | <div class="deck"><section class="slide is-active" data-title="Line chart"> |
| 10 | <p class="kicker">Chart · 折线图</p> |
| 11 | <h2 class="h2">日活与留存并排看</h2> |
| 12 | <div class="card mt-l" style="height:520px;padding:28px"><canvas id="c"></canvas></div> |
| 13 | <script> |
| 14 | addEventListener('DOMContentLoaded',()=>{ |
| 15 | const css=getComputedStyle(document.documentElement); |
| 16 | const accent=css.getPropertyValue('--accent').trim(); |
| 17 | const acc2=css.getPropertyValue('--accent-2').trim(); |
| 18 | const text2=css.getPropertyValue('--text-2').trim(); |
| 19 | const border=css.getPropertyValue('--border').trim(); |
| 20 | new Chart(document.getElementById('c'),{type:'line', |
| 21 | data:{labels:['W1','W2','W3','W4','W5','W6','W7','W8','W9','W10','W11','W12'], |
| 22 | datasets:[ |
| 23 | {label:'DAU (K)',data:[12,14,15,19,24,28,33,38,45,51,58,66], |
| 24 | borderColor:accent,backgroundColor:accent+'22',fill:true,tension:.4,borderWidth:3,pointRadius:4}, |
| 25 | {label:'Retention %',data:[38,40,42,45,48,50,53,55,58,60,62,64], |
| 26 | borderColor:acc2,backgroundColor:acc2+'22',fill:true,tension:.4,borderWidth:3,pointRadius:4} |
| 27 | ]}, |
| 28 | options:{plugins:{legend:{labels:{color:text2}}}, |
| 29 | scales:{x:{ticks:{color:text2},grid:{color:border}}, |
| 30 | y:{ticks:{color:text2},grid:{color:border}}}}}); |
| 31 | }); |
| 32 | </script> |
| 33 | </section></div> |
| 34 | <script src="../../assets/runtime.js"></script> |
| 35 | </body></html> |
| 36 |