diff --git a/README.md b/README.md index 5767b5c..53c5551 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,16 @@ To add support for aspect ratio ``` +### Instance + +```HTML +function getInstance(instance) { + console.log(instance); // chart instance +} + + +``` + ### Note This module does not include the css files for Chartist. If you want to add it, include their CDN in your html file diff --git a/index.js b/index.js index 5d756a6..4662612 100644 --- a/index.js +++ b/index.js @@ -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; @@ -44,7 +44,8 @@ class ChartistGraph extends Component { } } } - + + getInstance(this.chartist); return this.chartist; }