initial commit
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
/* *
|
||||
* (c) 2010-2017 Christer Vasseng, Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import H from '../parts/Globals.js';
|
||||
|
||||
/**
|
||||
* @interface Highcharts.AjaxSettings
|
||||
*//**
|
||||
* The URL to call.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#url
|
||||
* @type {string}
|
||||
*//**
|
||||
* The verb to use.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#type
|
||||
* @type {"get"|"post"|"update"|"delete"}
|
||||
*//**
|
||||
* The data type expected.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#dataType
|
||||
* @type {"json"|"xml"|"text"|"octet"}
|
||||
*//**
|
||||
* Function to call on success.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#success
|
||||
* @type {Function}
|
||||
*//**
|
||||
* Function to call on error.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#error
|
||||
* @type {Function}
|
||||
*//**
|
||||
* The payload to send.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#data
|
||||
* @type {object}
|
||||
*//**
|
||||
* The headers; keyed on header name.
|
||||
*
|
||||
* @name Highcharts.AjaxSettings#headers
|
||||
* @type {object}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Perform an Ajax call.
|
||||
*
|
||||
* @function Highcharts.ajax
|
||||
*
|
||||
* @param {Highcharts.AjaxSettings} attr
|
||||
* The Ajax settings to use.
|
||||
*/
|
||||
H.ajax = function (attr) {
|
||||
var options = H.merge(true, {
|
||||
url: false,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: false,
|
||||
error: false,
|
||||
data: false,
|
||||
headers: {}
|
||||
}, attr),
|
||||
headers = {
|
||||
json: 'application/json',
|
||||
xml: 'application/xml',
|
||||
text: 'text/plain',
|
||||
octet: 'application/octet-stream'
|
||||
},
|
||||
r = new XMLHttpRequest();
|
||||
|
||||
function handleError(xhr, err) {
|
||||
if (options.error) {
|
||||
options.error(xhr, err);
|
||||
} else {
|
||||
// Maybe emit a highcharts error event here
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
r.open(options.type.toUpperCase(), options.url, true);
|
||||
r.setRequestHeader(
|
||||
'Content-Type',
|
||||
headers[options.dataType] || headers.text
|
||||
);
|
||||
|
||||
H.objectEach(options.headers, function (val, key) {
|
||||
r.setRequestHeader(key, val);
|
||||
});
|
||||
|
||||
r.onreadystatechange = function () {
|
||||
var res;
|
||||
|
||||
if (r.readyState === 4) {
|
||||
if (r.status === 200) {
|
||||
res = r.responseText;
|
||||
if (options.dataType === 'json') {
|
||||
try {
|
||||
res = JSON.parse(res);
|
||||
} catch (e) {
|
||||
return handleError(r, e);
|
||||
}
|
||||
}
|
||||
return options.success && options.success(res);
|
||||
}
|
||||
|
||||
handleError(r, r.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
options.data = JSON.stringify(options.data);
|
||||
} catch (e) {}
|
||||
|
||||
r.send(options.data || true);
|
||||
};
|
||||
@@ -0,0 +1,116 @@
|
||||
/* *
|
||||
* (c) 2010-2019 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @typedef Highcharts.RadianAngles
|
||||
*
|
||||
* @property {number} start
|
||||
*
|
||||
* @property {number} end
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Utilities.js';
|
||||
|
||||
var deg2rad = H.deg2rad,
|
||||
isNumber = H.isNumber,
|
||||
pick = H.pick,
|
||||
relativeLength = H.relativeLength;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @mixin Highcharts.CenteredSeriesMixin
|
||||
*/
|
||||
H.CenteredSeriesMixin = {
|
||||
|
||||
/**
|
||||
* Get the center of the pie based on the size and center options relative
|
||||
* to the plot area. Borrowed by the polar and gauge series types.
|
||||
*
|
||||
* @private
|
||||
* @function Highcharts.CenteredSeriesMixin.getCenter
|
||||
*
|
||||
* @return {Array<number>}
|
||||
*/
|
||||
getCenter: function () {
|
||||
|
||||
var options = this.options,
|
||||
chart = this.chart,
|
||||
slicingRoom = 2 * (options.slicedOffset || 0),
|
||||
handleSlicingRoom,
|
||||
plotWidth = chart.plotWidth - 2 * slicingRoom,
|
||||
plotHeight = chart.plotHeight - 2 * slicingRoom,
|
||||
centerOption = options.center,
|
||||
positions = [
|
||||
pick(centerOption[0], '50%'),
|
||||
pick(centerOption[1], '50%'),
|
||||
options.size || '100%',
|
||||
options.innerSize || 0
|
||||
],
|
||||
smallestSize = Math.min(plotWidth, plotHeight),
|
||||
i,
|
||||
value;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
value = positions[i];
|
||||
handleSlicingRoom = i < 2 || (i === 2 && /%$/.test(value));
|
||||
|
||||
// i == 0: centerX, relative to width
|
||||
// i == 1: centerY, relative to height
|
||||
// i == 2: size, relative to smallestSize
|
||||
// i == 3: innerSize, relative to size
|
||||
positions[i] = relativeLength(
|
||||
value,
|
||||
[plotWidth, plotHeight, smallestSize, positions[2]][i]
|
||||
) + (handleSlicingRoom ? slicingRoom : 0);
|
||||
|
||||
}
|
||||
// innerSize cannot be larger than size (#3632)
|
||||
if (positions[3] > positions[2]) {
|
||||
positions[3] = positions[2];
|
||||
}
|
||||
return positions;
|
||||
},
|
||||
|
||||
/**
|
||||
* getStartAndEndRadians - Calculates start and end angles in radians.
|
||||
* Used in series types such as pie and sunburst.
|
||||
*
|
||||
* @private
|
||||
* @function Highcharts.CenteredSeriesMixin.getStartAndEndRadians
|
||||
*
|
||||
* @param {number} start
|
||||
* Start angle in degrees.
|
||||
*
|
||||
* @param {number} end
|
||||
* Start angle in degrees.
|
||||
*
|
||||
* @return {Highcharts.RadianAngles}
|
||||
* Returns an object containing start and end angles as radians.
|
||||
*/
|
||||
getStartAndEndRadians: function getStartAndEndRadians(start, end) {
|
||||
var startAngle = isNumber(start) ? start : 0, // must be a number
|
||||
endAngle = (
|
||||
(
|
||||
isNumber(end) && // must be a number
|
||||
end > startAngle && // must be larger than the start angle
|
||||
// difference must be less than 360 degrees
|
||||
(end - startAngle) < 360
|
||||
) ?
|
||||
end :
|
||||
startAngle + 360
|
||||
),
|
||||
correction = -90;
|
||||
|
||||
return {
|
||||
start: deg2rad * (startAngle + correction),
|
||||
end: deg2rad * (endAngle + correction)
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,150 @@
|
||||
'use strict';
|
||||
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Series.js';
|
||||
|
||||
var Series = H.Series,
|
||||
addEvent = H.addEvent,
|
||||
noop = H.noop;
|
||||
|
||||
|
||||
/* ************************************************************************** *
|
||||
*
|
||||
* DERIVED SERIES MIXIN
|
||||
*
|
||||
* ************************************************************************** */
|
||||
|
||||
/**
|
||||
* Provides methods for auto setting/updating series data based on the based
|
||||
* series data.
|
||||
*
|
||||
* @private
|
||||
* @mixin derivedSeriesMixin
|
||||
*/
|
||||
var derivedSeriesMixin = {
|
||||
/**
|
||||
* Initialise series
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.init
|
||||
*/
|
||||
init: function () {
|
||||
Series.prototype.init.apply(this, arguments);
|
||||
|
||||
this.initialised = false;
|
||||
this.baseSeries = null;
|
||||
this.eventRemovers = [];
|
||||
|
||||
this.addEvents();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method to be implemented - inside the method the series has already
|
||||
* access to the base series via m `this.baseSeries` and the bases data is
|
||||
* initialised. It should return data in the format accepted by
|
||||
* `Series.setData()` method
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.setDerivedData
|
||||
*
|
||||
* @return {Array<*>}
|
||||
* An array of data
|
||||
*/
|
||||
setDerivedData: noop,
|
||||
|
||||
/**
|
||||
* Sets base series for the series
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.setBaseSeries
|
||||
*/
|
||||
setBaseSeries: function () {
|
||||
var chart = this.chart,
|
||||
baseSeriesOptions = this.options.baseSeries,
|
||||
baseSeries =
|
||||
baseSeriesOptions &&
|
||||
(chart.series[baseSeriesOptions] || chart.get(baseSeriesOptions));
|
||||
|
||||
this.baseSeries = baseSeries || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds events for the series
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.addEvents
|
||||
*/
|
||||
addEvents: function () {
|
||||
var derivedSeries = this,
|
||||
chartSeriesLinked;
|
||||
|
||||
chartSeriesLinked = addEvent(
|
||||
this.chart,
|
||||
'afterLinkSeries',
|
||||
function () {
|
||||
derivedSeries.setBaseSeries();
|
||||
|
||||
if (derivedSeries.baseSeries && !derivedSeries.initialised) {
|
||||
derivedSeries.setDerivedData();
|
||||
derivedSeries.addBaseSeriesEvents();
|
||||
derivedSeries.initialised = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.eventRemovers.push(
|
||||
chartSeriesLinked
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds events to the base series - it required for recalculating the data
|
||||
* in the series if the base series is updated / removed / etc.
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.addBaseSeriesEvents
|
||||
*/
|
||||
addBaseSeriesEvents: function () {
|
||||
var derivedSeries = this,
|
||||
updatedDataRemover,
|
||||
destroyRemover;
|
||||
|
||||
updatedDataRemover = addEvent(
|
||||
derivedSeries.baseSeries,
|
||||
'updatedData',
|
||||
function () {
|
||||
derivedSeries.setDerivedData();
|
||||
}
|
||||
);
|
||||
|
||||
destroyRemover = addEvent(
|
||||
derivedSeries.baseSeries,
|
||||
'destroy',
|
||||
function () {
|
||||
derivedSeries.baseSeries = null;
|
||||
derivedSeries.initialised = false;
|
||||
}
|
||||
);
|
||||
|
||||
derivedSeries.eventRemovers.push(
|
||||
updatedDataRemover,
|
||||
destroyRemover
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys the series
|
||||
*
|
||||
* @private
|
||||
* @function derivedSeriesMixin.destroy
|
||||
*/
|
||||
destroy: function () {
|
||||
this.eventRemovers.forEach(function (remover) {
|
||||
remover();
|
||||
});
|
||||
|
||||
Series.prototype.destroy.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
export default derivedSeriesMixin;
|
||||
@@ -0,0 +1,103 @@
|
||||
/* *
|
||||
* Mixin for downloading content in the browser
|
||||
*
|
||||
* (c) 2015-2019 Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import Highcharts from '../parts/Globals.js';
|
||||
|
||||
var win = Highcharts.win,
|
||||
nav = win.navigator,
|
||||
doc = win.document,
|
||||
domurl = win.URL || win.webkitURL || win,
|
||||
isEdgeBrowser = /Edge\/\d+/.test(nav.userAgent);
|
||||
|
||||
// Convert base64 dataURL to Blob if supported, otherwise returns undefined
|
||||
Highcharts.dataURLtoBlob = function (dataURL) {
|
||||
var parts = dataURL.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/);
|
||||
|
||||
if (
|
||||
parts &&
|
||||
parts.length > 3 &&
|
||||
win.atob &&
|
||||
win.ArrayBuffer &&
|
||||
win.Uint8Array &&
|
||||
win.Blob &&
|
||||
domurl.createObjectURL
|
||||
) {
|
||||
// Try to convert data URL to Blob
|
||||
var binStr = win.atob(parts[3]),
|
||||
buf = new win.ArrayBuffer(binStr.length),
|
||||
binary = new win.Uint8Array(buf),
|
||||
blob;
|
||||
|
||||
for (var i = 0; i < binary.length; ++i) {
|
||||
binary[i] = binStr.charCodeAt(i);
|
||||
}
|
||||
|
||||
blob = new win.Blob([binary], { 'type': parts[1] });
|
||||
return domurl.createObjectURL(blob);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Download a data URL in the browser. Can also take a blob as first param.
|
||||
*
|
||||
* @private
|
||||
* @function Highcharts.downloadURL
|
||||
*
|
||||
* @param {string|object} dataURL
|
||||
* The dataURL/Blob to download
|
||||
*
|
||||
* @param {string} filename
|
||||
* The name of the resulting file (w/extension)
|
||||
*/
|
||||
Highcharts.downloadURL = function (dataURL, filename) {
|
||||
var a = doc.createElement('a'),
|
||||
windowRef;
|
||||
|
||||
// IE specific blob implementation
|
||||
// Don't use for normal dataURLs
|
||||
if (
|
||||
typeof dataURL !== 'string' &&
|
||||
!(dataURL instanceof String) &&
|
||||
nav.msSaveOrOpenBlob
|
||||
) {
|
||||
nav.msSaveOrOpenBlob(dataURL, filename);
|
||||
return;
|
||||
}
|
||||
|
||||
// Some browsers have limitations for data URL lengths. Try to convert to
|
||||
// Blob or fall back. Edge always needs that blob.
|
||||
if (isEdgeBrowser || dataURL.length > 2000000) {
|
||||
dataURL = Highcharts.dataURLtoBlob(dataURL);
|
||||
if (!dataURL) {
|
||||
throw new Error('Failed to convert to blob');
|
||||
}
|
||||
}
|
||||
|
||||
// Try HTML5 download attr if supported
|
||||
if (a.download !== undefined) {
|
||||
a.href = dataURL;
|
||||
a.download = filename; // HTML5 download attribute
|
||||
doc.body.appendChild(a);
|
||||
a.click();
|
||||
doc.body.removeChild(a);
|
||||
} else {
|
||||
// No download attr, just opening data URI
|
||||
try {
|
||||
windowRef = win.open(dataURL, 'chart');
|
||||
if (windowRef === undefined || windowRef === null) {
|
||||
throw new Error('Failed to open window');
|
||||
}
|
||||
} catch (e) {
|
||||
// window.open failed, trying location.href
|
||||
win.location.href = dataURL;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
var isFn = function (x) {
|
||||
return typeof x === 'function';
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles the drawing of a point.
|
||||
*
|
||||
* @private
|
||||
* @function draw
|
||||
*
|
||||
* @param {object} params
|
||||
* Parameters.
|
||||
*
|
||||
* @todo
|
||||
* - add type checking.
|
||||
*/
|
||||
var draw = function draw(params) {
|
||||
var point = this,
|
||||
graphic = point.graphic,
|
||||
animatableAttribs = params.animatableAttribs,
|
||||
onComplete = params.onComplete,
|
||||
css = params.css,
|
||||
renderer = params.renderer;
|
||||
|
||||
if (point.shouldDraw()) {
|
||||
if (!graphic) {
|
||||
point.graphic = graphic =
|
||||
renderer[params.shapeType](params.shapeArgs).add(params.group);
|
||||
}
|
||||
graphic
|
||||
.css(css)
|
||||
.attr(params.attribs)
|
||||
.animate(
|
||||
animatableAttribs,
|
||||
params.isNew ? false : undefined,
|
||||
onComplete
|
||||
);
|
||||
} else if (graphic) {
|
||||
graphic.animate(animatableAttribs, undefined, function () {
|
||||
point.graphic = graphic = graphic.destroy();
|
||||
if (isFn(onComplete)) {
|
||||
onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (graphic) {
|
||||
graphic.addClass(point.getClassName(), true);
|
||||
}
|
||||
};
|
||||
|
||||
export default draw;
|
||||
@@ -0,0 +1,300 @@
|
||||
import geometry from './geometry.js';
|
||||
var getAngleBetweenPoints = geometry.getAngleBetweenPoints,
|
||||
getCenterOfPoints = geometry.getCenterOfPoints,
|
||||
getDistanceBetweenPoints = geometry.getDistanceBetweenPoints;
|
||||
|
||||
var round = function round(x, decimals) {
|
||||
var a = Math.pow(10, decimals);
|
||||
|
||||
return Math.round(x * a) / a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the area of a circular segment based on the radius of the circle
|
||||
* and the height of the segment.
|
||||
* See http://mathworld.wolfram.com/CircularSegment.html
|
||||
*
|
||||
* @param {number} r The radius of the circle.
|
||||
* @param {number} h The height of the circular segment.
|
||||
* @returns {number} Returns the area of the circular segment.
|
||||
*/
|
||||
var getCircularSegmentArea = function getCircularSegmentArea(r, h) {
|
||||
return r * r * Math.acos(1 - h / r) - (r - h) * Math.sqrt(h * (2 * r - h));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the area of overlap between two circles based on their radiuses
|
||||
* and the distance between them.
|
||||
* See http://mathworld.wolfram.com/Circle-CircleIntersection.html
|
||||
*
|
||||
* @param {number} r1 Radius of the first circle.
|
||||
* @param {number} r2 Radius of the second circle.
|
||||
* @param {number} d The distance between the two circles.
|
||||
* @returns {number} Returns the area of overlap between the two circles.
|
||||
*/
|
||||
var getOverlapBetweenCircles =
|
||||
function getOverlapBetweenCircles(r1, r2, d) {
|
||||
var overlap = 0;
|
||||
|
||||
// If the distance is larger than the sum of the radiuses then the circles
|
||||
// does not overlap.
|
||||
if (d < r1 + r2) {
|
||||
var r1Square = r1 * r1,
|
||||
r2Square = r2 * r2;
|
||||
|
||||
if (d <= Math.abs(r2 - r1)) {
|
||||
// If the circles are completely overlapping, then the overlap
|
||||
// equals the area of the smallest circle.
|
||||
overlap = Math.PI * Math.min(r1Square, r2Square);
|
||||
} else {
|
||||
// Height of first triangle segment.
|
||||
var d1 = (r1Square - r2Square + d * d) / (2 * d),
|
||||
// Height of second triangle segment.
|
||||
d2 = d - d1;
|
||||
|
||||
overlap = (
|
||||
getCircularSegmentArea(r1, r1 - d1) +
|
||||
getCircularSegmentArea(r2, r2 - d2)
|
||||
);
|
||||
}
|
||||
// Round the result to two decimals.
|
||||
overlap = round(overlap, 14);
|
||||
}
|
||||
return overlap;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the intersection points of two circles.
|
||||
*
|
||||
* NOTE: does not handle floating errors well.
|
||||
*
|
||||
* @param {object} c1 The first circle.s
|
||||
* @param {object} c2 The second sircle.
|
||||
* @returns {array} Returns the resulting intersection points.
|
||||
*/
|
||||
var getCircleCircleIntersection =
|
||||
function getCircleCircleIntersection(c1, c2) {
|
||||
var d = getDistanceBetweenPoints(c1, c2),
|
||||
r1 = c1.r,
|
||||
r2 = c2.r,
|
||||
points = [];
|
||||
|
||||
if (d < r1 + r2 && d > Math.abs(r1 - r2)) {
|
||||
// If the circles are overlapping, but not completely overlapping, then
|
||||
// it exists intersecting points.
|
||||
var r1Square = r1 * r1,
|
||||
r2Square = r2 * r2,
|
||||
// d^2 - r^2 + R^2 / 2d
|
||||
x = (r1Square - r2Square + d * d) / (2 * d),
|
||||
// y^2 = R^2 - x^2
|
||||
y = Math.sqrt(r1Square - x * x),
|
||||
x1 = c1.x,
|
||||
x2 = c2.x,
|
||||
y1 = c1.y,
|
||||
y2 = c2.y,
|
||||
x0 = x1 + x * (x2 - x1) / d,
|
||||
y0 = y1 + x * (y2 - y1) / d,
|
||||
rx = -(y2 - y1) * (y / d),
|
||||
ry = -(x2 - x1) * (y / d);
|
||||
|
||||
points = [
|
||||
{ x: round(x0 + rx, 14), y: round(y0 - ry, 14) },
|
||||
{ x: round(x0 - rx, 14), y: round(y0 + ry, 14) }
|
||||
];
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates all the intersection points for between a list of circles.
|
||||
*
|
||||
* @param {array} circles The circles to calculate the points from.
|
||||
* @returns {array} Returns a list of intersection points.
|
||||
*/
|
||||
var getCirclesIntersectionPoints = function getIntersectionPoints(circles) {
|
||||
return circles.reduce(function (points, c1, i, arr) {
|
||||
var additional = arr.slice(i + 1)
|
||||
.reduce(function (points, c2, j) {
|
||||
var indexes = [i, j + i + 1];
|
||||
|
||||
return points.concat(
|
||||
getCircleCircleIntersection(c1, c2)
|
||||
.map(function (p) {
|
||||
p.indexes = indexes;
|
||||
return p;
|
||||
})
|
||||
);
|
||||
}, []);
|
||||
|
||||
return points.concat(additional);
|
||||
}, []);
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests wether a point lies within a given circle.
|
||||
*
|
||||
* @param {object} point The point to test for.
|
||||
* @param {object} circle The circle to test if the point is within.
|
||||
* @returns {boolean} Returns true if the point is inside, false if outside.
|
||||
*/
|
||||
var isPointInsideCircle = function isPointInsideCircle(point, circle) {
|
||||
return getDistanceBetweenPoints(point, circle) <= circle.r + 1e-10;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests wether a point lies within a set of circles.
|
||||
*
|
||||
* @param {object} point The point to test.
|
||||
* @param {array} circles The list of circles to test against.
|
||||
* @returns {boolean} Returns true if the point is inside all the circles, false
|
||||
* if not.
|
||||
*/
|
||||
var isPointInsideAllCircles = function isPointInsideAllCircles(point, circles) {
|
||||
return !circles.some(function (circle) {
|
||||
return !isPointInsideCircle(point, circle);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests wether a point lies outside a set of circles.
|
||||
*
|
||||
* TODO: add unit tests.
|
||||
*
|
||||
* @param {object} point The point to test.
|
||||
* @param {array} circles The list of circles to test against.
|
||||
* @returns {boolean} Returns true if the point is outside all the circles,
|
||||
* false if not.
|
||||
*/
|
||||
var isPointOutsideAllCircles =
|
||||
function isPointOutsideAllCircles(point, circles) {
|
||||
return !circles.some(function (circle) {
|
||||
return isPointInsideCircle(point, circle);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the path for the area of overlap between a set of circles.
|
||||
*
|
||||
* TODO: handle cases with only 1 or 0 arcs.
|
||||
*
|
||||
* @param {array} circles List of circles to calculate area of.
|
||||
* @returns {string} Returns the path for the area of overlap. Returns an empty
|
||||
* string if there are no intersection between all the circles.
|
||||
*/
|
||||
var getAreaOfIntersectionBetweenCircles =
|
||||
function getAreaOfIntersectionBetweenCircles(circles) {
|
||||
var intersectionPoints = getCirclesIntersectionPoints(circles)
|
||||
.filter(function (p) {
|
||||
return isPointInsideAllCircles(p, circles);
|
||||
}),
|
||||
result;
|
||||
|
||||
if (intersectionPoints.length > 1) {
|
||||
// Calculate the center of the intersection points.
|
||||
var center = getCenterOfPoints(intersectionPoints);
|
||||
|
||||
intersectionPoints = intersectionPoints
|
||||
// Calculate the angle between the center and the points.
|
||||
.map(function (p) {
|
||||
p.angle = getAngleBetweenPoints(center, p);
|
||||
return p;
|
||||
})
|
||||
// Sort the points by the angle to the center.
|
||||
.sort(function (a, b) {
|
||||
return b.angle - a.angle;
|
||||
});
|
||||
|
||||
var startPoint = intersectionPoints[intersectionPoints.length - 1];
|
||||
var arcs = intersectionPoints
|
||||
.reduce(function (data, p1) {
|
||||
var startPoint = data.startPoint,
|
||||
midPoint = getCenterOfPoints([startPoint, p1]);
|
||||
|
||||
// Calculate the arc from the intersection points and their
|
||||
// circles.
|
||||
var arc = p1.indexes
|
||||
// Filter out circles that are not included in both
|
||||
// intersection points.
|
||||
.filter(function (index) {
|
||||
return startPoint.indexes.indexOf(index) > -1;
|
||||
})
|
||||
// Iterate the circles of the intersection points and
|
||||
// calculate arcs.
|
||||
.reduce(function (arc, index) {
|
||||
var circle = circles[index],
|
||||
angle1 = getAngleBetweenPoints(circle, p1),
|
||||
angle2 = getAngleBetweenPoints(circle, startPoint),
|
||||
angleDiff = angle2 - angle1 +
|
||||
(angle2 < angle1 ? 2 * Math.PI : 0),
|
||||
angle = angle2 - angleDiff / 2,
|
||||
width = getDistanceBetweenPoints(
|
||||
midPoint,
|
||||
{
|
||||
x: circle.x + circle.r * Math.sin(angle),
|
||||
y: circle.y + circle.r * Math.cos(angle)
|
||||
}
|
||||
),
|
||||
r = circle.r;
|
||||
|
||||
// Width can sometimes become to large due to floating
|
||||
// point errors
|
||||
if (width > r * 2) {
|
||||
width = r * 2;
|
||||
}
|
||||
// Get the arc with the smallest width.
|
||||
if (!arc || arc.width > width) {
|
||||
arc = {
|
||||
r: r,
|
||||
largeArc: width > r ? 1 : 0,
|
||||
width: width,
|
||||
x: p1.x,
|
||||
y: p1.y
|
||||
};
|
||||
}
|
||||
|
||||
// Return the chosen arc.
|
||||
return arc;
|
||||
}, null);
|
||||
|
||||
// If we find an arc then add it to the list and update p2.
|
||||
if (arc) {
|
||||
var r = arc.r;
|
||||
|
||||
data.arcs.push(
|
||||
['A', r, r, 0, arc.largeArc, 1, arc.x, arc.y]
|
||||
);
|
||||
data.startPoint = p1;
|
||||
}
|
||||
return data;
|
||||
}, {
|
||||
startPoint: startPoint,
|
||||
arcs: []
|
||||
}).arcs;
|
||||
|
||||
if (arcs.length === 0) {
|
||||
} else if (arcs.length === 1) {
|
||||
} else {
|
||||
arcs.unshift(['M', startPoint.x, startPoint.y]);
|
||||
result = {
|
||||
center: center,
|
||||
d: arcs
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var geometryCircles = {
|
||||
getAreaOfIntersectionBetweenCircles: getAreaOfIntersectionBetweenCircles,
|
||||
getCircleCircleIntersection: getCircleCircleIntersection,
|
||||
getCirclesIntersectionPoints: getCirclesIntersectionPoints,
|
||||
getCircularSegmentArea: getCircularSegmentArea,
|
||||
getOverlapBetweenCircles: getOverlapBetweenCircles,
|
||||
isPointInsideCircle: isPointInsideCircle,
|
||||
isPointInsideAllCircles: isPointInsideAllCircles,
|
||||
isPointOutsideAllCircles: isPointOutsideAllCircles,
|
||||
round: round
|
||||
};
|
||||
|
||||
export default geometryCircles;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Calculates the center between a list of points.
|
||||
*
|
||||
* @param {array} points A list of points to calculate the center of.
|
||||
*/
|
||||
var getCenterOfPoints = function getCenterOfPoints(points) {
|
||||
var sum = points.reduce(function (sum, point) {
|
||||
sum.x += point.x;
|
||||
sum.y += point.y;
|
||||
return sum;
|
||||
}, { x: 0, y: 0 });
|
||||
|
||||
return {
|
||||
x: sum.x / points.length,
|
||||
y: sum.y / points.length
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the distance between two points based on their x and y
|
||||
* coordinates.
|
||||
*
|
||||
* @param {object} p1 The x and y coordinates of the first point.
|
||||
* @param {object} p2 The x and y coordinates of the second point.
|
||||
* @returns {number} Returns the distance between the points.
|
||||
*/
|
||||
var getDistanceBetweenPoints = function getDistanceBetweenPoints(p1, p2) {
|
||||
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the angle between two points.
|
||||
*
|
||||
* TODO: add unit tests.
|
||||
*
|
||||
* @param {object} p1 The first point.
|
||||
* @param {object} p2 The second point.
|
||||
* @returns {number} Returns the angle in radians.
|
||||
*/
|
||||
var getAngleBetweenPoints = function getAngleBetweenPoints(p1, p2) {
|
||||
return Math.atan2(p2.x - p1.x, p2.y - p1.y);
|
||||
};
|
||||
|
||||
var geometry = {
|
||||
getAngleBetweenPoints: getAngleBetweenPoints,
|
||||
getCenterOfPoints: getCenterOfPoints,
|
||||
getDistanceBetweenPoints: getDistanceBetweenPoints
|
||||
};
|
||||
|
||||
export default geometry;
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* (c) 2010-2019 Daniel Studencki
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Utilities.js';
|
||||
|
||||
var error = H.error;
|
||||
|
||||
var requiredIndicatorMixin = {
|
||||
/**
|
||||
* Check whether given indicator is loaded, else throw error.
|
||||
* @param {function} indicator Indicator constructor function.
|
||||
* @param {string} requiredIndicator required indicator type.
|
||||
* @param {string} type Type of indicator where function was called (parent).
|
||||
* @param {function} callback Callback which is triggered if the given
|
||||
* indicator is loaded. Takes indicator as
|
||||
* an argument.
|
||||
* @param {string} errMessage Error message that will be logged in console.
|
||||
* @returns {boolean} Returns false when there is no required indicator loaded.
|
||||
*/
|
||||
isParentLoaded: function (
|
||||
indicator,
|
||||
requiredIndicator,
|
||||
type,
|
||||
callback,
|
||||
errMessage
|
||||
) {
|
||||
if (indicator) {
|
||||
return callback ? callback(indicator) : true;
|
||||
}
|
||||
error(
|
||||
errMessage || this.generateMessage(type, requiredIndicator)
|
||||
);
|
||||
return false;
|
||||
},
|
||||
generateMessage: function (indicatorType, required) {
|
||||
return 'Error: "' + indicatorType +
|
||||
'" indicator type requires "' + required +
|
||||
'" indicator loaded before. Please read docs: ' +
|
||||
'https://api.highcharts.com/highstock/plotOptions.' +
|
||||
indicatorType;
|
||||
}
|
||||
};
|
||||
|
||||
export default requiredIndicatorMixin;
|
||||
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
*
|
||||
* (c) 2010-2019 Wojciech Chmiel
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
* */
|
||||
|
||||
'use strict';
|
||||
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Utilities.js';
|
||||
|
||||
var each = H.each,
|
||||
merge = H.merge,
|
||||
error = H.error,
|
||||
defined = H.defined,
|
||||
SMA = H.seriesTypes.sma;
|
||||
|
||||
/**
|
||||
* Mixin useful for all indicators that have more than one line.
|
||||
* Merge it with your implementation where you will provide
|
||||
* getValues method appropriate to your indicator and pointArrayMap,
|
||||
* pointValKey, linesApiNames properites. Notice that pointArrayMap
|
||||
* should be consistent with amount of lines calculated in getValues method.
|
||||
*
|
||||
* @private
|
||||
* @mixin multipleLinesMixin
|
||||
*/
|
||||
var multipleLinesMixin = {
|
||||
/**
|
||||
* Lines ids. Required to plot appropriate amount of lines.
|
||||
* Notice that pointArrayMap should have more elements than
|
||||
* linesApiNames, because it contains main line and additional lines ids.
|
||||
* Also it should be consistent with amount of lines calculated in
|
||||
* getValues method from your implementation.
|
||||
*
|
||||
* @private
|
||||
* @name multipleLinesMixin.pointArrayMap
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
pointArrayMap: ['top', 'bottom'],
|
||||
|
||||
/**
|
||||
* Main line id.
|
||||
*
|
||||
* @private
|
||||
* @name multipleLinesMixin.pointValKey
|
||||
* @type {string}
|
||||
*/
|
||||
pointValKey: 'top',
|
||||
|
||||
/**
|
||||
* Additional lines DOCS names. Elements of linesApiNames array should
|
||||
* be consistent with DOCS line names defined in your implementation.
|
||||
* Notice that linesApiNames should have decreased amount of elements
|
||||
* relative to pointArrayMap (without pointValKey).
|
||||
*
|
||||
* @private
|
||||
* @name multipleLinesMixin.linesApiNames
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
linesApiNames: ['bottomLine'],
|
||||
|
||||
/**
|
||||
* Create translatedLines Collection based on pointArrayMap.
|
||||
*
|
||||
* @private
|
||||
* @function multipleLinesMixin.getTranslatedLinesNames
|
||||
*
|
||||
* @param {string} excludedValue
|
||||
* pointValKey - main line id
|
||||
*
|
||||
* @return {Array<string>}
|
||||
* Returns translated lines names without excluded value.
|
||||
*/
|
||||
getTranslatedLinesNames: function (excludedValue) {
|
||||
var translatedLines = [];
|
||||
|
||||
each(this.pointArrayMap, function (propertyName) {
|
||||
if (propertyName !== excludedValue) {
|
||||
translatedLines.push(
|
||||
'plot' +
|
||||
propertyName.charAt(0).toUpperCase() +
|
||||
propertyName.slice(1)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return translatedLines;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @function multipleLinesMixin.toYData
|
||||
*
|
||||
* @param {string} point
|
||||
*
|
||||
* @return {Array<number>}
|
||||
* Returns point Y value for all lines
|
||||
*/
|
||||
toYData: function (point) {
|
||||
var pointColl = [];
|
||||
|
||||
each(this.pointArrayMap, function (propertyName) {
|
||||
pointColl.push(point[propertyName]);
|
||||
});
|
||||
return pointColl;
|
||||
},
|
||||
/**
|
||||
* Add lines plot pixel values.
|
||||
*
|
||||
* @private
|
||||
* @function multipleLinesMixin.translate
|
||||
*/
|
||||
translate: function () {
|
||||
var indicator = this,
|
||||
pointArrayMap = indicator.pointArrayMap,
|
||||
LinesNames = [],
|
||||
value;
|
||||
|
||||
LinesNames = indicator.getTranslatedLinesNames();
|
||||
|
||||
SMA.prototype.translate.apply(indicator, arguments);
|
||||
|
||||
each(indicator.points, function (point) {
|
||||
each(pointArrayMap, function (propertyName, i) {
|
||||
value = point[propertyName];
|
||||
|
||||
if (value !== null) {
|
||||
point[LinesNames[i]] = indicator.yAxis.toPixels(
|
||||
value,
|
||||
true
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Draw main and additional lines.
|
||||
*
|
||||
* @private
|
||||
* @function multipleLinesMixin.drawGraph
|
||||
*/
|
||||
drawGraph: function () {
|
||||
var indicator = this,
|
||||
pointValKey = indicator.pointValKey,
|
||||
linesApiNames = indicator.linesApiNames,
|
||||
mainLinePoints = indicator.points,
|
||||
pointsLength = mainLinePoints.length,
|
||||
mainLineOptions = indicator.options,
|
||||
mainLinePath = indicator.graph,
|
||||
gappedExtend = {
|
||||
options: {
|
||||
gapSize: mainLineOptions.gapSize
|
||||
}
|
||||
},
|
||||
secondaryLines = [], // additional lines point place holders
|
||||
secondaryLinesNames = indicator.getTranslatedLinesNames(
|
||||
pointValKey
|
||||
),
|
||||
point;
|
||||
|
||||
|
||||
// Generate points for additional lines:
|
||||
each(secondaryLinesNames, function (plotLine, index) {
|
||||
|
||||
// create additional lines point place holders
|
||||
secondaryLines[index] = [];
|
||||
|
||||
while (pointsLength--) {
|
||||
point = mainLinePoints[pointsLength];
|
||||
secondaryLines[index].push({
|
||||
x: point.x,
|
||||
plotX: point.plotX,
|
||||
plotY: point[plotLine],
|
||||
isNull: !defined(point[plotLine])
|
||||
});
|
||||
}
|
||||
|
||||
pointsLength = mainLinePoints.length;
|
||||
});
|
||||
|
||||
// Modify options and generate additional lines:
|
||||
each(linesApiNames, function (lineName, i) {
|
||||
if (secondaryLines[i]) {
|
||||
indicator.points = secondaryLines[i];
|
||||
if (mainLineOptions[lineName]) {
|
||||
indicator.options = merge(
|
||||
mainLineOptions[lineName].styles,
|
||||
gappedExtend
|
||||
);
|
||||
} else {
|
||||
error(
|
||||
'Error: "There is no ' + lineName +
|
||||
' in DOCS options declared. Check if linesApiNames' +
|
||||
' are consistent with your DOCS line names."' +
|
||||
' at mixin/multiple-line.js:34'
|
||||
);
|
||||
}
|
||||
|
||||
indicator.graph = indicator['graph' + lineName];
|
||||
SMA.prototype.drawGraph.call(indicator);
|
||||
|
||||
// Now save lines:
|
||||
indicator['graph' + lineName] = indicator.graph;
|
||||
} else {
|
||||
error(
|
||||
'Error: "' + lineName + ' doesn\'t have equivalent ' +
|
||||
'in pointArrayMap. To many elements in linesApiNames ' +
|
||||
'relative to pointArrayMap."'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Restore options and draw a main line:
|
||||
indicator.points = mainLinePoints;
|
||||
indicator.options = mainLineOptions;
|
||||
indicator.graph = mainLinePath;
|
||||
SMA.prototype.drawGraph.call(indicator);
|
||||
}
|
||||
};
|
||||
|
||||
export default multipleLinesMixin;
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* (c) 2010-2018 Paweł Fus
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var chartNavigation = {
|
||||
/**
|
||||
* Initializes `chart.navigation` object which delegates `update()` methods
|
||||
* to all other common classes (used in exporting and navigationBindings).
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {Highcharts.Chart} chart
|
||||
* The chart instance.
|
||||
*/
|
||||
initUpdate: function (chart) {
|
||||
if (!chart.navigation) {
|
||||
chart.navigation = {
|
||||
updates: [],
|
||||
update: function (options, redraw) {
|
||||
this.updates.forEach(function (updateConfig) {
|
||||
updateConfig.update.call(
|
||||
updateConfig.context,
|
||||
options,
|
||||
redraw
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Registers an `update()` method in the `chart.navigation` object.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {function} update
|
||||
* The `update()` method that will be called in `chart.update()`.
|
||||
*
|
||||
* @param {Highcharts.Chart} chart
|
||||
* The chart instance. `update()` will use that as a context
|
||||
* (`this`).
|
||||
*/
|
||||
addUpdate: function (update, chart) {
|
||||
if (!chart.navigation) {
|
||||
this.initUpdate(chart);
|
||||
}
|
||||
|
||||
chart.navigation.updates.push({
|
||||
update: update,
|
||||
context: chart
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default chartNavigation;
|
||||
@@ -0,0 +1,76 @@
|
||||
import H from '../parts/Globals.js';
|
||||
|
||||
H.NodesMixin = {
|
||||
// Create a single node that holds information on incoming and outgoing
|
||||
// links.
|
||||
createNode: function (id) {
|
||||
|
||||
function findById(nodes, id) {
|
||||
return H.find(nodes, function (node) {
|
||||
return node.id === id;
|
||||
});
|
||||
}
|
||||
|
||||
var node = findById(this.nodes, id),
|
||||
PointClass = this.pointClass,
|
||||
options;
|
||||
|
||||
if (!node) {
|
||||
options = this.options.nodes && findById(this.options.nodes, id);
|
||||
node = (new PointClass()).init(
|
||||
this,
|
||||
H.extend({
|
||||
className: 'highcharts-node',
|
||||
isNode: true,
|
||||
id: id,
|
||||
y: 1 // Pass isNull test
|
||||
}, options)
|
||||
);
|
||||
node.linksTo = [];
|
||||
node.linksFrom = [];
|
||||
node.formatPrefix = 'node';
|
||||
node.name = node.name || node.options.id; // for use in formats
|
||||
|
||||
// Return the largest sum of either the incoming or outgoing links.
|
||||
node.getSum = function () {
|
||||
var sumTo = 0,
|
||||
sumFrom = 0;
|
||||
|
||||
node.linksTo.forEach(function (link) {
|
||||
sumTo += link.weight;
|
||||
});
|
||||
node.linksFrom.forEach(function (link) {
|
||||
sumFrom += link.weight;
|
||||
});
|
||||
return Math.max(sumTo, sumFrom);
|
||||
};
|
||||
// Get the offset in weight values of a point/link.
|
||||
node.offset = function (point, coll) {
|
||||
var offset = 0;
|
||||
|
||||
for (var i = 0; i < node[coll].length; i++) {
|
||||
if (node[coll][i] === point) {
|
||||
return offset;
|
||||
}
|
||||
offset += node[coll][i].weight;
|
||||
}
|
||||
};
|
||||
|
||||
// Return true if the node has a shape, otherwise all links are
|
||||
// outgoing.
|
||||
node.hasShape = function () {
|
||||
var outgoing = 0;
|
||||
|
||||
node.linksTo.forEach(function (link) {
|
||||
if (link.outgoing) {
|
||||
outgoing++;
|
||||
}
|
||||
});
|
||||
return !node.linksTo.length || outgoing !== node.linksTo.length;
|
||||
};
|
||||
|
||||
this.nodes.push(node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,167 @@
|
||||
/* *
|
||||
* (c) 2010-2019 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import H from '../parts/Globals.js';
|
||||
|
||||
var defined = H.defined,
|
||||
seriesTypes = H.seriesTypes,
|
||||
stableSort = H.stableSort;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @mixin onSeriesMixin
|
||||
*/
|
||||
var onSeriesMixin = {
|
||||
|
||||
/**
|
||||
* Override getPlotBox. If the onSeries option is valid, return the plot box
|
||||
* of the onSeries, otherwise proceed as usual.
|
||||
*
|
||||
* @private
|
||||
* @function onSeriesMixin.getPlotBox
|
||||
*
|
||||
* @return {Highcharts.SeriesPlotBoxObject}
|
||||
*/
|
||||
getPlotBox: function () {
|
||||
return H.Series.prototype.getPlotBox.call(
|
||||
(
|
||||
this.options.onSeries &&
|
||||
this.chart.get(this.options.onSeries)
|
||||
) || this
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Extend the translate method by placing the point on the related series
|
||||
*
|
||||
* @private
|
||||
* @function onSeriesMixin.translate
|
||||
*/
|
||||
translate: function () {
|
||||
|
||||
seriesTypes.column.prototype.translate.apply(this);
|
||||
|
||||
var series = this,
|
||||
options = series.options,
|
||||
chart = series.chart,
|
||||
points = series.points,
|
||||
cursor = points.length - 1,
|
||||
point,
|
||||
lastPoint,
|
||||
optionsOnSeries = options.onSeries,
|
||||
onSeries = optionsOnSeries && chart.get(optionsOnSeries),
|
||||
onKey = options.onKey || 'y',
|
||||
step = onSeries && onSeries.options.step,
|
||||
onData = onSeries && onSeries.points,
|
||||
i = onData && onData.length,
|
||||
inverted = chart.inverted,
|
||||
xAxis = series.xAxis,
|
||||
yAxis = series.yAxis,
|
||||
xOffset = 0,
|
||||
leftPoint,
|
||||
lastX,
|
||||
rightPoint,
|
||||
currentDataGrouping,
|
||||
distanceRatio;
|
||||
|
||||
// relate to a master series
|
||||
if (onSeries && onSeries.visible && i) {
|
||||
xOffset = (onSeries.pointXOffset || 0) + (onSeries.barW || 0) / 2;
|
||||
currentDataGrouping = onSeries.currentDataGrouping;
|
||||
lastX = (
|
||||
onData[i - 1].x +
|
||||
(currentDataGrouping ? currentDataGrouping.totalRange : 0)
|
||||
); // #2374
|
||||
|
||||
// sort the data points
|
||||
stableSort(points, function (a, b) {
|
||||
return (a.x - b.x);
|
||||
});
|
||||
|
||||
onKey = 'plot' + onKey[0].toUpperCase() + onKey.substr(1);
|
||||
while (i-- && points[cursor]) {
|
||||
leftPoint = onData[i];
|
||||
point = points[cursor];
|
||||
point.y = leftPoint.y;
|
||||
|
||||
if (leftPoint.x <= point.x && leftPoint[onKey] !== undefined) {
|
||||
if (point.x <= lastX) { // #803
|
||||
|
||||
point.plotY = leftPoint[onKey];
|
||||
|
||||
// interpolate between points, #666
|
||||
if (leftPoint.x < point.x && !step) {
|
||||
rightPoint = onData[i + 1];
|
||||
if (rightPoint && rightPoint[onKey] !== undefined) {
|
||||
// the distance ratio, between 0 and 1
|
||||
distanceRatio = (point.x - leftPoint.x) /
|
||||
(rightPoint.x - leftPoint.x);
|
||||
point.plotY +=
|
||||
distanceRatio *
|
||||
// the plotY distance
|
||||
(rightPoint[onKey] - leftPoint[onKey]);
|
||||
point.y +=
|
||||
distanceRatio *
|
||||
(rightPoint.y - leftPoint.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor--;
|
||||
i++; // check again for points in the same x position
|
||||
if (cursor < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add plotY position and handle stacking
|
||||
points.forEach(function (point, i) {
|
||||
|
||||
var stackIndex;
|
||||
|
||||
point.plotX += xOffset; // #2049
|
||||
|
||||
// Undefined plotY means the point is either on axis, outside series
|
||||
// range or hidden series. If the series is outside the range of the
|
||||
// x axis it should fall through with an undefined plotY, but then
|
||||
// we must remove the shapeArgs (#847). For inverted charts, we need
|
||||
// to calculate position anyway, because series.invertGroups is not
|
||||
// defined
|
||||
if (point.plotY === undefined || inverted) {
|
||||
if (point.plotX >= 0 && point.plotX <= xAxis.len) {
|
||||
// We're inside xAxis range
|
||||
if (inverted) {
|
||||
point.plotY = xAxis.translate(point.x, 0, 1, 0, 1);
|
||||
point.plotX = defined(point.y) ?
|
||||
yAxis.translate(point.y, 0, 0, 0, 1) : 0;
|
||||
} else {
|
||||
point.plotY = (xAxis.opposite ? 0 : series.yAxis.len) +
|
||||
xAxis.offset; // For the windbarb demo
|
||||
}
|
||||
} else {
|
||||
point.shapeArgs = {}; // 847
|
||||
}
|
||||
}
|
||||
|
||||
// if multiple flags appear at the same x, order them into a stack
|
||||
lastPoint = points[i - 1];
|
||||
if (lastPoint && lastPoint.plotX === point.plotX) {
|
||||
if (lastPoint.stackIndex === undefined) {
|
||||
lastPoint.stackIndex = 0;
|
||||
}
|
||||
stackIndex = lastPoint.stackIndex + 1;
|
||||
}
|
||||
point.stackIndex = stackIndex; // #3639
|
||||
});
|
||||
|
||||
this.onSeries = onSeries;
|
||||
}
|
||||
};
|
||||
|
||||
export default onSeriesMixin;
|
||||
@@ -0,0 +1,293 @@
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Utilities.js';
|
||||
|
||||
var deg2rad = H.deg2rad,
|
||||
find = H.find,
|
||||
isArray = H.isArray,
|
||||
isNumber = H.isNumber;
|
||||
|
||||
/**
|
||||
* Alternative solution to correctFloat.
|
||||
* E.g H.correctFloat(123, 2) returns 120, when it should be 123.
|
||||
*
|
||||
* @private
|
||||
* @function correctFloat
|
||||
*
|
||||
* @param {number} number
|
||||
*
|
||||
* @param {number} precision
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var correctFloat = function (number, precision) {
|
||||
var p = isNumber(precision) ? precision : 14,
|
||||
magnitude = Math.pow(10, p);
|
||||
|
||||
return Math.round(number * magnitude) / magnitude;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the normals to a line between two points.
|
||||
*
|
||||
* @private
|
||||
* @function getNormals
|
||||
*
|
||||
* @param {Array<number,number>} p1
|
||||
* Start point for the line. Array of x and y value.
|
||||
*
|
||||
* @param {Array<number,number>} p2
|
||||
* End point for the line. Array of x and y value.
|
||||
*
|
||||
* @return {Array<Array<number,number>>}
|
||||
* Returns the two normals in an array.
|
||||
*/
|
||||
var getNormals = function getNormal(p1, p2) {
|
||||
var dx = p2[0] - p1[0], // x2 - x1
|
||||
dy = p2[1] - p1[1]; // y2 - y1
|
||||
|
||||
return [
|
||||
[-dy, dx],
|
||||
[dy, -dx]
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the dot product of two coordinates. The result is a scalar value.
|
||||
*
|
||||
* @private
|
||||
* @function dotProduct
|
||||
*
|
||||
* @param {Array<number,number>} a
|
||||
* The x and y coordinates of the first point.
|
||||
*
|
||||
* @param {Array<number,number>} b
|
||||
* The x and y coordinates of the second point.
|
||||
*
|
||||
* @return {number}
|
||||
* Returns the dot product of a and b.
|
||||
*/
|
||||
var dotProduct = function dotProduct(a, b) {
|
||||
var ax = a[0],
|
||||
ay = a[1],
|
||||
bx = b[0],
|
||||
by = b[1];
|
||||
|
||||
return ax * bx + ay * by;
|
||||
};
|
||||
|
||||
/**
|
||||
* Projects a polygon onto a coordinate.
|
||||
*
|
||||
* @private
|
||||
* @function project
|
||||
*
|
||||
* @param {Array<Array<number,number>>} polygon
|
||||
* Array of points in a polygon.
|
||||
*
|
||||
* @param {Array<number,number>} target
|
||||
* The coordinate of pr
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
var project = function project(polygon, target) {
|
||||
var products = polygon.map(function (point) {
|
||||
return dotProduct(point, target);
|
||||
});
|
||||
|
||||
return {
|
||||
min: Math.min.apply(this, products),
|
||||
max: Math.max.apply(this, products)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Rotates a point clockwise around the origin.
|
||||
*
|
||||
* @private
|
||||
* @function rotate2DToOrigin
|
||||
*
|
||||
* @param {Array<number,number>} point
|
||||
* The x and y coordinates for the point.
|
||||
*
|
||||
* @param {number} angle
|
||||
* The angle of rotation.
|
||||
*
|
||||
* @return {Array<number,number>}
|
||||
* The x and y coordinate for the rotated point.
|
||||
*/
|
||||
var rotate2DToOrigin = function (point, angle) {
|
||||
var x = point[0],
|
||||
y = point[1],
|
||||
rad = deg2rad * -angle,
|
||||
cosAngle = Math.cos(rad),
|
||||
sinAngle = Math.sin(rad);
|
||||
|
||||
return [
|
||||
correctFloat(x * cosAngle - y * sinAngle),
|
||||
correctFloat(x * sinAngle + y * cosAngle)
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Rotate a point clockwise around another point.
|
||||
*
|
||||
* @private
|
||||
* @function rotate2DToPoint
|
||||
*
|
||||
* @param {Array<number,number>} point
|
||||
* The x and y coordinates for the point.
|
||||
*
|
||||
* @param {Array<number,numbner>} origin
|
||||
* The point to rotate around.
|
||||
*
|
||||
* @param {number} angle
|
||||
* The angle of rotation.
|
||||
*
|
||||
* @return {Array<number,number>}
|
||||
* The x and y coordinate for the rotated point.
|
||||
*/
|
||||
var rotate2DToPoint = function (point, origin, angle) {
|
||||
var x = point[0] - origin[0],
|
||||
y = point[1] - origin[1],
|
||||
rotated = rotate2DToOrigin([x, y], angle);
|
||||
|
||||
return [
|
||||
rotated[0] + origin[0],
|
||||
rotated[1] + origin[1]
|
||||
];
|
||||
};
|
||||
|
||||
var isAxesEqual = function (axis1, axis2) {
|
||||
return (
|
||||
axis1[0] === axis2[0] &&
|
||||
axis1[1] === axis2[1]
|
||||
);
|
||||
};
|
||||
|
||||
var getAxesFromPolygon = function (polygon) {
|
||||
var points,
|
||||
axes = polygon.axes;
|
||||
|
||||
if (!isArray(axes)) {
|
||||
axes = [];
|
||||
points = points = polygon.concat([polygon[0]]);
|
||||
points.reduce(
|
||||
function findAxis(p1, p2) {
|
||||
var normals = getNormals(p1, p2),
|
||||
axis = normals[0]; // Use the left normal as axis.
|
||||
|
||||
// Check that the axis is unique.
|
||||
if (!find(axes, function (existing) {
|
||||
return isAxesEqual(existing, axis);
|
||||
})) {
|
||||
axes.push(axis);
|
||||
}
|
||||
|
||||
// Return p2 to be used as p1 in next iteration.
|
||||
return p2;
|
||||
}
|
||||
);
|
||||
polygon.axes = axes;
|
||||
}
|
||||
return axes;
|
||||
};
|
||||
|
||||
var getAxes = function (polygon1, polygon2) {
|
||||
// Get the axis from both polygons.
|
||||
var axes1 = getAxesFromPolygon(polygon1),
|
||||
axes2 = getAxesFromPolygon(polygon2);
|
||||
|
||||
return axes1.concat(axes2);
|
||||
};
|
||||
|
||||
var getPolygon = function (x, y, width, height, rotation) {
|
||||
var origin = [x, y],
|
||||
left = x - (width / 2),
|
||||
right = x + (width / 2),
|
||||
top = y - (height / 2),
|
||||
bottom = y + (height / 2),
|
||||
polygon = [
|
||||
[left, top],
|
||||
[right, top],
|
||||
[right, bottom],
|
||||
[left, bottom]
|
||||
];
|
||||
|
||||
return polygon.map(function (point) {
|
||||
return rotate2DToPoint(point, origin, -rotation);
|
||||
});
|
||||
};
|
||||
|
||||
var getBoundingBoxFromPolygon = function (points) {
|
||||
return points.reduce(function (obj, point) {
|
||||
var x = point[0],
|
||||
y = point[1];
|
||||
|
||||
obj.left = Math.min(x, obj.left);
|
||||
obj.right = Math.max(x, obj.right);
|
||||
obj.bottom = Math.max(y, obj.bottom);
|
||||
obj.top = Math.min(y, obj.top);
|
||||
return obj;
|
||||
}, {
|
||||
left: Number.MAX_VALUE,
|
||||
right: -Number.MAX_VALUE,
|
||||
bottom: -Number.MAX_VALUE,
|
||||
top: Number.MAX_VALUE
|
||||
});
|
||||
};
|
||||
|
||||
var isPolygonsOverlappingOnAxis = function (axis, polygon1, polygon2) {
|
||||
var projection1 = project(polygon1, axis),
|
||||
projection2 = project(polygon2, axis),
|
||||
isOverlapping = !(
|
||||
projection2.min > projection1.max ||
|
||||
projection2.max < projection1.min
|
||||
);
|
||||
|
||||
return !isOverlapping;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks wether two convex polygons are colliding by using the Separating Axis
|
||||
* Theorem.
|
||||
*
|
||||
* @private
|
||||
* @function isPolygonsColliding
|
||||
*
|
||||
* @param {Array<Array<number,number>>} polygon1
|
||||
* First polygon.
|
||||
*
|
||||
* @param {Array<Array<number,number>>} polygon2
|
||||
* Second polygon.
|
||||
*
|
||||
* @return {boolean}
|
||||
* Returns true if they are colliding, otherwise false.
|
||||
*/
|
||||
var isPolygonsColliding = function isPolygonsColliding(polygon1, polygon2) {
|
||||
var axes = getAxes(polygon1, polygon2),
|
||||
overlappingOnAllAxes = !find(axes, function (axis) {
|
||||
return isPolygonsOverlappingOnAxis(axis, polygon1, polygon2);
|
||||
});
|
||||
|
||||
return overlappingOnAllAxes;
|
||||
};
|
||||
|
||||
var movePolygon = function (deltaX, deltaY, polygon) {
|
||||
return polygon.map(function (point) {
|
||||
return [
|
||||
point[0] + deltaX,
|
||||
point[1] + deltaY
|
||||
];
|
||||
});
|
||||
};
|
||||
|
||||
var collision = {
|
||||
getBoundingBoxFromPolygon: getBoundingBoxFromPolygon,
|
||||
getPolygon: getPolygon,
|
||||
isPolygonsColliding: isPolygonsColliding,
|
||||
movePolygon: movePolygon,
|
||||
rotate2DToOrigin: rotate2DToOrigin,
|
||||
rotate2DToPoint: rotate2DToPoint
|
||||
};
|
||||
|
||||
export default collision;
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* (c) 2010-2019 Pawel Fus & Daniel Studencki
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import H from '../parts/Globals.js';
|
||||
import '../parts/Utilities.js';
|
||||
|
||||
var reduce = H.reduce;
|
||||
|
||||
var reduceArrayMixin = {
|
||||
/**
|
||||
* Get min value of array filled by OHLC data.
|
||||
* @param {array} arr Array of OHLC points (arrays).
|
||||
* @param {string} index Index of "low" value in point array.
|
||||
* @returns {number} Returns min value.
|
||||
*/
|
||||
minInArray: function (arr, index) {
|
||||
return reduce(arr, function (min, target) {
|
||||
return Math.min(min, target[index]);
|
||||
}, Number.MAX_VALUE);
|
||||
},
|
||||
/**
|
||||
* Get max value of array filled by OHLC data.
|
||||
* @param {array} arr Array of OHLC points (arrays).
|
||||
* @param {string} index Index of "high" value in point array.
|
||||
* @returns {number} Returns max value.
|
||||
*/
|
||||
maxInArray: function (arr, index) {
|
||||
return reduce(arr, function (min, target) {
|
||||
return Math.max(min, target[index]);
|
||||
}, -Number.MAX_VALUE);
|
||||
},
|
||||
/**
|
||||
* Get extremes of array filled by OHLC data.
|
||||
* @param {array} arr Array of OHLC points (arrays).
|
||||
* @param {string} minIndex Index of "low" value in point array.
|
||||
* @param {string} maxIndex Index of "high" value in point array.
|
||||
* @returns {array} Returns array with min and max value.
|
||||
*/
|
||||
getArrayExtremes: function (arr, minIndex, maxIndex) {
|
||||
return reduce(arr, function (prev, target) {
|
||||
return [
|
||||
Math.min(prev[0], target[minIndex]),
|
||||
Math.max(prev[1], target[maxIndex])
|
||||
];
|
||||
}, [Number.MAX_VALUE, -Number.MAX_VALUE]);
|
||||
}
|
||||
};
|
||||
|
||||
export default reduceArrayMixin;
|
||||
@@ -0,0 +1,256 @@
|
||||
import H from '../parts/Globals.js';
|
||||
|
||||
var extend = H.extend,
|
||||
isArray = H.isArray,
|
||||
isBoolean = function (x) {
|
||||
return typeof x === 'boolean';
|
||||
},
|
||||
isFn = function (x) {
|
||||
return typeof x === 'function';
|
||||
},
|
||||
isObject = H.isObject,
|
||||
isNumber = H.isNumber,
|
||||
merge = H.merge,
|
||||
pick = H.pick;
|
||||
|
||||
// TODO Combine buildTree and buildNode with setTreeValues
|
||||
// TODO Remove logic from Treemap and make it utilize this mixin.
|
||||
var setTreeValues = function setTreeValues(tree, options) {
|
||||
var before = options.before,
|
||||
idRoot = options.idRoot,
|
||||
mapIdToNode = options.mapIdToNode,
|
||||
nodeRoot = mapIdToNode[idRoot],
|
||||
levelIsConstant = (
|
||||
isBoolean(options.levelIsConstant) ?
|
||||
options.levelIsConstant :
|
||||
true
|
||||
),
|
||||
points = options.points,
|
||||
point = points[tree.i],
|
||||
optionsPoint = point && point.options || {},
|
||||
childrenTotal = 0,
|
||||
children = [],
|
||||
value;
|
||||
|
||||
extend(tree, {
|
||||
levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level),
|
||||
name: pick(point && point.name, ''),
|
||||
visible: (
|
||||
idRoot === tree.id ||
|
||||
(isBoolean(options.visible) ? options.visible : false)
|
||||
)
|
||||
});
|
||||
if (isFn(before)) {
|
||||
tree = before(tree, options);
|
||||
}
|
||||
// First give the children some values
|
||||
tree.children.forEach(function (child, i) {
|
||||
var newOptions = extend({}, options);
|
||||
|
||||
extend(newOptions, {
|
||||
index: i,
|
||||
siblings: tree.children.length,
|
||||
visible: tree.visible
|
||||
});
|
||||
child = setTreeValues(child, newOptions);
|
||||
children.push(child);
|
||||
if (child.visible) {
|
||||
childrenTotal += child.val;
|
||||
}
|
||||
});
|
||||
tree.visible = childrenTotal > 0 || tree.visible;
|
||||
// Set the values
|
||||
value = pick(optionsPoint.value, childrenTotal);
|
||||
extend(tree, {
|
||||
children: children,
|
||||
childrenTotal: childrenTotal,
|
||||
isLeaf: tree.visible && !childrenTotal,
|
||||
val: value
|
||||
});
|
||||
return tree;
|
||||
};
|
||||
|
||||
var getColor = function getColor(node, options) {
|
||||
var index = options.index,
|
||||
mapOptionsToLevel = options.mapOptionsToLevel,
|
||||
parentColor = options.parentColor,
|
||||
parentColorIndex = options.parentColorIndex,
|
||||
series = options.series,
|
||||
colors = options.colors,
|
||||
siblings = options.siblings,
|
||||
points = series.points,
|
||||
getColorByPoint,
|
||||
chartOptionsChart = series.chart.options.chart,
|
||||
point,
|
||||
level,
|
||||
colorByPoint,
|
||||
colorIndexByPoint,
|
||||
color,
|
||||
colorIndex;
|
||||
|
||||
function variation(color) {
|
||||
var colorVariation = level && level.colorVariation;
|
||||
|
||||
if (colorVariation) {
|
||||
if (colorVariation.key === 'brightness') {
|
||||
return H.color(color).brighten(
|
||||
colorVariation.to * (index / siblings)
|
||||
).get();
|
||||
}
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
if (node) {
|
||||
point = points[node.i];
|
||||
level = mapOptionsToLevel[node.level] || {};
|
||||
getColorByPoint = point && level.colorByPoint;
|
||||
|
||||
if (getColorByPoint) {
|
||||
colorIndexByPoint = point.index % (colors ?
|
||||
colors.length :
|
||||
chartOptionsChart.colorCount
|
||||
);
|
||||
colorByPoint = colors && colors[colorIndexByPoint];
|
||||
}
|
||||
|
||||
// Select either point color, level color or inherited color.
|
||||
if (!series.chart.styledMode) {
|
||||
color = pick(
|
||||
point && point.options.color,
|
||||
level && level.color,
|
||||
colorByPoint,
|
||||
parentColor && variation(parentColor),
|
||||
series.color
|
||||
);
|
||||
}
|
||||
|
||||
colorIndex = pick(
|
||||
point && point.options.colorIndex,
|
||||
level && level.colorIndex,
|
||||
colorIndexByPoint,
|
||||
parentColorIndex,
|
||||
options.colorIndex
|
||||
);
|
||||
}
|
||||
return {
|
||||
color: color,
|
||||
colorIndex: colorIndex
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a map from level number to its given options.
|
||||
*
|
||||
* @private
|
||||
* @function getLevelOptions
|
||||
*
|
||||
* @param {object} params
|
||||
* Object containing parameters.
|
||||
* - `defaults` Object containing default options. The default options
|
||||
* are merged with the userOptions to get the final options for a
|
||||
* specific level.
|
||||
* - `from` The lowest level number.
|
||||
* - `levels` User options from series.levels.
|
||||
* - `to` The highest level number.
|
||||
*
|
||||
* @return {Highcharts.Dictionary<object>}
|
||||
* Returns a map from level number to its given options.
|
||||
*/
|
||||
var getLevelOptions = function getLevelOptions(params) {
|
||||
var result = null,
|
||||
defaults,
|
||||
converted,
|
||||
i,
|
||||
from,
|
||||
to,
|
||||
levels;
|
||||
|
||||
if (isObject(params)) {
|
||||
result = {};
|
||||
from = isNumber(params.from) ? params.from : 1;
|
||||
levels = params.levels;
|
||||
converted = {};
|
||||
defaults = isObject(params.defaults) ? params.defaults : {};
|
||||
if (isArray(levels)) {
|
||||
converted = levels.reduce(function (obj, item) {
|
||||
var level,
|
||||
levelIsConstant,
|
||||
options;
|
||||
|
||||
if (isObject(item) && isNumber(item.level)) {
|
||||
options = merge({}, item);
|
||||
levelIsConstant = (
|
||||
isBoolean(options.levelIsConstant) ?
|
||||
options.levelIsConstant :
|
||||
defaults.levelIsConstant
|
||||
);
|
||||
// Delete redundant properties.
|
||||
delete options.levelIsConstant;
|
||||
delete options.level;
|
||||
// Calculate which level these options apply to.
|
||||
level = item.level + (levelIsConstant ? 0 : from - 1);
|
||||
if (isObject(obj[level])) {
|
||||
extend(obj[level], options);
|
||||
} else {
|
||||
obj[level] = options;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}, {});
|
||||
}
|
||||
to = isNumber(params.to) ? params.to : 1;
|
||||
for (i = 0; i <= to; i++) {
|
||||
result[i] = merge(
|
||||
{},
|
||||
defaults,
|
||||
isObject(converted[i]) ? converted[i] : {}
|
||||
);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the rootId property on the series. Also makes sure that it is
|
||||
* accessible to exporting.
|
||||
*
|
||||
* @private
|
||||
* @function updateRootId
|
||||
*
|
||||
* @param {object} series
|
||||
* The series to operate on.
|
||||
*
|
||||
* @return {string}
|
||||
* Returns the resulting rootId after update.
|
||||
*/
|
||||
var updateRootId = function (series) {
|
||||
var rootId,
|
||||
options;
|
||||
|
||||
if (isObject(series)) {
|
||||
// Get the series options.
|
||||
options = isObject(series.options) ? series.options : {};
|
||||
|
||||
// Calculate the rootId.
|
||||
rootId = pick(series.rootNode, options.rootId, '');
|
||||
|
||||
// Set rootId on series.userOptions to pick it up in exporting.
|
||||
if (isObject(series.userOptions)) {
|
||||
series.userOptions.rootId = rootId;
|
||||
}
|
||||
// Set rootId on series to pick it up on next update.
|
||||
series.rootNode = rootId;
|
||||
}
|
||||
return rootId;
|
||||
};
|
||||
|
||||
var result = {
|
||||
getColor: getColor,
|
||||
getLevelOptions: getLevelOptions,
|
||||
setTreeValues: setTreeValues,
|
||||
updateRootId: updateRootId
|
||||
};
|
||||
|
||||
export default result;
|
||||
Reference in New Issue
Block a user