← Files DataARCHIVED FILE

templates/data-app/base/src/charting/chart-overrides.js

601 Bytes · Sep 30, 2026 · 23:19 UTC

↓ Download file

import { chartDataInputKeys } from "./chart-data-shape.js";

/** Saved settings are complete snapshots. Reviewed inputs stay current with the rows. */
export function resolveChartSpec(authored, saved, dataInputs) {
  if (saved == null && dataInputs == null) return authored;
  const chart = { ...(saved ?? authored) };
  // Older apps put these data inputs in spec. Preserve that API without merging settings.
  for (const inputs of [authored, dataInputs]) {
    for (const key of chartDataInputKeys) {
      if (Object.hasOwn(inputs ?? {}, key)) chart[key] = inputs[key];
    }
  }
  return chart;
}

SHA-256: 09e15338c86d93f7fb9845757d0ba223f71705d540ec467c18d32df7b10bb8f9