Skip to content

made more of the datasets dynamic #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ MIT Licensed
Copyright (c) 2016 Goran Udosic

## Contributors
Jeremy Ayerst [@jerairrest](https://github.com/jerairrest)
10 changes: 10 additions & 0 deletions dist/react-chartjs-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _objectWithoutProperties2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var ChartComponent = _react2.default.createClass({

displayName: 'ChartComponent',
Expand Down Expand Up @@ -116,9 +118,17 @@ var ChartComponent = _react2.default.createClass({
nextData.forEach(function (dataset, sid) {
if (currentData[sid] && currentData[sid].data) {
currentData[sid].data.splice(nextData[sid].data.length);

dataset.data.forEach(function (point, pid) {
currentData[sid].data[pid] = nextData[sid].data[pid];
});

var _data = dataset.data,
otherProps = _objectWithoutProperties2(dataset, ['data']);

currentData[sid] = _extends({
data: currentData[sid].data
}, currentData[sid], otherProps);
} else {
currentData[sid] = nextData[sid];
}
Expand Down
2 changes: 1 addition & 1 deletion dist/react-chartjs-2.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _objectWithoutProperties2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var ChartComponent = _react2.default.createClass({

displayName: 'ChartComponent',
Expand Down Expand Up @@ -114,9 +116,17 @@ var ChartComponent = _react2.default.createClass({
nextData.forEach(function (dataset, sid) {
if (currentData[sid] && currentData[sid].data) {
currentData[sid].data.splice(nextData[sid].data.length);

dataset.data.forEach(function (point, pid) {
currentData[sid].data[pid] = nextData[sid].data[pid];
});

var _data = dataset.data,
otherProps = _objectWithoutProperties2(dataset, ['data']);

currentData[sid] = _extends({
data: currentData[sid].data
}, currentData[sid], otherProps);
} else {
currentData[sid] = nextData[sid];
}
Expand Down
Loading