# Chart Editor Actions

Actions allow users to manually trigger custom logic.

# Usage

Actions can be defined using: module.exports.actions: object[].

```js
module.exports = {
  actions: [
    {
      name: 'Action Name',        // Text to display on the associated button.
      handler(chart: Chart) {     // Function to call when the button is clicked.
        // ...
      }
    }
  ]
}
```

# Demo

{
  type: 'line',
  data: {
    labels: new Array(DATA_COUNT).fill(0).map((_, i) => i),
    datasets: [
      {
        data: Utils.numbers({
          count: DATA_COUNT,
          max: 50,
          min: 0,
        })
      },
      {
        data: Utils.numbers({
          count: DATA_COUNT,
          max: 25,
          min: 75,
        })
      }
    ]
  },
  options: {
    elements: {
      line: {
        borderColor: (ctx) => Utils.color(ctx.datasetIndex),
      },
      point: {
        backgroundColor: (ctx) => Utils.color(ctx.datasetIndex),
      }
    }
  }
}