Skip to content

Commit 86b1b35

Browse files
Luca Fagiolijerairrest
authored andcommitted
Added id prop to the canvas component (#303)
* Update README.md * Update index.js
1 parent 31d710c commit 86b1b35

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {Doughnut} from 'react-chartjs-2';
5858
* data: (PropTypes.object | PropTypes.func).isRequired,
5959
* width: PropTypes.number,
6060
* height: PropTypes.number,
61+
* id: PropTypes.string,
6162
* legend: PropTypes.object,
6263
* options: PropTypes.object,
6364
* redraw: PropTypes.bool,

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,14 @@ class ChartComponent extends React.Component {
260260
}
261261

262262
render() {
263-
const {height, width, onElementsClick} = this.props;
263+
const {height, width, onElementsClick, id} = this.props;
264264

265265
return (
266266
<canvas
267267
ref={this.ref}
268268
height={height}
269269
width={width}
270+
id={id}
270271
onClick={this.handleOnClick}
271272
/>
272273
);

0 commit comments

Comments
 (0)