Skip to content

Commit ca6c761

Browse files
committed
Merge pull request #2 from gor181/dependencies
Dependencies close #1
2 parents d8cbcb7 + b2878bd commit ca6c761

File tree

4 files changed

+5
-38
lines changed

4 files changed

+5
-38
lines changed

gulpfile.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ var taskConfig = {
1515
component: {
1616
name: 'Chart',
1717
dependencies: [
18-
'classnames',
1918
'react',
2019
'react-dom',
21-
'chart.js',
22-
'uid'
20+
'chart.js'
2321
],
2422
lib: 'lib'
2523
},

lib/index.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "react-chartjs-2",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "react-chartjs-2",
5-
"main": "lib/index.js",
5+
"main": "lib/Chart.js",
66
"author": "Goran Udosic",
77
"homepage": "https://github.com/gor181/react-chartjs-2",
88
"repository": {
@@ -13,9 +13,7 @@
1313
"url": "https://github.com/gor181/react-chartjs-2/issues"
1414
},
1515
"dependencies": {
16-
"chart.js": "^2.1.0",
17-
"classnames": "^2.1.2",
18-
"uid": "0.0.2"
16+
"chart.js": "^2.1.0"
1917
},
2018
"devDependencies": {
2119
"babel-eslint": "^4.1.3",

src/Chart.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, {PropTypes} from 'react';
22
import ReactDOM from 'react-dom';
33
import Chart from 'chart.js';
44

5-
import uid from 'uid';
6-
75
const ChartComponent = React.createClass({
86

97
displayName: 'ChartComponent',
@@ -33,7 +31,6 @@ const ChartComponent = React.createClass({
3331

3432
componentWillMount() {
3533
this.chart_instance = undefined;
36-
this.chart_uid = uid(10);
3734
},
3835

3936
componentDidMount() {
@@ -57,7 +54,7 @@ const ChartComponent = React.createClass({
5754

5855
renderChart() {
5956
const {data, options, legend, type} = this.props;
60-
const node = ReactDOM.findDOMNode(this.refs[this.getRefKey()]);
57+
const node = ReactDOM.findDOMNode(this);
6158

6259
this.chart_instance = new Chart(node, {
6360
type,
@@ -66,19 +63,13 @@ const ChartComponent = React.createClass({
6663
});
6764
},
6865

69-
getRefKey() {
70-
return `chart-${this.chart_uid}`;
71-
},
72-
7366
render() {
7467
const {height, width} = this.props;
7568

7669
return (
7770
<canvas
7871
height={height}
7972
width={width}
80-
ref={this.getRefKey()}
81-
key={this.chart_uid}
8273
/>
8374
);
8475
}

0 commit comments

Comments
 (0)