Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update context documentation #8626

Merged
merged 1 commit into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/docs/general/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ A plugin can provide `additionalOptionScopes` array of paths to additionally loo
Scriptable options also accept a function which is called for each of the underlying data values and that takes the unique argument `context` representing contextual information (see [option context](options.md#option-context)).
A resolver is passed as second parameter, that can be used to access other options in the same context.

> **Note:** the `context` argument should be validated in the scriptable function, because the function can be invoked in different contexts. The `type` field is a good candidate for this validation.

Example:

```javascript
Expand Down Expand Up @@ -132,7 +134,7 @@ In addition to [chart](#chart)
* `active`: true if element is active (hovered)
* `dataset`: dataset at index `datasetIndex`
* `datasetIndex`: index of the current dataset
* `index`: getter for `datasetIndex`
* `index`: same as `datasetIndex`
* `mode`: the update mode
* `type`: `'dataset'`

Expand All @@ -145,8 +147,7 @@ In addition to [dataset](#dataset)
* `parsed`: the parsed data values for the given `dataIndex` and `datasetIndex`
* `raw`: the raw data values for the given `dataIndex` and `datasetIndex`
* `element`: the element (point, arc, bar, etc.) for this data
* `index`: getter for `dataIndex`
* `mode`: the update mode
* `index`: same as `dataIndex`
* `type`: `'data'`

### scale
Expand Down
1 change: 1 addition & 0 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function createDatasetContext(parent, index, dataset) {
dataset,
datasetIndex: index,
index,
mode: 'default',
type: 'dataset'
}
);
Expand Down