Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
update
Browse files204 unmodified lines205206207208209210211212213214215216217204 unmodified lines}/*** Prepare data for hover tooltip*/prepareHoverData(series, nearestStep, normalizeY, isAccuracy) {const entries = series.map(s => {const m = new Map(s.values.map(v => [v.step, v]));const pt = m.get(nearestStep);return { run: s.run, color: s.color, pt };}).filter(e => e.pt && e.pt.value != null).sort((a, b) => a.pt.value - b.pt.value);204 unmodified lines205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248204 unmodified lines}/*** Prepare data for hover tooltip with interpolation for missing points*/prepareHoverData(series, nearestStep, normalizeY, isAccuracy) {const entries = series.map(s => {const values = s.values.sort((a, b) => a.step - b.step);const m = new Map(values.map(v => [v.step, v]));let pt = m.get(nearestStep);// If no exact point, interpolate from surrounding pointsif (!pt) {// Find the two closest points (one before, one after)let before = null;let after = null;for (let i = 0; i < values.length; i++) {if (values[i].step < nearestStep) {before = values[i];} else if (values[i].step > nearestStep && !after) {after = values[i];break;}}// Interpolate if we have both surrounding pointsif (before && after) {const ratio = (nearestStep - before.step) / (after.step - before.step);const interpolatedValue = before.value + ratio * (after.value - before.value);pt = { step: nearestStep, value: interpolatedValue };} else if (before) {// Use the last known valuept = before;} else if (after) {// Use the first known valuept = after;}}return { run: s.run, color: s.color, pt, hasExactPoint: !!m.get(nearestStep) };}).filter(e => e.pt && e.pt.value != null).sort((a, b) => a.pt.value - b.pt.value);
app/src/components/trackio/renderers/core/interaction-manager.js+35-4