Skip to content
Open
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ To add support for aspect ratio
<ChartistGraph className={'ct-octave'} data={data} options={options} type={type} />
```

### Instance

```HTML
function getInstance(instance) {
console.log(instance); // chart instance
}

<ChartistGraph className={'ct-octave'} getInstance={getInstance} data={data} options={options} type={type} />
```

### Note

This module does not include the css files for Chartist. If you want to add it, include their CDN in your html file
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChartistGraph extends Component {
updateChart(config) {
let Chartist = require('chartist');

let { type, data } = config;
let { type, data, getInstance } = config;
let options = config.options || {};
let responsiveOptions = config.responsiveOptions || [];
let event;
Expand All @@ -44,7 +44,8 @@ class ChartistGraph extends Component {
}
}
}


getInstance(this.chartist);
return this.chartist;
}

Expand Down