Skip to content

Commit

Permalink
Revert "fix(docs): update README.md, CHANGELOG.md with breaking chang…
Browse files Browse the repository at this point in the history
…e information about plugin registration (#151)"

This reverts commit dd9c5d3.
  • Loading branch information
artus9033 committed Aug 18, 2024
1 parent dd9c5d3 commit d1ee73f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
## [2.3.0](https://github.com/artus9033/chartjs-plugin-dragdata/compare/v2.2.5...v2.3.0) (2024-08-17)


### ⚠ BREAKING CHANGES

* Now the plugin does not self-register and manual registration is required (either via `Chart.register` or by listing the plugin in chart options)

### Features

* demos & master branch coverage ([#133](https://github.com/artus9033/chartjs-plugin-dragdata/issues/133)) ([45fa08d](https://github.com/artus9033/chartjs-plugin-dragdata/commit/45fa08d65aa2b2fb3b4f4add3e410c5fbce62dec))
Expand Down
51 changes: 0 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,57 +94,6 @@ In browsers, you may simply add the following script tag:

Or, download a release archive file from [releases](https://github.com/artus9033/chartjs-plugin-dragdata/releases).

## Getting started

> [!IMPORTANT]
> Versions `>= 3.0.0` require [manual registration](https://www.chartjs.org/docs/latest/developers/plugins.html#using-plugins).
Just importing or loading the plugin script will not make dragging work. As it is usually done with chart.js plugins, since `v3.0.0` the plugin no longer self-registers globally in Chart.js and you must [register it](https://www.chartjs.org/docs/latest/developers/plugins.html#using-plugins) manually.

### Global registration

As any chart.js plugin, the dragdata plugin can be registered either globally for all charts (using `Chart.register(ChartJSDragDataPlugin)`), or on a per-chart basis (by specifying `plugins: [ChartJSDragDataPlugin]` in chart config).

#### Bundler

If you are using a bundler (e.g. Webpack, Rollup, Parcel or similar, or a framework like React or Angular):

In ESM modules:

```ts
import Chart from "chart.js/auto";
import ChartJSDragDataPlugin from "chartjs-plugin-dragdata";

Chart.register(ChartJSDragDataPlugin);
```

Or in CJS modules:

```js
const Chart = require("chart.js/auto");
const ChartJSDragDataPlugin = require("chartjs-plugin-dragdata");

Chart.register(ChartJSDragDataPlugin);
```

#### Script tag

Or, if you are using a script tag, both chart.js & chartjs-plugin-dragdata are available as global variables (`Chart` & `ChartJSDragDataPlugin`):

```js
Chart.register(ChartJSDragDataPlugin);
```

### Per-chart registration

If you want to apply the plugin just to selected charts, you can list the plugin in chart config:

```ts
new Chart(ctx, {
plugins: [ChartJSDragDataPlugin],
});
```

## Configuration

The following Chart.js sample configuration displays (_most_) of the available
Expand Down

0 comments on commit d1ee73f

Please sign in to comment.