Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 602f861

Browse files
authored
Merge pull request #129 from strawbrary/master
Fix: unknown prop 'redraw' warning in React v15.2
2 parents 7b5f7d8 + 23c3d45 commit 602f861

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

dist/react-chartjs.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ return /******/ (function(modules) { // webpackBootstrap
8383

8484
module.exports = {
8585
createClass: function(chartType, methodNames, dataKey) {
86+
var excludedProps = ['data', 'options', 'redraw'];
8687
var classData = {
8788
displayName: chartType + 'Chart',
8889
getInitialState: function() { return {}; },
@@ -92,7 +93,7 @@ return /******/ (function(modules) { // webpackBootstrap
9293
};
9394
for (var name in this.props) {
9495
if (this.props.hasOwnProperty(name)) {
95-
if (name !== 'data' && name !== 'options') {
96+
if (excludedProps.indexOf(name) === -1) {
9697
_props[name] = this.props[name];
9798
}
9899
}
@@ -127,7 +128,10 @@ return /******/ (function(modules) { // webpackBootstrap
127128
updatePoints(nextProps, chart, dataKey);
128129
if (chart.scale) {
129130
chart.scale.xLabels = nextProps.data.labels;
131+
132+
if (chart.scale.calculateXLabelRotation){
130133
chart.scale.calculateXLabelRotation();
134+
}
131135
}
132136
chart.update();
133137
}
@@ -188,6 +192,17 @@ return /******/ (function(modules) { // webpackBootstrap
188192
while(nextProps.data.length < chart.segments.length) {
189193
chart.removeData();
190194
}
195+
} else if (name === "Radar") {
196+
chart.removeData();
197+
nextProps.data.datasets.forEach(function(set, setIndex) {
198+
set.data.forEach(function(val, pointIndex) {
199+
if (typeof(chart.datasets[setIndex][dataKey][pointIndex]) == "undefined") {
200+
addData(nextProps, chart, setIndex, pointIndex);
201+
} else {
202+
chart.datasets[setIndex][dataKey][pointIndex].value = val;
203+
}
204+
});
205+
});
191206
} else {
192207
while (chart.scale.xLabels.length > nextProps.data.labels.length) {
193208
chart.removeData();

dist/react-chartjs.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var ReactDOM = require('react-dom');
33

44
module.exports = {
55
createClass: function(chartType, methodNames, dataKey) {
6+
var excludedProps = ['data', 'options', 'redraw'];
67
var classData = {
78
displayName: chartType + 'Chart',
89
getInitialState: function() { return {}; },
@@ -12,7 +13,7 @@ module.exports = {
1213
};
1314
for (var name in this.props) {
1415
if (this.props.hasOwnProperty(name)) {
15-
if (name !== 'data' && name !== 'options') {
16+
if (excludedProps.indexOf(name) === -1) {
1617
_props[name] = this.props[name];
1718
}
1819
}

0 commit comments

Comments
 (0)