# Dependency Edit (Gantt example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/gantt/dependency-edit/ · Index for agents: https://westcoast-charts.com/llms.txt

dependencies.edit: hover a bar and drag from the round handle at its end onto another bar to link them (finish-to-start). Click a link and press Delete to remove it. Keyboard: focus a task and press L, move to another task and press L again (again on a linked pair unlinks). Loops are refused. Ctrl/Cmd+Z undoes. dependencyCreate / dependencyDelete are cancelable and write dependsOn back to your data.

- Chart type: `gantt` (Gantt)
- Collection: Gantt · Gantt
- Raw configuration: https://westcoast-charts.com/gallery-src/gantt/dependency-edit.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/premium/gantt/dependency-edit.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
import premium from 'west-coast-charts/premium'

WestCoastCharts.use(types).use(premium)
const WestCoastChartsPremium = premium
WestCoastCharts.setLicenseKey(LICENCE_KEY) // paid production licence; localhost evaluation needs no key
```

## Options

```js
const options = {
  chart: {
    height: "auto",
    toolbar: {
      show: false
    },
    type: "gantt",
    events: {
      dependencyCreate: (e, ctx, o) => log('dependencyCreate ' + o.from + ' → ' + o.to + ' (' + o.source + ')'),
      dependencyDelete: (e, ctx, o) => log('dependencyDelete ' + o.from + ' → ' + o.to + ' (' + o.source + ')')
    }
  },
  series: [
    {
      name: "Release",
      data: [
        {
          id: "a",
          x: "Design",
          y: [1791151200000, 1791756000000],
          progress: 100
        },
        {
          id: "b",
          x: "Build",
          y: [1791756000000, 1792706400000],
          progress: 30,
          dependsOn: ["a"]
        },
        {
          id: "c",
          x: "Docs",
          y: [1791928800000, 1792533600000]
        },
        {
          id: "t",
          x: "Test",
          y: [1792706400000, 1793142000000]
        },
        {
          id: "e",
          x: "Release",
          y: 1793314800000,
          milestone: true,
          dependsOn: ["b"]
        }
      ]
    }
  ],
  plotOptions: {
    gantt: {
      today: {
        date: "2026-10-22"
      },
      drag: {
        enabled: true
      },
      dependencies: {
        edit: true
      }
    }
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render()
```

## Verify

- Text check (Library 1.1.5): load `west-coast-charts/agent/describe` and call `chart.describe({ format: "json" })` for the actual drawn state. The live reader is on this example’s HTML page.
- Command line (Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm, https://westcoast-charts.com/docs/cli/index.md): `wcc chart export gantt-dependency-edit.json --out gantt-dependency-edit.svg --with-table` (save the options above as JSON first)
