MCPcopy
hub / github.com/ChartGPU/ChartGPU / updateCharts

Function updateCharts

examples/data-update-animation/main.ts:198–217  ·  view source on GitHub ↗
(source: 'auto' | 'manual')

Source from the content-addressed store, hash-verified

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', () => {

Callers 1

mainFunction · 0.85

Calls 9

createRngFunction · 0.85
makeCartesianDataFunction · 0.85
makePieDataFunction · 0.85
createAnimationConfigFunction · 0.85
createCartesianOptionsFunction · 0.85
createPieOptionsFunction · 0.85
setStatusFunction · 0.85
clampFunction · 0.70
setOptionMethod · 0.65

Tested by

no test coverage detected