| 512 | |
| 513 | // 获取图表设置 |
| 514 | function getChartSettings() { |
| 515 | // 从活跃的图表类型项获取图表类型,而不是从下拉框 |
| 516 | let chartType = 'bar'; // 默认值 |
| 517 | const activeChartTypeItem = document.querySelector('.chart-type-item.active'); |
| 518 | if (activeChartTypeItem) { |
| 519 | chartType = activeChartTypeItem.getAttribute('data-chart-type'); |
| 520 | } |
| 521 | |
| 522 | return { |
| 523 | type: chartType, |
| 524 | title: document.getElementById('chart-title').value, |
| 525 | xAxisLabel: document.getElementById('x-axis-label').value, |
| 526 | yAxisLabel: document.getElementById('y-axis-label').value, |
| 527 | colorScheme: document.getElementById('color-scheme').value, |
| 528 | legendPosition: document.getElementById('legend-position').value, |
| 529 | showGridLines: document.getElementById('show-grid-lines').checked, |
| 530 | animateChart: document.getElementById('animate-chart').checked |
| 531 | }; |
| 532 | } |
| 533 | |
| 534 | // 导出PNG图像 |
| 535 | exportPngBtn.addEventListener('click', function() { |