Skip to content

Commit a5d24b7

Browse files
committed
Add custom size example
Document how to set custom size build
1 parent 7067ece commit a5d24b7

File tree

7 files changed

+187
-202
lines changed

7 files changed

+187
-202
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ import {Doughnut} from 'react-chartjs-2';
4747
* redraw: PropTypes.bool,
4848
* width: PropTypes.number
4949

50+
### Custom size
51+
In order for Chart.js to obey the custom size you need to set `maintainAspectRatio` to false, example:
52+
53+
```
54+
<Bar
55+
data={data}
56+
width={100}
57+
height={50}
58+
options={{
59+
maintainAspectRatio: false
60+
}}
61+
/>
62+
```
63+
5064
### Chart instance
5165
Chart instance can be accessed by placing a ref to the element as:
5266

0 commit comments

Comments
 (0)