This repository was archived by the owner on Jul 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ var MyComponent = React.createClass({
3737* all other parameters will be passed through to the ``` canvas ``` element
3838
3939
40+ Chart References
41+ ----------------
42+ The ``` canvas ``` element can be retrieved using ``` getCanvass ``` and the ``` chartjs object ``` can be retrieved using ``` getChart ``` .
43+
44+
4045### Other React projects that may interest you
4146
4247* [ jhudson8/react-mixin-manager] ( https://github.com/jhudson8/react-mixin-manager )
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ module.exports = {
44 displayName : chartType + 'Chart' ,
55 getInitialState : function ( ) { return { } ; } ,
66 render : function ( ) {
7- var _props = { } ;
7+ var _props = {
8+ ref : 'canvass'
9+ } ;
810 for ( var name in this . props ) {
911 if ( this . props . hasOwnProperty ( name ) ) {
1012 if ( name !== 'data' && name !== 'options' ) {
@@ -46,6 +48,16 @@ module.exports = {
4648 this . state . chart = chart ;
4749 } ;
4850
51+ // return the chartjs instance
52+ classData . getChart = function ( ) {
53+ return this . state . chart ;
54+ } ;
55+
56+ // return the canvass element that contains the chart
57+ classData . getCanvass = function ( ) {
58+ return this . refs . canvass . getDOMNode ( ) ;
59+ } ;
60+
4961 var i ;
5062 for ( i = 0 ; i < extras . length ; i ++ ) {
5163 extra ( extras [ i ] ) ;
You can’t perform that action at this time.
0 commit comments