Skip to content

Commit

Permalink
update README.md, export Chart instance
Browse files Browse the repository at this point in the history
  • Loading branch information
YakovlevCoded committed Apr 21, 2021
1 parent 5139216 commit 200c6eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,30 +200,28 @@ render() {

## Additional Information

<!-- ### Defaults
### Defaults

Chart.js defaults can be set by importing the `defaults` object:

```tsx
import { defaults } from 'react-chartjs-2';

// Disable animating charts by default.
defaults.global.animation = false;
defaults.animation = false;
```

If you want to bulk set properties, try using the [lodash.merge](https://lodash.com/docs/#merge) function. This function will do a deep recursive merge preserving previously set values that you don't want to update.

```tsx
````tsx
import { defaults } from 'react-chartjs-2';
import merge from 'lodash.merge';

merge(defaults, {
global: {
animation: false,
line: {
borderColor: '#F85F73',
},
},
animation: false,
line: {
borderColor: '#F85F73',
}
});
``` -->
Expand All @@ -235,13 +233,13 @@ You can access the internal Chart.js object to register plugins or extend charts
import { Chart } from 'react-chartjs-2';

componentWillMount() {
Chart.pluginService.register({
Chart.register({
afterDraw: function (chart, easing) {
// Plugin code.
}
});
}
``` -->
````

### Working with Multiple Datasets

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-chartjs-2",
"version": "3.0.1",
"version": "3.0.2",
"description": "React components for Chart.js",
"source": "src/index.tsx",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ export const Scatter = forwardRef<Chart | undefined, Props>((props, ref) => (

export const defaults = chartjs.defaults;

export const Chart = chartjs;
export const Chart = chartjs.Chart;

export default ChartComponent;

0 comments on commit 200c6eb

Please sign in to comment.