(source: 'auto' | 'manual')
| 196 | |
| 197 | let step = 0; |
| 198 | const updateCharts = (source: 'auto' | 'manual'): void => { |
| 199 | step++; |
| 200 | const rng = createRng(1000 + step * 97); |
| 201 | |
| 202 | // Make domain changes obvious: vary amplitude and offset. |
| 203 | const phase = step * 0.7; |
| 204 | const amplitude = 0.9 + (step % 4) * 0.65; // 0.9..2.85 |
| 205 | const offset = (step % 2 === 0 ? -0.35 : 0.55) + (rng() - 0.5) * 0.15; |
| 206 | |
| 207 | const cartesianData = makeCartesianData(64, rng, { phase, amplitude, offset }); |
| 208 | const pieSlices = makePieData(rng); |
| 209 | |
| 210 | const animation = createAnimationConfig(toggleAnimate.checked); |
| 211 | |
| 212 | cartesianChart.setOption(createCartesianOptions(cartesianData, animation)); |
| 213 | pieChart.setOption(createPieOptions(pieSlices, animation)); |
| 214 | |
| 215 | const label = toggleAnimate.checked ? 'animated' : 'instant'; |
| 216 | setStatus(`Updated (${source}, ${label}) · step ${step} · amp ${amplitude.toFixed(2)} · offset ${clamp(offset, -5, 5).toFixed(2)}`); |
| 217 | }; |
| 218 | |
| 219 | btnUpdate.addEventListener('click', () => updateCharts('manual')); |
| 220 | toggleAnimate.addEventListener('change', () => { |
no test coverage detected