()
| 518 | // ============================================================================ |
| 519 | |
| 520 | async function handleGenerate(): Promise<void> { |
| 521 | const pointCount = parseInt((document.getElementById('pointCount') as HTMLInputElement).value); |
| 522 | const seriesCount = parseInt((document.getElementById('seriesCount') as HTMLInputElement).value); |
| 523 | const dataType = (document.getElementById('dataType') as HTMLSelectElement).value as DataType; |
| 524 | const renderMode = (document.getElementById('renderMode') as HTMLSelectElement).value as RenderMode; |
| 525 | |
| 526 | // Validation |
| 527 | if (!Number.isFinite(pointCount) || pointCount < 1) { |
| 528 | showStatus('Invalid point count', 'error'); |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | // Warning for very large datasets |
| 533 | if (pointCount > 100_000_000) { |
| 534 | showWarningToast( |
| 535 | `⚠️ Generating ${formatNumber(pointCount)} points. This may take a while and consume significant memory.`, |
| 536 | 10000 |
| 537 | ); |
| 538 | } |
| 539 | |
| 540 | if (pointCount > 1_000_000_000) { |
| 541 | showWarningToast( |
| 542 | `🔥 BILLION+ POINTS! This is hardcore. Your system might struggle. Emergency stop is available.`, |
| 543 | 15000 |
| 544 | ); |
| 545 | } |
| 546 | |
| 547 | // Disable buttons during generation |
| 548 | disableAllButtons(); |
| 549 | showStatus('Generating data...', 'warning'); |
| 550 | |
| 551 | try { |
| 552 | // Dispose existing chart |
| 553 | stopStreaming(); |
| 554 | disposeChart(); |
| 555 | clearMetricsDisplay(); |
| 556 | |
| 557 | // Generate data |
| 558 | const startTime = performance.now(); |
| 559 | const data = await generateData(pointCount, dataType, (progress) => { |
| 560 | showStatus(`Generating data... ${(progress * 100).toFixed(0)}%`, 'warning'); |
| 561 | }); |
| 562 | const genTime = performance.now() - startTime; |
| 563 | |
| 564 | showStatus(`Generated ${formatNumber(pointCount)} points in ${formatDuration(genTime)}`, 'success'); |
| 565 | |
| 566 | // Create chart |
| 567 | state.mode = renderMode; |
| 568 | state.dataType = dataType; |
| 569 | state.chart = await createChart(renderMode, dataType, data); |
| 570 | |
| 571 | // Check performance capabilities |
| 572 | const capabilities = state.chart.getPerformanceCapabilities(); |
| 573 | if (capabilities) { |
| 574 | console.log('[ChartGPU] Performance capabilities:', capabilities); |
| 575 | } |
| 576 | |
| 577 | // Subscribe to performance updates |
nothing calls this directly
no test coverage detected