From fd0803c3a046362f5c79ac066683d8b5096fddca Mon Sep 17 00:00:00 2001 From: Sean Liu Date: Sat, 10 Feb 2018 23:58:33 +0800 Subject: [PATCH 1/2] add get instance --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; } From 6f5c5d9bced60a25e9b2686222ae850e9b9d275b Mon Sep 17 00:00:00 2001 From: Sean Liu Date: Sun, 11 Feb 2018 00:00:51 +0800 Subject: [PATCH 2/2] add get instance --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) 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