Socket
Socket
Sign inDemoInstall

@devexpress/dx-chart-core

Package Overview
Dependencies
Maintainers
13
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.11.1 to 2.0.0

413

dist/dx-chart-core.es.js
/**
* Bundle of @devexpress/dx-chart-core
* Generated: 2019-06-14
* Version: 1.11.1
* Generated: 2019-07-08
* Version: 2.0.0
* License: https://js.devexpress.com/Licensing

@@ -10,3 +10,3 @@ */

import { scaleLinear as scaleLinear$1, scaleBand as scaleBand$1 } from 'd3-scale';
import { area, line, curveMonotoneX, pie, symbol, symbolCircle, arc, stack } from 'd3-shape';
import { area, line, curveMonotoneX, curveMonotoneY, pie, symbol, symbolCircle, arc, stack } from 'd3-shape';

@@ -98,11 +98,20 @@ /*! *****************************************************************************

/** @internal */
var isHorizontal = function (name) { return name === ARGUMENT_DOMAIN; };
var isHorizontal = function (name, rotated) { return (name === ARGUMENT_DOMAIN === !rotated); };
// tslint:disable-next-line: ban-types
var makeScaleHelper = function (linear, band) {
var func = function (scale) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var choosen = 'bandwidth' in scale ? band : linear;
return choosen.apply(void 0, __spread([scale], args));
};
return func;
};
var getLinearScaleWidth = function (_) { return 0; };
var getBandScaleWidth = function (scale) { return scale.bandwidth(); };
/** @internal */
var getWidth = function (scale) { return (scale.bandwidth ? scale.bandwidth() : 0); };
var getWidth = makeScaleHelper(getLinearScaleWidth, getBandScaleWidth);
/** @internal */
var fixOffset = function (scale) {
var offset = getWidth(scale) / 2;
return offset > 0 ? function (value) { return scale(value) + offset; } : scale;
};
/** @internal */
var getValueDomainName = function (name) { return name || VALUE_DOMAIN; };

@@ -114,31 +123,37 @@ var floatsEqual = function (a, b) { return Math.abs(a - b) < Number.EPSILON; };

};
var wrapLinearScale = function (scale) { return scale; };
var wrapBandScale = function (scale) {
var ret = function (value) { return scale(value) + scale.bandwidth() / 2; };
Object.assign(ret, scale);
return ret;
};
var wrapScale = makeScaleHelper(wrapLinearScale, wrapBandScale);
/** @internal */
var makeScale = function (_a, range) {
var factory = _a.factory, domain = _a.domain;
return ((factory || scaleLinear)().domain(domain).range(range));
var scale = (factory || scaleLinear)().domain(domain).range(range);
return wrapScale(scale);
};
// Though this function is used only in *Viewport* plugin (and so should be placed right there),
// it resides here so that internal scale specifics (*getWidth*)
// are encapsulated in this utility file.
//
/** @internal */
var scaleBounds = function (scale, bounds) {
// There is an issue - when range is "inverted" values are scaled incorrectly.
// scaleBand().domain(['a', 'b', 'c']).range([0, 60])('b') === 20
// scaleBand().domain(['a', 'b', 'c']).range([60, 0])('b') === 20 (should be 40)
// Because of it bounds for reversed band scale are scaled wrong.
// Fixing it would introduce an utility "scale" function and complicates the code.
// Since for now we do not have "reversed" band scales the issue is left as-is.
if (scale.bandwidth) {
var cleanScale = scale.copy().paddingInner(0).paddingOuter(0);
return [cleanScale(bounds[0]), cleanScale(bounds[1]) + cleanScale.bandwidth()];
}
return bounds.map(scale);
// It is implicitly supposed that Chart can accept any d3 scale. It is wrong.
// The followings notes show that. d3 scales are not seamlessly interchangeable themselves
// (i.e. band scale has no "invert", continuous scale has no "bandwidth").
// We have to use "adapters" to mitigate the differences.
// Hence Chart can actually accept any object that matches "adapter" interface.
// TODO: We should update reference accordingly. There might be breaking changes though.
var scaleLinearBounds = function (scale, bounds) { return bounds.map(scale); };
// There is an issue - when range is "inverted" values are scaled incorrectly.
// scaleBand().domain(['a', 'b', 'c']).range([0, 60])('b') === 20
// scaleBand().domain(['a', 'b', 'c']).range([60, 0])('b') === 20 (should be 40)
var scaleBandBounds = function (scale, bounds) {
var cleanScale = scale.copy().paddingInner(0).paddingOuter(0);
var fullRange = scale.range();
var sign = Math.sign(fullRange[1] - fullRange[0]);
return sign >= 0
? [cleanScale(bounds[0]), cleanScale(bounds[1]) + cleanScale.bandwidth()]
: [cleanScale(bounds[0]) + cleanScale.bandwidth(), cleanScale(bounds[1])];
};
// Because of "scaleBands" issue moving and growing for "reversed" band scales
// are not supported now.
var moveLinearScaleBounds = function (scale, bounds, delta) {
var fullRange = scale.range();
var sign = Math.sign(fullRange[1] - fullRange[0]);
var range = scaleBounds(scale, bounds);
var range = scaleLinearBounds(scale, bounds);
var r0 = range[0] + delta;

@@ -180,3 +195,3 @@ var r1 = range[1] + delta;

};
// Band case is processed separately to preserve categories amount in the bounds range.
// Band case is processed separately to preserve categories count in the bounds range.
// If common inversion mechanism is used start and end bounds cannot be inverted independently

@@ -210,4 +225,2 @@ // because of rounding issues which may add or remove categories to the new bounds.

};
/** @internal */
var moveBounds = function (scale, bounds, delta) { return ((scale.bandwidth ? moveBandScaleBounds : moveLinearScaleBounds)(scale, bounds, delta)); };
var growLinearScaleBounds = function (scale, bounds, delta, anchor) {

@@ -273,5 +286,2 @@ var fullRange = scale.range();

};
// "scaleBounds" would be a better name but "scale" is already occupied.
/** @internal */
var growBounds = function (scale, bounds, delta, anchor) { return ((scale.bandwidth ? growBandScaleBounds : growLinearScaleBounds)(scale, bounds, delta, anchor)); };
var invertLinearScaleBounds = function (scale, range) {

@@ -297,4 +307,14 @@ var fullRange = scale.range();

};
// Though these functions are used only in *Viewport* plugin (and so should be placed right there),
// they reside here so that internal scale specifics (*getWidth*)
// are encapsulated in this utility file.
/** @internal */
var invertBoundsRange = function (scale, range) { return ((scale.bandwidth ? invertBandScaleBounds : invertLinearScaleBounds)(scale, range)); };
var scaleBounds = makeScaleHelper(scaleLinearBounds, scaleBandBounds);
/** @internal */
var moveBounds = makeScaleHelper(moveLinearScaleBounds, moveBandScaleBounds);
// "scaleBounds" would be a better name but "scale" is already occupied.
/** @internal */
var growBounds = makeScaleHelper(growLinearScaleBounds, growBandScaleBounds);
/** @internal */
var invertBoundsRange = makeScaleHelper(invertLinearScaleBounds, invertBandScaleBounds);

@@ -389,16 +409,16 @@ var _a;

/** @internal */
var getRanges = function (paneSize) {
var getRanges = function (paneSize, rotated) {
var _a;
return (_a = {},
_a[ARGUMENT_DOMAIN] = [0, paneSize.width],
_a[VALUE_DOMAIN] = [paneSize.height, 0],
_a);
var horRange = [0, paneSize.width];
var verRange = [paneSize.height, 0];
return _a = {},
_a[ARGUMENT_DOMAIN] = rotated ? verRange : horRange,
_a[VALUE_DOMAIN] = rotated ? horRange : verRange,
_a;
};
var _a$1, _b;
var getTicks = function (scale, count) { return (scale.ticks ? scale.ticks(count) : scale.domain()); };
var createTicks = function (scale, count, callback) {
var fixedScale = fixOffset(scale);
return getTicks(scale, count)
.map(function (tick, index) { return callback(fixedScale(tick), String(index), tick); });
};
var createTicks = function (scale, count, callback) { return (getTicks(scale, count)
.map(function (tick, index) { return callback(scale(tick), String(index), tick); })); };
var getFormat = function (scale, count, tickFormat) {

@@ -410,2 +430,20 @@ if (scale.tickFormat) {

};
var rotatedPositions = (_a$1 = {},
_a$1[LEFT] = BOTTOM,
_a$1[RIGHT] = TOP,
_a$1[BOTTOM] = LEFT,
_a$1[TOP] = RIGHT,
_a$1);
var positionFlags = (_b = {},
_b[LEFT] = false,
_b[RIGHT] = false,
_b[BOTTOM] = true,
_b[TOP] = true,
_b);
/** @internal */
var getRotatedPosition = function (position) { return rotatedPositions[position]; };
/** @internal */
var isValidPosition = function (position, scaleName, rotated) {
return positionFlags[position] === isHorizontal(scaleName, rotated);
};
var createHorizontalOptions = function (position, tickSize, indentFromAxis) {

@@ -442,4 +480,4 @@ // Make *position* orientation agnostic - should be START or END.

var axisCoordinates = function (_a) {
var scaleName = _a.scaleName, scale = _a.scale, position = _a.position, tickSize = _a.tickSize, tickFormat = _a.tickFormat, indentFromAxis = _a.indentFromAxis, paneSize = _a.paneSize;
var isHor = isHorizontal(scaleName);
var scaleName = _a.scaleName, scale = _a.scale, position = _a.position, tickSize = _a.tickSize, tickFormat = _a.tickFormat, indentFromAxis = _a.indentFromAxis, paneSize = _a.paneSize, rotated = _a.rotated;
var isHor = isHorizontal(scaleName, rotated);
var options = (isHor ? createHorizontalOptions : createVerticalOptions)(position, tickSize, indentFromAxis);

@@ -466,4 +504,4 @@ var tickCount = getTickCount(scale.range(), paneSize[1 - Number(isHor)]);

var getGridCoordinates = function (_a) {
var scaleName = _a.scaleName, scale = _a.scale, paneSize = _a.paneSize;
var isHor = isHorizontal(scaleName);
var scaleName = _a.scaleName, scale = _a.scale, paneSize = _a.paneSize, rotated = _a.rotated;
var isHor = isHorizontal(scaleName, rotated);
var tickCount = getTickCount(scale.range(), paneSize[1 - Number(isHor)]);

@@ -474,29 +512,54 @@ var options = isHor ? horizontalGridOptions : verticalGridOptions;

var getX = function (_a) {
var x = _a.x;
return x;
var getArg = function (_a) {
var arg = _a.arg;
return arg;
};
var getY = function (_a) {
var y = _a.y;
return y;
var getVal = function (_a) {
var val = _a.val;
return val;
};
var getY1 = function (_a) {
var y1 = _a.y1;
return y1;
var getStartVal = function (_a) {
var startVal = _a.startVal;
return startVal;
};
/** @internal */
var dArea = area()
.x(getX)
.y1(getY)
.y0(getY1);
.x(getArg)
.y1(getVal)
.y0(getStartVal);
/** @internal */
var dRotateArea = area()
.x1(getStartVal)
.x0(getVal)
.y(getArg);
/** @internal */
var dLine = line()
.x(getX)
.y(getY);
.x(getArg)
.y(getVal);
/** @internal */
var dRotateLine = line()
.x(getVal)
.y(getArg);
/** @internal */
var dSpline = line()
.x(getX)
.y(getY)
.x(getArg)
.y(getVal)
.curve(curveMonotoneX);
/** @internal */
var dRotateSpline = line()
.x(getVal)
.y(getArg)
.curve(curveMonotoneY);
/** @internal */
var dBar = function (arg, val, startVal, width, rotated) {
var height = Math.abs(val - startVal);
var minVal = Math.min(val, startVal);
return {
x: rotated ? minVal : arg - width / 2,
y: rotated ? arg - width / 2 : minVal,
width: rotated ? height : width || 2,
height: rotated ? width || 2 : height,
};
};
/** @internal */
var getPiePointTransformer = function (_a) {

@@ -510,5 +573,3 @@ var argumentScale = _a.argumentScale, valueScale = _a.valueScale, points = _a.points;

var _a = pieData[point.index], startAngle = _a.startAngle, endAngle = _a.endAngle;
return __assign({}, point, { x: x,
y: y,
startAngle: startAngle,
return __assign({}, point, { arg: x, val: y, startAngle: startAngle,
endAngle: endAngle,

@@ -521,4 +582,3 @@ maxRadius: maxRadius });

var argumentScale = _a.argumentScale, valueScale = _a.valueScale;
var fixedArgumentScale = fixOffset(argumentScale);
return function (point) { return (__assign({}, point, { x: fixedArgumentScale(point.argument), y: valueScale(point.value) })); };
return function (point) { return (__assign({}, point, { arg: argumentScale(point.argument), val: valueScale(point.value) })); };
};

@@ -538,6 +598,6 @@ // Though transformations for line and scatter are the same,

var transform = getLinePointTransformer(series);
var y1 = series.valueScale(0);
var startVal = series.valueScale(0);
return function (point) {
var ret = transform(point);
return __assign({}, ret, { y1: y1 });
return __assign({}, ret, { startVal: startVal });
};

@@ -550,5 +610,4 @@ };

var argumentScale = _a.argumentScale, valueScale = _a.valueScale;
var y1 = valueScale(0);
var fixedArgumentScale = fixOffset(argumentScale);
return function (point) { return (__assign({}, point, { y1: y1, x: fixedArgumentScale(point.argument), y: valueScale(point.value), maxBarWidth: getWidth(argumentScale) })); };
var startVal = valueScale(0);
return function (point) { return (__assign({}, point, { arg: argumentScale(point.argument), val: valueScale(point.value), startVal: startVal, maxBarWidth: getWidth(argumentScale) })); };
};

@@ -563,10 +622,2 @@ // Used for domain calculation and stacking.

/** @internal */
var dBar = function (_a) {
var x = _a.x, y = _a.y, y1 = _a.y1, barWidth = _a.barWidth, maxBarWidth = _a.maxBarWidth;
var width = barWidth * maxBarWidth;
return {
x: x - width / 2, y: Math.min(y, y1), width: width || 2, height: Math.abs(y1 - y),
};
};
/** @internal */
var dSymbol = function (_a) {

@@ -586,11 +637,18 @@ var size = _a.size;

};
var getRect = function (cx, cy, dx, dy) { return ([cx - dx, cy - dy, cx + dx, cy + dy]); };
var getRect = function (cArg, cVal, dArg, dVal, rotated) {
var minArg = cArg - dArg;
var minVal = cVal - dVal;
var maxArg = cArg + dArg;
var maxVal = cVal + dVal;
return rotated ? [minVal, minArg, maxVal, maxArg] : [minArg, minVal, maxArg, maxVal];
};
getBarPointTransformer.getTargetElement = function (point) {
var _a = point, x = _a.x, y = _a.y, y1 = _a.y1, barWidth = _a.barWidth, maxBarWidth = _a.maxBarWidth;
var width = barWidth * maxBarWidth;
var height = Math.abs(y1 - y);
return getRect(x, y + height / 2, width / 2, height / 2);
var _a = point, arg = _a.arg, val = _a.val, startVal = _a.startVal, barWidth = _a.barWidth, maxBarWidth = _a.maxBarWidth, rotated = _a.rotated;
var halfWidth = barWidth * maxBarWidth / 2;
var halfHeight = Math.abs(startVal - val) / 2;
var centerVal = (val + startVal) / 2;
return getRect(arg, centerVal, halfWidth, halfHeight, rotated);
};
getPiePointTransformer.getTargetElement = function (point) {
var _a = point, x = _a.x, y = _a.y, innerRadius = _a.innerRadius, outerRadius = _a.outerRadius, maxRadius = _a.maxRadius, startAngle = _a.startAngle, endAngle = _a.endAngle;
var _a = point, x = _a.arg, y = _a.val, innerRadius = _a.innerRadius, outerRadius = _a.outerRadius, maxRadius = _a.maxRadius, startAngle = _a.startAngle, endAngle = _a.endAngle;
var center = arc().centroid({

@@ -604,13 +662,13 @@ startAngle: startAngle,

var cy = center[1] + y;
return getRect(cx, cy, 0.5, 0.5);
return getRect(cx, cy, 0.5, 0.5, false);
};
getAreaPointTransformer.getTargetElement = function (_a) {
var x = _a.x, y = _a.y;
return getRect(x, y, 1, 1);
var arg = _a.arg, val = _a.val, rotated = _a.rotated;
return (getRect(arg, val, 1, 1, rotated));
};
getLinePointTransformer.getTargetElement = getAreaPointTransformer.getTargetElement;
getScatterPointTransformer.getTargetElement = function (arg) {
var _a = arg, x = _a.x, y = _a.y, point = _a.point;
getScatterPointTransformer.getTargetElement = function (obj) {
var _a = obj, arg = _a.arg, val = _a.val, point = _a.point, rotated = _a.rotated;
var t = point.size / 2;
return getRect(x, y, t, t);
return getRect(arg, val, t, t, rotated);
};

@@ -653,9 +711,9 @@ var getUniqueName = function (list, name) {

// Make "scales" persistent first.
var scalePoints = function (series, scales) {
var scalePoints = function (series, scales, rotated) {
var transform = series.getPointTransformer(__assign({}, series, { argumentScale: scales[ARGUMENT_DOMAIN], valueScale: scales[getValueDomainName(series.scaleName)] }));
var ret = __assign({}, series, { points: series.points.map(transform) });
var ret = __assign({}, series, { rotated: rotated, points: series.points.map(function (point) { return (__assign({}, transform(point), { rotated: rotated })); }) });
return ret;
};
/** @internal */
var scaleSeriesPoints = function (series, scales) { return series.map(function (seriesItem) { return scalePoints(seriesItem, scales); }); };
var scaleSeriesPoints = function (series, scales, rotated) { return series.map(function (seriesItem) { return scalePoints(seriesItem, scales, rotated); }); };

@@ -680,3 +738,3 @@ // "Stack" plugin relies on "data" and "series" getters and

var ret = transform(point);
return __assign({}, ret, { y1: valueScale(point.value0) });
return __assign({}, ret, { startVal: valueScale(point.value0) });
};

@@ -756,3 +814,4 @@ };

var original = transform(point);
var result = __assign({}, original, { x: original.x - original.maxBarWidth * (0.5 - 0.5 * widthCoeff - groupOffset * widthCoeff), maxBarWidth: original.maxBarWidth / groupCount });
var arg = (original.arg - original.maxBarWidth * (0.5 - 0.5 * widthCoeff - groupOffset * widthCoeff));
var result = __assign({}, original, { arg: arg, maxBarWidth: original.maxBarWidth / groupCount });
return result;

@@ -840,5 +899,6 @@ };

};
var getAreaAnimationName = function () {
var getAreaAnimationName = function (rotated) {
var name = 'animation_transform';
addKeyframe(name, '{ from { transform: scaleY(0); } }');
var attr = rotated ? 'scaleX' : 'scaleY';
addKeyframe(name, "{ from { transform: " + attr + "(0); } }");
return name;

@@ -863,11 +923,14 @@ };

/** @internal */
var getAreaAnimationStyle = function (scales) {
var getAreaAnimationStyle = function (rotated, _a) {
var xScale = _a.xScale, yScale = _a.yScale;
var x = rotated ? xScale.copy().clamp(true)(0) : 0;
var y = rotated ? 0 : yScale.copy().clamp(true)(0);
var animationStyle = {
transformOrigin: "0px " + scales.yScale.copy().clamp(true)(0) + "px",
transformOrigin: x + "px " + y + "px",
};
var options = getDefaultAreaAnimationOptions();
return __assign({ animation: getAreaAnimationName() + " " + options }, animationStyle);
return __assign({ animation: getAreaAnimationName(rotated) + " " + options }, animationStyle);
};
/** @internal */
var getPieAnimationStyle = function (_, point) {
var getPieAnimationStyle = function (r, s, point) {
var options = getDefaultPieAnimationOptions(point);

@@ -886,6 +949,6 @@ return {

/** @internal */
var buildAnimatedStyleGetter = function (style, getAnimationStyle, scales, point) {
var animationStyle = getAnimationStyle(scales, point);
var buildAnimatedStyleGetter = function (rotated) { return function (style, getAnimationStyle, scales, point) {
var animationStyle = getAnimationStyle(rotated, scales, point);
return __assign({}, animationStyle, style);
};
}; };

@@ -1035,6 +1098,9 @@ // Comparing by reference is not an option as Tracker always sends new objects.

/** @internal */
var getViewport = function (scales, interactions, type, deltas, anchors, ranges, viewport, onViewportChange) {
var getViewport = function (scales, rotated, _a, type, deltas, anchors, ranges, viewport, onViewportChange) {
var _b = __read(_a, 2), argInteraction = _b[0], valInteraction = _b[1];
var argIndex = Number(rotated);
var valIndex = 1 - argIndex;
var changes = {};
var argumentBounds = boundsForScale(ARGUMENT_DOMAIN, scales, getArgumentBounds(viewport), interactions[0], type, deltas ? deltas[0] : 0, anchors ? anchors[0] : 0, ranges ? ranges[0] : undefined);
var valueBounds = boundsForScale(getValueScaleName(viewport), scales, getValueBounds(viewport), interactions[1], type, deltas ? deltas[1] : 0, anchors ? anchors[1] : 0, ranges ? ranges[1] : undefined);
var argumentBounds = boundsForScale(ARGUMENT_DOMAIN, scales, getArgumentBounds(viewport), argInteraction, type, deltas ? deltas[argIndex] : 0, anchors ? anchors[argIndex] : 0, ranges ? ranges[argIndex] : undefined);
var valueBounds = boundsForScale(getValueScaleName(viewport), scales, getValueBounds(viewport), valInteraction, type, deltas ? deltas[valIndex] : 0, anchors ? anchors[valIndex] : 0, ranges ? ranges[valIndex] : undefined);
if (argumentBounds) {

@@ -1090,9 +1156,11 @@ changes.argumentStart = argumentBounds[0];

/** @internal */
var getRect$1 = function (interactionWithArguments, interactionWithValues, initial, current, pane) {
var getRect$1 = function (rotated, interactionWithArguments, interactionWithValues, initial, current, pane) {
var isZoomArgument = checkInteraction(interactionWithArguments, 'zoom');
var isZoomValue = checkInteraction(interactionWithValues, 'zoom');
var x = isZoomArgument ? Math.min(initial[0], current[0]) : 0;
var width = isZoomArgument ? Math.abs(initial[0] - current[0]) : pane.width;
var y = isZoomValue ? Math.min(initial[1], current[1]) : 0;
var height = isZoomValue ? Math.abs(initial[1] - current[1]) : pane.height;
var isXFixed = rotated ? isZoomValue : isZoomArgument;
var isYFixed = rotated ? isZoomArgument : isZoomValue;
var x = isXFixed ? Math.min(initial[0], current[0]) : 0;
var width = isXFixed ? Math.abs(initial[0] - current[0]) : pane.width;
var y = isYFixed ? Math.min(initial[1], current[1]) : 0;
var height = isYFixed ? Math.abs(initial[1] - current[1]) : pane.height;
return {

@@ -1102,5 +1170,3 @@ x: x, y: y, width: width, height: height,

};
var checkInteraction = function (interaction, type) {
return interaction === 'both' || interaction === type;
};
var checkInteraction = function (interaction, type) { return (interaction === 'both' || interaction === type); };

@@ -1119,5 +1185,5 @@ var getSegmentLength = function (dx, dy) { return Math.sqrt(dx * dx + dy * dy); };

// Can't d3 perform hit testing?
var createCanvasAbusingHitTester = function (makePath, points) {
var createCanvasAbusingHitTester = function (makePath, points, rotated) {
var ctx = createContext();
var path = makePath();
var path = makePath(rotated);
path.context(ctx);

@@ -1132,9 +1198,11 @@ path(points);

var LINE_TOLERANCE = 10;
var getContinuousPointDistance = function (_a, _b) {
var getDistance = function (_a, _b, rotated) {
var _c = __read(_a, 2), px = _c[0], py = _c[1];
var x = _b.x, y = _b.y;
var arg = _b.arg, val = _b.val;
var x = rotated ? val : arg;
var y = rotated ? arg : val;
return getSegmentLength(px - x, py - y);
};
var createContinuousSeriesHitTesterCreator = function (makePath) { return function (points) {
var fallbackHitTest = createCanvasAbusingHitTester(makePath, points);
var createContinuousSeriesHitTesterCreator = function (makePath) { return function (points, rotated) {
var fallbackHitTest = createCanvasAbusingHitTester(makePath, points, rotated);
return function (target) {

@@ -1145,3 +1213,3 @@ var minDistance = Number.MAX_VALUE;

points.forEach(function (point, i) {
var distance = getContinuousPointDistance(target, point);
var distance = getDistance(target, point, rotated);
if (distance <= LINE_POINT_SIZE) {

@@ -1163,6 +1231,6 @@ list.push({ distance: distance, index: point.index });

}; };
var createPointsEnumeratingHitTesterCreator = function (hitTestPoint) { return function (points) { return function (target) {
var createPointsEnumeratingHitTesterCreator = function (hitTestPoint) { return function (points, rotated) { return function (target) {
var list = [];
points.forEach(function (point) {
var status = hitTestPoint(target, point);
var status = hitTestPoint(target, point, rotated);
if (status) {

@@ -1175,26 +1243,52 @@ list.push({ index: point.index, distance: status.distance });

/** @internal */
var createAreaHitTester = createContinuousSeriesHitTesterCreator(function () {
var createAreaHitTester = createContinuousSeriesHitTesterCreator(function (rotated) {
var path = area();
path.x(dArea.x());
path.y1(dArea.y1());
path.y0(dArea.y0());
var hitArea = rotated ? dRotateArea : dArea;
if (rotated) {
path.x1(hitArea.x1());
path.x0(hitArea.x0());
path.y(hitArea.y());
}
else {
path.x(hitArea.x());
path.y1(hitArea.y1());
path.y0(hitArea.y0());
}
return path;
});
/** @internal */
var createLineHitTester = createContinuousSeriesHitTesterCreator(function () {
var createLineHitTester = createContinuousSeriesHitTesterCreator(function (rotated) {
var path = area();
var getY = dLine.y();
path.x(dLine.x());
path.y1(function (point) { return getY(point) - LINE_TOLERANCE; });
path.y0(function (point) { return getY(point) + LINE_TOLERANCE; });
var hitLine = rotated ? dRotateLine : dLine;
if (rotated) {
var getX_1 = hitLine.x();
path.y(hitLine.y());
path.x0(function (point) { return getX_1(point) + LINE_TOLERANCE; });
path.x1(function (point) { return getX_1(point) - LINE_TOLERANCE; });
}
else {
var getY_1 = hitLine.y();
path.x(hitLine.x());
path.y1(function (point) { return getY_1(point) - LINE_TOLERANCE; });
path.y0(function (point) { return getY_1(point) + LINE_TOLERANCE; });
}
return path;
});
/** @internal */
var createSplineHitTester = createContinuousSeriesHitTesterCreator(function () {
var createSplineHitTester = createContinuousSeriesHitTesterCreator(function (rotated) {
var path = area();
var getY = dSpline.y();
path.x(dSpline.x());
path.y1(function (point) { return getY(point) - LINE_TOLERANCE; });
path.y0(function (point) { return getY(point) + LINE_TOLERANCE; });
path.curve(dSpline.curve());
var hitSpline = rotated ? dRotateSpline : dSpline;
if (rotated) {
var getX_2 = hitSpline.x();
path.y(hitSpline.y());
path.x1(function (point) { return getX_2(point) - LINE_TOLERANCE; });
path.x0(function (point) { return getX_2(point) + LINE_TOLERANCE; });
}
else {
var getY_2 = hitSpline.y();
path.x(hitSpline.x());
path.y1(function (point) { return getY_2(point) - LINE_TOLERANCE; });
path.y0(function (point) { return getY_2(point) + LINE_TOLERANCE; });
}
path.curve(hitSpline.curve());
return path;

@@ -1207,16 +1301,17 @@ });

/** @internal */
var createBarHitTester = createPointsEnumeratingHitTesterCreator(function (_a, point) {
var createBarHitTester = createPointsEnumeratingHitTesterCreator(function (_a, point, rotated) {
var _b = __read(_a, 2), px = _b[0], py = _b[1];
var _c = point, x = _c.x, y = _c.y, y1 = _c.y1, barWidth = _c.barWidth, maxBarWidth = _c.maxBarWidth;
var xCenter = x;
var yCenter = (y + y1) / 2;
var _c = point, arg = _c.arg, val = _c.val, startVal = _c.startVal, barWidth = _c.barWidth, maxBarWidth = _c.maxBarWidth;
var halfWidth = maxBarWidth * barWidth / 2;
var halfHeight = Math.abs(y - y1) / 2;
return hitTestRect(px - xCenter, py - yCenter, halfWidth, halfHeight);
var halfHeight = Math.abs(val - startVal) / 2;
var centerVal = (val + startVal) / 2;
var xCenter = rotated ? centerVal : arg;
var yCenter = rotated ? arg : centerVal;
return hitTestRect(px - xCenter, py - yCenter, rotated ? halfHeight : halfWidth, rotated ? halfWidth : halfHeight);
});
/** @internal */
var createScatterHitTester = createPointsEnumeratingHitTesterCreator(function (_a, obj) {
var createScatterHitTester = createPointsEnumeratingHitTesterCreator(function (_a, obj, rotated) {
var _b = __read(_a, 2), px = _b[0], py = _b[1];
var _c = obj, x = _c.x, y = _c.y, point = _c.point;
var distance = getSegmentLength(px - x, py - y);
var point = obj.point;
var distance = getDistance([px, py], obj, rotated);
return distance <= point.size / 2 ? { distance: distance } : null;

@@ -1232,3 +1327,3 @@ });

var _b = __read(_a, 2), px = _b[0], py = _b[1];
var _c = point, x = _c.x, y = _c.y, innerRadius = _c.innerRadius, outerRadius = _c.outerRadius, startAngle = _c.startAngle, maxRadius = _c.maxRadius, endAngle = _c.endAngle;
var _c = point, x = _c.arg, y = _c.val, innerRadius = _c.innerRadius, outerRadius = _c.outerRadius, startAngle = _c.startAngle, maxRadius = _c.maxRadius, endAngle = _c.endAngle;
var inner = innerRadius * maxRadius;

@@ -1310,3 +1405,3 @@ var outer = outerRadius * maxRadius;

obj[seriesItem.symbolName] = seriesItem
.createHitTester(seriesItem.points);
.createHitTester(seriesItem.points, seriesItem.rotated);
});

@@ -1366,3 +1461,3 @@ return obj;

export { ARGUMENT_DOMAIN, BAND, BOTTOM, END, HORIZONTAL, HOVERED, LEFT, LINEAR, MIDDLE, RIGHT, SELECTED, START, TOP, VALUE_DOMAIN, VERTICAL, addDomain, addSeries, adjustLayout, attachEvents, axisCoordinates, bBoxes, buildAnimatedStyleGetter, buildEventHandlers, buildScales, changeSeriesState, createAreaHitTester, createBarHitTester, createLineHitTester, createPieHitTester, createReference, createScatterHitTester, createSplineHitTester, createTickFilter, dArea, dBar, dLine, dPie, dSpline, dSymbol, defaultDomains, detachEvents, extendDomains, findSeriesByName, fixOffset, getAreaAnimationStyle, getAreaPointTransformer, getBarPointTransformer, getDeltaForTouches, getEventCoords, getGridCoordinates, getLegendItems, getLinePointTransformer, getOffset, getParameters, getPieAnimationStyle, getPiePointTransformer, getRanges, getRect$1 as getRect, getScatterAnimationStyle, getScatterPointTransformer, getStackedDomains, getStackedSeries, getValueDomainName, getViewport, getWheelDelta, getWidth, growBounds, invertBoundsRange, isHorizontal, isKeyPressed, isMultiTouch, makeScale, moveBounds, processHandleTooltip, processPointerMove, rangesEqual, scaleBand, scaleBounds, scaleLinear, scaleSeriesPoints, updateDomainItems };
export { ARGUMENT_DOMAIN, BAND, BOTTOM, END, HORIZONTAL, HOVERED, LEFT, LINEAR, MIDDLE, RIGHT, SELECTED, START, TOP, VALUE_DOMAIN, VERTICAL, addDomain, addSeries, adjustLayout, attachEvents, axisCoordinates, bBoxes, buildAnimatedStyleGetter, buildEventHandlers, buildScales, changeSeriesState, createAreaHitTester, createBarHitTester, createLineHitTester, createPieHitTester, createReference, createScatterHitTester, createSplineHitTester, createTickFilter, dArea, dBar, dLine, dPie, dRotateArea, dRotateLine, dRotateSpline, dSpline, dSymbol, defaultDomains, detachEvents, extendDomains, findSeriesByName, getAreaAnimationStyle, getAreaPointTransformer, getBarPointTransformer, getDeltaForTouches, getEventCoords, getGridCoordinates, getLegendItems, getLinePointTransformer, getOffset, getParameters, getPieAnimationStyle, getPiePointTransformer, getRanges, getRect$1 as getRect, getRotatedPosition, getScatterAnimationStyle, getScatterPointTransformer, getStackedDomains, getStackedSeries, getValueDomainName, getViewport, getWheelDelta, getWidth, growBounds, invertBoundsRange, isHorizontal, isKeyPressed, isMultiTouch, isValidPosition, makeScale, moveBounds, processHandleTooltip, processPointerMove, rangesEqual, scaleBand, scaleBounds, scaleLinear, scaleSeriesPoints, updateDomainItems };
//# sourceMappingURL=dx-chart-core.es.js.map
{
"name": "@devexpress/dx-chart-core",
"version": "1.11.1",
"version": "2.0.0",
"description": "Core library for the DevExtreme Reactive Chart component",

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

},
"gitHead": "1e024a4be45e7b7141404f5a2fbf7b2f9c1d7afa"
"gitHead": "d7aa247ebebd08f5d99aebf60d0c91d7d3fffd18"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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