Socket
Socket
Sign inDemoInstall

@devexpress/dx-chart-core

Package Overview
Dependencies
Maintainers
24
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devexpress/dx-chart-core - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

190

dist/dx-chart-core.es.js
/**
* Bundle of @devexpress/dx-chart-core
* Generated: 2018-08-21
* Version: 1.6.1
* Generated: 2018-08-23
* Version: 1.7.0
* License: https://js.devexpress.com/Licensing

@@ -9,4 +9,4 @@ */

import { extent } from 'd3-array';
import { scaleBand, scaleLinear } from 'd3-scale';
import { arc, area, curveCatmullRom, line, pie, stack, symbol, symbolCircle } from 'd3-shape';
import { scaleBand, scaleLinear, scaleOrdinal } from 'd3-scale';
import { arc, area, curveMonotoneX, line, pie, stack, symbol, symbolCircle } from 'd3-shape';

@@ -431,4 +431,5 @@ var HORIZONTAL = 'horizontal';

var getX = function getX(_ref) {
var x = _ref.x;
return x;
var x = _ref.x,
width = _ref.width;
return x + width / 2;
};

@@ -444,54 +445,29 @@ var getY = function getY(_ref2) {

var computeLinePath = function computeLinePath(data, scales, argumentField, valueField, name) {
return data.reduce(function (result, dataItem) {
if (dataItem[argumentField] !== undefined && dataItem[valueField] !== undefined) {
return [].concat(toConsumableArray(result), [{
x: scales.xScale(dataItem[argumentField]),
y: scales.yScale(dataItem[valueField + '-' + name + '-stack'][1]),
y1: scales.yScale(dataItem[valueField + '-' + name + '-stack'][0]),
id: dataItem[argumentField],
value: dataItem[valueField]
}]);
}
return result;
}, []);
};
var DEFAULT_POINT_SIZE = 7;
var getGenerator = function getGenerator(type) {
switch (type) {
case 'spline':
return line().x(getX).y(getY).curve(curveCatmullRom);
case 'area':
return area().x(getX).y1(getY).y0(getY1);
default:
return line().x(getX).y(getY);
}
};
var dArea = area().x(getX).y1(getY).y0(getY1);
var xyScales = function xyScales(domainsOptions, argumentAxisName, domainName, layout) {
var stacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
var _ref4 = arguments[5];
var _ref4$groupWidth = _ref4.groupWidth,
groupWidth = _ref4$groupWidth === undefined ? 1 : _ref4$groupWidth,
_ref4$barWidth = _ref4.barWidth,
barWidth = _ref4$barWidth === undefined ? 1 : _ref4$barWidth;
var width = layout.width,
height = layout.height;
var dLine = line().x(getX).y(getY);
var argumentDomainOptions = domainsOptions[argumentAxisName];
var xScale = createScale(argumentDomainOptions, width, height, 1 - groupWidth);
var bandwidth = xScale.bandwidth ? xScale.bandwidth() : width / xScale.ticks().length;
var dSpline = line().x(getX).y(getY).curve(curveMonotoneX);
var xyScales = function xyScales(argumentDomainOptions, valueDomainOptions, _ref4, groupWidth) {
var width = _ref4.width,
height = _ref4.height;
return {
xScale: xScale,
yScale: createScale(domainsOptions[domainName], width, height),
x0Scale: createScale({
orientation: argumentDomainOptions.orientation,
type: 'band',
domain: stacks
}, bandwidth, bandwidth, 1 - barWidth)
xScale: createScale(argumentDomainOptions, width, height, 1 - groupWidth),
yScale: createScale(valueDomainOptions, width, height)
};
};
var pieAttributes = function pieAttributes(valueField, data, width, height, innerRadius, outerRadius) {
var pieAttributes = function pieAttributes(data, _ref5, argumentField, valueField, name, stack$$1, stacks, _ref6) {
var xScale = _ref5.xScale,
yScale = _ref5.yScale;
var _ref6$innerRadius = _ref6.innerRadius,
innerRadius = _ref6$innerRadius === undefined ? 0 : _ref6$innerRadius,
_ref6$outerRadius = _ref6.outerRadius,
outerRadius = _ref6$outerRadius === undefined ? 1 : _ref6$outerRadius;
var width = Math.max.apply(null, xScale.range());
var height = Math.max.apply(null, yScale.range());
var radius = Math.min(width, height) / 2;

@@ -502,6 +478,14 @@ var pieData = pie().value(function (d) {

return pieData.map(function (d) {
return pieData.map(function (_ref7) {
var startAngle = _ref7.startAngle,
endAngle = _ref7.endAngle,
value = _ref7.value,
itemData = _ref7.data;
return {
d: arc().innerRadius(radius * innerRadius).outerRadius(radius * outerRadius || radius).startAngle(d.startAngle).endAngle(d.endAngle)(),
value: d.value
d: arc().innerRadius(innerRadius * radius).outerRadius(outerRadius * radius).startAngle(startAngle).endAngle(endAngle)(),
value: value,
data: itemData,
id: itemData[argumentField],
x: width / 2,
y: height / 2
};

@@ -511,30 +495,67 @@ });

var coordinates = function coordinates(data, scales, argumentField, valueField, name) {
return computeLinePath(data, scales, argumentField, valueField, name);
var coordinates = function coordinates(data, _ref8, argumentField, valueField, name) {
var xScale = _ref8.xScale,
yScale = _ref8.yScale;
return data.reduce(function (result, dataItem, index) {
if (dataItem[argumentField] !== undefined && dataItem[valueField] !== undefined) {
return [].concat(toConsumableArray(result), [{
x: xScale(dataItem[argumentField]),
y: yScale(dataItem[valueField + '-' + name + '-stack'][1]),
y1: yScale(dataItem[valueField + '-' + name + '-stack'][0]),
width: xScale.bandwidth ? xScale.bandwidth() : 0,
id: index,
value: dataItem[valueField]
}]);
}
return result;
}, []);
};
var barCoordinates = function barCoordinates(data, _ref9, argumentField, valueField, name, stack$$1) {
var xScale = _ref9.xScale,
yScale = _ref9.yScale;
var stacks = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [undefined];
var _ref10 = arguments[7];
var _ref10$barWidth = _ref10.barWidth,
barWidth = _ref10$barWidth === undefined ? 0.9 : _ref10$barWidth;
var rawCoordinates = coordinates(data, { xScale: xScale, yScale: yScale }, argumentField, valueField, name);
var bandwidth = xScale.bandwidth ? xScale.bandwidth() : 0;
var x0Scale = createScale({
type: 'band',
domain: stacks
}, bandwidth, bandwidth, 1 - barWidth);
return rawCoordinates.map(function (item) {
return _extends({}, item, {
width: x0Scale.bandwidth(),
x: item.x + x0Scale(stack$$1)
});
});
};
var findSeriesByName = function findSeriesByName(name, series) {
return series.find(function (seriesItem) {
return seriesItem.uniqueName === name;
return seriesItem.symbolName === name;
});
};
var lineAttributes = function lineAttributes(type, scales) {
var dBar = function dBar(_ref11) {
var x = _ref11.x,
y = _ref11.y,
y1 = _ref11.y1,
width = _ref11.width;
return {
path: getGenerator(type),
x: scales.xScale.bandwidth ? scales.xScale.bandwidth() / 2 : 0,
y: 0
x: x, y: Math.min(y, y1), width: width || 2, height: Math.abs(y1 - y)
};
};
var pointAttributes = function pointAttributes(scales, _ref5) {
var _ref5$size = _ref5.size,
size = _ref5$size === undefined ? 7 : _ref5$size;
var pointAttributes = function pointAttributes(_ref12) {
var _ref12$size = _ref12.size,
size = _ref12$size === undefined ? DEFAULT_POINT_SIZE : _ref12$size;
var dPoint = symbol().size([Math.pow(size, 2)]).type(symbolCircle)();
var offSet = scales.xScale.bandwidth ? scales.xScale.bandwidth() / 2 : 0;
return function (item) {
return {
d: dPoint,
x: item.x + offSet,
x: item.x,
y: item.y

@@ -545,13 +566,6 @@ };

var barPointAttributes = function barPointAttributes(scales, _, stack$$1) {
var bandwidth = scales.x0Scale.bandwidth();
var offset = scales.x0Scale(stack$$1) || 0;
return function (item) {
return {
x: item.x + offset,
y: Math.min(item.y, item.y1),
width: bandwidth,
height: Math.abs(item.y1 - item.y)
};
};
var createNewUniqueName = function createNewUniqueName(name) {
return name.replace(/\d*$/, function (str) {
return str ? +str + 1 : 0;
});
};

@@ -562,2 +576,9 @@

var seriesProps = arguments[1];
if (series.find(function (_ref13) {
var uniqueName = _ref13.uniqueName;
return uniqueName === seriesProps.uniqueName;
})) {
return seriesData(series, _extends({}, seriesProps, { uniqueName: createNewUniqueName(seriesProps.uniqueName) }));
}
return [].concat(toConsumableArray(series), [seriesProps]);

@@ -635,14 +656,9 @@ };

var Palette = ['#2196F3', '#F44336', '#4CAF50', '#FFEB3B', '#E91E63', '#9C27B0'];
var PALETTE = ['#2196F3', '#F44336', '#4CAF50', '#FFEB3B', '#E91E63', '#9C27B0'];
var getColor = function getColor(index) {
return Palette[index % Palette.length];
};
var palette = function palette(series) {
return series.map(function (singleSeries, index) {
return _extends({}, singleSeries, {
themeColor: getColor(index)
});
});
return scaleOrdinal().domain(series.map(function (_ref) {
var uniqueName = _ref.uniqueName;
return uniqueName;
})).range(PALETTE);
};

@@ -669,3 +685,3 @@

export { domains, bBoxes, axisCoordinates, axesData, xyScales, pieAttributes, coordinates, findSeriesByName, lineAttributes, pointAttributes, barPointAttributes, seriesData, checkZeroStart, createScale, HORIZONTAL, VERTICAL, TOP, BOTTOM, LEFT, RIGHT, MIDDLE, END, START, BAND, processData, seriesWithStacks, stacks, palette, axisName, prepareData };
export { domains, bBoxes, axisCoordinates, axesData, dArea, dLine, dSpline, xyScales, pieAttributes, coordinates, barCoordinates, findSeriesByName, dBar, pointAttributes, seriesData, checkZeroStart, createScale, HORIZONTAL, VERTICAL, TOP, BOTTOM, LEFT, RIGHT, MIDDLE, END, START, BAND, processData, seriesWithStacks, stacks, palette, axisName, prepareData };
//# sourceMappingURL=dx-chart-core.es.js.map
/**
* Bundle of @devexpress/dx-chart-core
* Generated: 2018-08-21
* Version: 1.6.1
* Generated: 2018-08-23
* Version: 1.7.0
* License: https://js.devexpress.com/Licensing

@@ -432,4 +432,5 @@ */

var getX = function getX(_ref) {
var x = _ref.x;
return x;
var x = _ref.x,
width = _ref.width;
return x + width / 2;
};

@@ -445,54 +446,29 @@ var getY = function getY(_ref2) {

var computeLinePath = function computeLinePath(data, scales, argumentField, valueField, name) {
return data.reduce(function (result, dataItem) {
if (dataItem[argumentField] !== undefined && dataItem[valueField] !== undefined) {
return [].concat(toConsumableArray(result), [{
x: scales.xScale(dataItem[argumentField]),
y: scales.yScale(dataItem[valueField + '-' + name + '-stack'][1]),
y1: scales.yScale(dataItem[valueField + '-' + name + '-stack'][0]),
id: dataItem[argumentField],
value: dataItem[valueField]
}]);
}
return result;
}, []);
};
var DEFAULT_POINT_SIZE = 7;
var getGenerator = function getGenerator(type) {
switch (type) {
case 'spline':
return d3Shape.line().x(getX).y(getY).curve(d3Shape.curveCatmullRom);
case 'area':
return d3Shape.area().x(getX).y1(getY).y0(getY1);
default:
return d3Shape.line().x(getX).y(getY);
}
};
var dArea = d3Shape.area().x(getX).y1(getY).y0(getY1);
var xyScales = function xyScales(domainsOptions, argumentAxisName, domainName, layout) {
var stacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
var _ref4 = arguments[5];
var _ref4$groupWidth = _ref4.groupWidth,
groupWidth = _ref4$groupWidth === undefined ? 1 : _ref4$groupWidth,
_ref4$barWidth = _ref4.barWidth,
barWidth = _ref4$barWidth === undefined ? 1 : _ref4$barWidth;
var width = layout.width,
height = layout.height;
var dLine = d3Shape.line().x(getX).y(getY);
var argumentDomainOptions = domainsOptions[argumentAxisName];
var xScale = createScale(argumentDomainOptions, width, height, 1 - groupWidth);
var bandwidth = xScale.bandwidth ? xScale.bandwidth() : width / xScale.ticks().length;
var dSpline = d3Shape.line().x(getX).y(getY).curve(d3Shape.curveMonotoneX);
var xyScales = function xyScales(argumentDomainOptions, valueDomainOptions, _ref4, groupWidth) {
var width = _ref4.width,
height = _ref4.height;
return {
xScale: xScale,
yScale: createScale(domainsOptions[domainName], width, height),
x0Scale: createScale({
orientation: argumentDomainOptions.orientation,
type: 'band',
domain: stacks
}, bandwidth, bandwidth, 1 - barWidth)
xScale: createScale(argumentDomainOptions, width, height, 1 - groupWidth),
yScale: createScale(valueDomainOptions, width, height)
};
};
var pieAttributes = function pieAttributes(valueField, data, width, height, innerRadius, outerRadius) {
var pieAttributes = function pieAttributes(data, _ref5, argumentField, valueField, name, stack$$1, stacks, _ref6) {
var xScale = _ref5.xScale,
yScale = _ref5.yScale;
var _ref6$innerRadius = _ref6.innerRadius,
innerRadius = _ref6$innerRadius === undefined ? 0 : _ref6$innerRadius,
_ref6$outerRadius = _ref6.outerRadius,
outerRadius = _ref6$outerRadius === undefined ? 1 : _ref6$outerRadius;
var width = Math.max.apply(null, xScale.range());
var height = Math.max.apply(null, yScale.range());
var radius = Math.min(width, height) / 2;

@@ -503,6 +479,14 @@ var pieData = d3Shape.pie().value(function (d) {

return pieData.map(function (d) {
return pieData.map(function (_ref7) {
var startAngle = _ref7.startAngle,
endAngle = _ref7.endAngle,
value = _ref7.value,
itemData = _ref7.data;
return {
d: d3Shape.arc().innerRadius(radius * innerRadius).outerRadius(radius * outerRadius || radius).startAngle(d.startAngle).endAngle(d.endAngle)(),
value: d.value
d: d3Shape.arc().innerRadius(innerRadius * radius).outerRadius(outerRadius * radius).startAngle(startAngle).endAngle(endAngle)(),
value: value,
data: itemData,
id: itemData[argumentField],
x: width / 2,
y: height / 2
};

@@ -512,30 +496,67 @@ });

var coordinates = function coordinates(data, scales, argumentField, valueField, name) {
return computeLinePath(data, scales, argumentField, valueField, name);
var coordinates = function coordinates(data, _ref8, argumentField, valueField, name) {
var xScale = _ref8.xScale,
yScale = _ref8.yScale;
return data.reduce(function (result, dataItem, index) {
if (dataItem[argumentField] !== undefined && dataItem[valueField] !== undefined) {
return [].concat(toConsumableArray(result), [{
x: xScale(dataItem[argumentField]),
y: yScale(dataItem[valueField + '-' + name + '-stack'][1]),
y1: yScale(dataItem[valueField + '-' + name + '-stack'][0]),
width: xScale.bandwidth ? xScale.bandwidth() : 0,
id: index,
value: dataItem[valueField]
}]);
}
return result;
}, []);
};
var barCoordinates = function barCoordinates(data, _ref9, argumentField, valueField, name, stack$$1) {
var xScale = _ref9.xScale,
yScale = _ref9.yScale;
var stacks = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [undefined];
var _ref10 = arguments[7];
var _ref10$barWidth = _ref10.barWidth,
barWidth = _ref10$barWidth === undefined ? 0.9 : _ref10$barWidth;
var rawCoordinates = coordinates(data, { xScale: xScale, yScale: yScale }, argumentField, valueField, name);
var bandwidth = xScale.bandwidth ? xScale.bandwidth() : 0;
var x0Scale = createScale({
type: 'band',
domain: stacks
}, bandwidth, bandwidth, 1 - barWidth);
return rawCoordinates.map(function (item) {
return _extends({}, item, {
width: x0Scale.bandwidth(),
x: item.x + x0Scale(stack$$1)
});
});
};
var findSeriesByName = function findSeriesByName(name, series) {
return series.find(function (seriesItem) {
return seriesItem.uniqueName === name;
return seriesItem.symbolName === name;
});
};
var lineAttributes = function lineAttributes(type, scales) {
var dBar = function dBar(_ref11) {
var x = _ref11.x,
y = _ref11.y,
y1 = _ref11.y1,
width = _ref11.width;
return {
path: getGenerator(type),
x: scales.xScale.bandwidth ? scales.xScale.bandwidth() / 2 : 0,
y: 0
x: x, y: Math.min(y, y1), width: width || 2, height: Math.abs(y1 - y)
};
};
var pointAttributes = function pointAttributes(scales, _ref5) {
var _ref5$size = _ref5.size,
size = _ref5$size === undefined ? 7 : _ref5$size;
var pointAttributes = function pointAttributes(_ref12) {
var _ref12$size = _ref12.size,
size = _ref12$size === undefined ? DEFAULT_POINT_SIZE : _ref12$size;
var dPoint = d3Shape.symbol().size([Math.pow(size, 2)]).type(d3Shape.symbolCircle)();
var offSet = scales.xScale.bandwidth ? scales.xScale.bandwidth() / 2 : 0;
return function (item) {
return {
d: dPoint,
x: item.x + offSet,
x: item.x,
y: item.y

@@ -546,13 +567,6 @@ };

var barPointAttributes = function barPointAttributes(scales, _, stack$$1) {
var bandwidth = scales.x0Scale.bandwidth();
var offset = scales.x0Scale(stack$$1) || 0;
return function (item) {
return {
x: item.x + offset,
y: Math.min(item.y, item.y1),
width: bandwidth,
height: Math.abs(item.y1 - item.y)
};
};
var createNewUniqueName = function createNewUniqueName(name) {
return name.replace(/\d*$/, function (str) {
return str ? +str + 1 : 0;
});
};

@@ -563,2 +577,9 @@

var seriesProps = arguments[1];
if (series.find(function (_ref13) {
var uniqueName = _ref13.uniqueName;
return uniqueName === seriesProps.uniqueName;
})) {
return seriesData(series, _extends({}, seriesProps, { uniqueName: createNewUniqueName(seriesProps.uniqueName) }));
}
return [].concat(toConsumableArray(series), [seriesProps]);

@@ -636,14 +657,9 @@ };

var Palette = ['#2196F3', '#F44336', '#4CAF50', '#FFEB3B', '#E91E63', '#9C27B0'];
var PALETTE = ['#2196F3', '#F44336', '#4CAF50', '#FFEB3B', '#E91E63', '#9C27B0'];
var getColor = function getColor(index) {
return Palette[index % Palette.length];
};
var palette = function palette(series) {
return series.map(function (singleSeries, index) {
return _extends({}, singleSeries, {
themeColor: getColor(index)
});
});
return d3Scale.scaleOrdinal().domain(series.map(function (_ref) {
var uniqueName = _ref.uniqueName;
return uniqueName;
})).range(PALETTE);
};

@@ -674,9 +690,12 @@

exports.axesData = axesData;
exports.dArea = dArea;
exports.dLine = dLine;
exports.dSpline = dSpline;
exports.xyScales = xyScales;
exports.pieAttributes = pieAttributes;
exports.coordinates = coordinates;
exports.barCoordinates = barCoordinates;
exports.findSeriesByName = findSeriesByName;
exports.lineAttributes = lineAttributes;
exports.dBar = dBar;
exports.pointAttributes = pointAttributes;
exports.barPointAttributes = barPointAttributes;
exports.seriesData = seriesData;

@@ -683,0 +702,0 @@ exports.checkZeroStart = checkZeroStart;

{
"name": "@devexpress/dx-chart-core",
"version": "1.6.1",
"version": "1.7.0",
"description": "Core library for the DevExtreme Reactive Chart component",

@@ -64,3 +64,3 @@ "author": {

},
"gitHead": "5c0e7486a4a42dd322394ae49f10e7cb2cbdfc7a"
"gitHead": "1038ebcef3ea8f6be54d11c38755e86bd5490b8f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc