@opendata-ai/openchart-engine 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -83,6 +83,11 @@ function buildFields(row: DataRow, encoding: Encoding, color?: string): TooltipF
83
83
 
84
84
  /** Determine the title for a tooltip based on encoding. */
85
85
  function getTooltipTitle(row: DataRow, encoding: Encoding): string | undefined {
86
+ // Detail channel provides an explicit label (e.g. district name in scatter)
87
+ if (encoding.detail) {
88
+ return String(row[encoding.detail.field] ?? '');
89
+ }
90
+
86
91
  // For charts with a temporal x-axis, use the date as the title
87
92
  if (encoding.x?.type === 'temporal') {
88
93
  return formatValue(row[encoding.x.field], 'temporal');