Interactions

Chart-local interaction

Inspect, select, zoom, and legend focus on one plot. Shared semantic state is opt-in via createPlotInteraction. Full prop and event contracts are in the interaction reference and interactions guide.

Interactive series with inspect, select, zoom, and legend focus1.01.01.21.21.41.41.61.61.81.82.02.02.22.22.42.42.62.62.82.83.03.02020303040405050606070708080PeriodValueSeriesAlphaBetaGamma

Use Arrow keys to inspect data. Press Enter or Space to pin. Press Escape to dismiss.

No active datum

0 emphasized · 0 selected Inspect a point, select a region, or focus a legend series.
<script lang="ts">
  import { createPlotInteraction, GeomPoint, GGPlot } from "@ggsvelte/svelte";

  const interaction = createPlotInteraction<string>();
  const scope = { keys: "rows", x: "x", y: "y" } as const;
</script>

<GGPlot
  {interaction}
  interactionScope={scope}
  data={rows}
  key="id"
  aes={{ x: "period", y: "value", color: "series" }}
  inspect
  legendFocus
  select={{ type: "interval", mode: "xy" }}
  zoom={{ mode: "x" }}
>
  <GeomPoint size={4} />
</GGPlot>

Runnable demos

Deeper interaction patterns