<td>2024</td> <td>18.25</td> <td>8.1</td> <td>预测数据</td> </tr> </tbody> </table> <div class="note"> 注:2024年数据为预测值,来源:中国电子商务研究中心 </div> <div class="footer"> © 2024 中国电子商务数据分析报告 | 数据更新时间:2024年1月 </div> </div> <script> // 市场规规模数据 const years = ['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024']; const marketSizeData = [5.16, 6.53, 7.85, 9.01, 11.76, 13.79, 15.42, 16.88, 18.25]; const growthRateData = [26.2, 26.5, 20.2, 14.8, 30.5, 17.3, 11.8, 9.5, 8.1]; // 市场规模图表 const marketSizeCtx = document.getElementById('marketSizeChart').getContext('2d'); const marketSizeChart = new Chart(marketSizeCtx, { type: 'bar', data: { labels: years, datasets: [{ label: '市场规模(万亿元)', data: marketSizeData, backgroundColor: 'rgba(52, 152, 219, 0.7)', borderColor: 'rgba(52, 152, 219, 1)', borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { title: { display: true, text: '中国互联网电商市场规模(2016-2024)', font: { size: 16 } }, tooltip: { callbacks: { label: function(context) { return context.dataset.label + ': ' + context.raw + '万亿元'; } } } }, scales: { y: { beginAtZero: true, title: { display: true, text: '市场规模(万亿元)' } } } } }); // 增长率图表 const growthRateCtx = document.getElementById('growthRateChart').getContext('2d'); const growthRateChart = new Chart(growthRateCtx, { type: 'line', data: { labels: years, datasets: [{ label: '增长率(%)', data: growthRateData, backgroundColor: 'rgba(231, 76, 60, 0.2)', borderColor: 'rgba(231, 76, 60, 1)', borderWidth: 3, tension: 0.3, fill: true }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { title: { display: true, text: '中国互联网电商市场增长率(2016-2024)', font: { size: 16 } }, tooltip: { callbacks: { label: function(context) { return context.dataset.label + ': ' + context.raw + '%'; } } } }, scales: { y: { beginAtZero: true, title: { display: true, text: '增长率(%)' } } } } }); </script> </body> </html> 代码逻辑检查点: 1. 数据数组长度需要与年份数组长度一致,否则图表会显示异常 2. 2024年数据标记为预测值,应在图表中有视觉区分 3. 移动端响应式设计需要测试不同屏幕尺寸下的显示效果 [2025-05-23 13:21:01 | AI写代码神器 | 897点数解答]