canvasxpress-react 39.2.5 → 39.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -17
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -3,37 +3,37 @@ var CanvasXpress = require('canvasxpress');
|
|
|
3
3
|
require('canvasxpress/src/canvasXpress.css');
|
|
4
4
|
|
|
5
5
|
class CanvasXpressReact extends React.Component {
|
|
6
|
-
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this.target = props.target ? props.target : false;
|
|
10
|
-
this.data = props.data ? props.data : false;
|
|
11
|
-
this.config = props.config ? props.config : false;
|
|
6
|
+
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.target = props.target ? props.target : false;
|
|
10
|
+
this.data = props.data ? props.data : false;
|
|
11
|
+
this.config = props.config ? props.config : false;
|
|
12
12
|
this.events = props.events ? props.events : false;
|
|
13
|
-
this.width = props.width ? props.width : 500;
|
|
13
|
+
this.width = props.width ? props.width : 500;
|
|
14
14
|
this.height = props.height ? props.height : 500;
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
componentDidMount() {
|
|
18
|
-
//Create graph and render
|
|
18
|
+
//Create graph and render
|
|
19
19
|
this.graph = new CanvasXpress.init(this.target, this.data, this.config, this.events);
|
|
20
20
|
if (this.props.onRef) {
|
|
21
21
|
this.props.onRef(this.graph);
|
|
22
22
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
shouldComponentUpdate(nextProps, nextState){
|
|
26
26
|
//Check if graph config and data has changed and determine if component has to be updated
|
|
27
27
|
return !(nextProps.data === this.data && nextProps.config === this.config);
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
componentDidUpdate() {
|
|
31
31
|
//Update Graph Options & Data
|
|
32
32
|
this.graph.resetConfig();
|
|
33
33
|
this.graph.updateConfig(this.props.config);
|
|
34
34
|
this.graph.updateData(this.props.data);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
componentWillUnmount() {
|
|
38
38
|
//Destroy graph and remove reference
|
|
39
39
|
this.graph.destroy();
|
|
@@ -41,11 +41,11 @@ class CanvasXpressReact extends React.Component {
|
|
|
41
41
|
this.props.onRef(undefined);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
render() {
|
|
46
|
-
return React.createElement('canvas', { id: this.target, width: this.width, height: this.height });
|
|
46
|
+
return React.createElement('canvas', { id: this.target, width: this.width, height: this.height });
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export default CanvasXpressReact;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "canvasxpress-react",
|
|
3
3
|
"main": "index.js",
|
|
4
4
|
"title": "CanvasXpress React",
|
|
5
|
-
"version": "39.
|
|
5
|
+
"version": "39.5.3",
|
|
6
6
|
"license": {
|
|
7
7
|
"type": "Dual licensing",
|
|
8
8
|
"url": "https://www.canvasxpress.org/docs/license.html"
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/neuhausi/canvasxpress#readme",
|
|
30
30
|
"dependencies": {}
|
|
31
|
-
}
|
|
31
|
+
}
|