Skip to content

Commit f71fddc

Browse files
committed
Readme, event descriptions
1 parent 35a91b5 commit f71fddc

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,38 @@ merge(defaults, {
111111

112112
### Events
113113

114-
#### onElementsClick (function)
114+
#### onElementsClick || getElementsAtEvent (function)
115115

116116
A function to be called when mouse clicked on chart elememts, will return all element at that point as an array. [Check](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#getelementsatevente)
117117

118118
```js
119119
{
120-
onElementsClick: (elems) => {}
120+
onElementsClick: (elems) => {},
121+
getElementsAtEvent: (elems) => {},
121122
// `elems` is an array of chartElements
122123
}
124+
125+
```
126+
#### getElementAtEvent (function)
127+
128+
Calling getElementAtEvent(event) on your Chart instance passing an argument of an event, or jQuery event, will return the single element at the event position. If there are multiple items within range, only the first is returned [Check](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#getelementatevente)
129+
130+
```js
131+
{
132+
getElementAtEvent: (elems) => {},
133+
// => returns the first element at the event point.
134+
}
135+
```
136+
137+
#### getDatasetAtEvent (function)
138+
139+
Looks for the element under the event point, then returns all elements from that dataset. This is used internally for 'dataset' mode highlighting [Check](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#getdatasetatevente)
140+
141+
```js
142+
{
143+
getDatasetAtEvent: (dataset) => {}
144+
// `dataset` is an array of chartElements
145+
}
123146
```
124147

125148
## Development (`src`, `lib` and the build process)

0 commit comments

Comments
 (0)