victory-chart
Advanced tools
Comparing version 24.4.0 to 24.5.0
# VictoryChart Changelog | ||
## 24.5.0 (2017-12-21) | ||
- [542](https://github.com/FormidableLabs/victory-chart/pull/542) Adds support for immutable data *note: compatible with `immutable@v3.8.x` and will be compatible with `immutable@v4.0.x` when released* | ||
## 24.4.0 (2017-12-17) | ||
@@ -4,0 +8,0 @@ - [541](https://github.com/FormidableLabs/victory-chart/pull/541) Implements `sortOrder` prop with "ascending" and "descending" options |
@@ -108,3 +108,3 @@ import _isNaN from "lodash/isNaN"; | ||
getData: function (props) { | ||
if (!props.data || props.data.length < 1) { | ||
if (!props.data || Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -123,3 +123,6 @@ } | ||
}; | ||
return this.sortData(props.data.map(function (datum, index) { | ||
var formattedData = props.data.reduce(function (dataArr, datum, index) { | ||
datum = Data.parseDatum(datum); | ||
var evaluatedX = accessor.x(datum); | ||
@@ -132,4 +135,9 @@ var _x = evaluatedX !== undefined ? evaluatedX : index; | ||
var _y = [_open, _close, _high, _low]; | ||
return _assign({}, datum, { _x: _x, _y: _y, _open: _open, _close: _close, _high: _high, _low: _low }, typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}); | ||
}), props.sortKey, props.sortOrder); | ||
dataArr.push(_assign({}, datum, { _x: _x, _y: _y, _open: _open, _close: _close, _high: _high, _low: _low }, typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {})); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -136,0 +144,0 @@ sortData: function (dataset, sortKey) { |
@@ -90,3 +90,3 @@ import _isNaN from "lodash/isNaN"; | ||
if (props.data) { | ||
if (props.data.length < 1) { | ||
if (Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -118,3 +118,3 @@ } | ||
formatErrorData: function (dataset, props) { | ||
if (!dataset) { | ||
if (!dataset || Data.getLength(dataset) < 1) { | ||
return []; | ||
@@ -144,3 +144,5 @@ } | ||
return this.sortData(dataset.map(function (datum, index) { | ||
var formattedData = dataset.reduce(function (dataArr, datum, index) { | ||
datum = Data.parseDatum(datum); | ||
var evaluatedX = accessor.x(datum); | ||
@@ -153,6 +155,10 @@ var evaluatedY = accessor.y(datum); | ||
return _assign({}, datum, { _x: _x, _y: _y, errorX: errorX, errorY: errorY }, | ||
dataArr.push(_assign({}, datum, { _x: _x, _y: _y, errorX: errorX, errorY: errorY }, | ||
// map string data to numeric values, and add names | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {}); | ||
}), props.sortKey, props.sortOrder); | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {})); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -159,0 +165,0 @@ sortData: function (dataset, sortKey) { |
@@ -8,3 +8,3 @@ import PropTypes from "prop-types"; | ||
})]), | ||
data: PropTypes.array, | ||
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), | ||
dataComponent: PropTypes.element, | ||
@@ -11,0 +11,0 @@ labelComponent: PropTypes.element, |
@@ -131,3 +131,3 @@ Object.defineProperty(exports, "__esModule", { | ||
getData: function (props) { | ||
if (!props.data || props.data.length < 1) { | ||
if (!props.data || _victoryCore.Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -146,3 +146,6 @@ } | ||
}; | ||
return this.sortData(props.data.map(function (datum, index) { | ||
var formattedData = props.data.reduce(function (dataArr, datum, index) { | ||
datum = _victoryCore.Data.parseDatum(datum); | ||
var evaluatedX = accessor.x(datum); | ||
@@ -155,4 +158,9 @@ var _x = evaluatedX !== undefined ? evaluatedX : index; | ||
var _y = [_open, _close, _high, _low]; | ||
return (0, _assign3.default)({}, datum, { _x: _x, _y: _y, _open: _open, _close: _close, _high: _high, _low: _low }, typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}); | ||
}), props.sortKey, props.sortOrder); | ||
dataArr.push((0, _assign3.default)({}, datum, { _x: _x, _y: _y, _open: _open, _close: _close, _high: _high, _low: _low }, typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {})); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -159,0 +167,0 @@ sortData: function (dataset, sortKey) { |
@@ -119,3 +119,3 @@ Object.defineProperty(exports, "__esModule", { | ||
if (props.data) { | ||
if (props.data.length < 1) { | ||
if (_victoryCore.Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -147,3 +147,3 @@ } | ||
formatErrorData: function (dataset, props) { | ||
if (!dataset) { | ||
if (!dataset || _victoryCore.Data.getLength(dataset) < 1) { | ||
return []; | ||
@@ -173,3 +173,5 @@ } | ||
return this.sortData(dataset.map(function (datum, index) { | ||
var formattedData = dataset.reduce(function (dataArr, datum, index) { | ||
datum = _victoryCore.Data.parseDatum(datum); | ||
var evaluatedX = accessor.x(datum); | ||
@@ -182,6 +184,10 @@ var evaluatedY = accessor.y(datum); | ||
return (0, _assign3.default)({}, datum, { _x: _x, _y: _y, errorX: errorX, errorY: errorY }, | ||
dataArr.push((0, _assign3.default)({}, datum, { _x: _x, _y: _y, errorX: errorX, errorY: errorY }, | ||
// map string data to numeric values, and add names | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {}); | ||
}), props.sortKey, props.sortOrder); | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {})); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -188,0 +194,0 @@ sortData: function (dataset, sortKey) { |
@@ -18,3 +18,3 @@ Object.defineProperty(exports, "__esModule", { | ||
})]), | ||
data: _propTypes2.default.array, | ||
data: _propTypes2.default.oneOfType([_propTypes2.default.array, _propTypes2.default.object]), | ||
dataComponent: _propTypes2.default.element, | ||
@@ -21,0 +21,0 @@ labelComponent: _propTypes2.default.element, |
{ | ||
"name": "victory-chart", | ||
"version": "24.4.0", | ||
"version": "24.5.0", | ||
"description": "Chart Component for Victory", | ||
@@ -35,3 +35,3 @@ "main": "lib/index.js", | ||
"lodash": "^4.17.4", | ||
"victory-core": "^20.4.0" | ||
"victory-core": "^20.5.0" | ||
}, | ||
@@ -45,2 +45,3 @@ "devDependencies": { | ||
"enzyme-adapter-react-16": "^1.0.3", | ||
"immutable": "^3.8.2", | ||
"mocha": "^3.0.2", | ||
@@ -47,0 +48,0 @@ "prop-types": "^15.5.8", |
@@ -81,3 +81,3 @@ import { assign, sortBy, keys, omit, defaults, isNaN } from "lodash"; | ||
getData(props) { | ||
if (!props.data || props.data.length < 1) { | ||
if (!props.data || Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -96,3 +96,6 @@ } | ||
}; | ||
return this.sortData(props.data.map((datum, index) => { | ||
const formattedData = props.data.reduce((dataArr, datum, index) => { | ||
datum = Data.parseDatum(datum); | ||
const evaluatedX = accessor.x(datum); | ||
@@ -105,9 +108,16 @@ const _x = evaluatedX !== undefined ? evaluatedX : index; | ||
const _y = [_open, _close, _high, _low]; | ||
return assign( | ||
{}, | ||
datum, | ||
{ _x, _y, _open, _close, _high, _low }, | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {} | ||
dataArr.push( | ||
assign( | ||
{}, | ||
datum, | ||
{ _x, _y, _open, _close, _high, _low }, | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {} | ||
) | ||
); | ||
}), props.sortKey, props.sortOrder); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -114,0 +124,0 @@ |
@@ -60,3 +60,3 @@ import { assign, keys, omit, defaults, isArray, flatten, sortBy, isNaN } from "lodash"; | ||
if (props.data) { | ||
if (props.data.length < 1) { | ||
if (Data.getLength(props.data) < 1) { | ||
return []; | ||
@@ -93,3 +93,3 @@ } | ||
formatErrorData(dataset, props) { | ||
if (!dataset) { | ||
if (!dataset || Data.getLength(dataset) < 1) { | ||
return []; | ||
@@ -115,3 +115,5 @@ } | ||
return this.sortData(dataset.map((datum, index) => { | ||
const formattedData = dataset.reduce((dataArr, datum, index) => { | ||
datum = Data.parseDatum(datum); | ||
const evaluatedX = accessor.x(datum); | ||
@@ -124,11 +126,17 @@ const evaluatedY = accessor.y(datum); | ||
return assign( | ||
{}, | ||
datum, | ||
{ _x, _y, errorX, errorY }, | ||
// map string data to numeric values, and add names | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, | ||
typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {} | ||
dataArr.push( | ||
assign( | ||
{}, | ||
datum, | ||
{ _x, _y, errorX, errorY }, | ||
// map string data to numeric values, and add names | ||
typeof _x === "string" ? { _x: stringMap.x[_x], x: _x } : {}, | ||
typeof _y === "string" ? { _y: stringMap.y[_y], y: _y } : {} | ||
) | ||
); | ||
}), props.sortKey, props.sortOrder); | ||
return dataArr; | ||
}, []); | ||
return this.sortData(formattedData, props.sortKey, props.sortOrder); | ||
}, | ||
@@ -135,0 +143,0 @@ |
@@ -11,3 +11,3 @@ import PropTypes from "prop-types"; | ||
]), | ||
data: PropTypes.array, | ||
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), | ||
dataComponent: PropTypes.element, | ||
@@ -14,0 +14,0 @@ labelComponent: PropTypes.element, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2831123
51143
15
Updatedvictory-core@^20.5.0