mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-09 09:46:51 +01:00
JSDoc and other cleanup (#7057)
This commit is contained in:
@@ -115,11 +115,11 @@ var positioners = {
|
||||
/**
|
||||
* Average mode places the tooltip at the average position of the elements shown
|
||||
* @function Chart.Tooltip.positioners.average
|
||||
* @param elements {ChartElement[]} the elements being displayed in the tooltip
|
||||
* @param items {object[]} the items being displayed in the tooltip
|
||||
* @returns {object} tooltip position
|
||||
*/
|
||||
average: function(elements) {
|
||||
if (!elements.length) {
|
||||
average: function(items) {
|
||||
if (!items.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ var positioners = {
|
||||
var y = 0;
|
||||
var count = 0;
|
||||
|
||||
for (i = 0, len = elements.length; i < len; ++i) {
|
||||
var el = elements[i].element;
|
||||
for (i = 0, len = items.length; i < len; ++i) {
|
||||
var el = items[i].element;
|
||||
if (el && el.hasValue()) {
|
||||
var pos = el.tooltipPosition();
|
||||
x += pos.x;
|
||||
@@ -147,18 +147,18 @@ var positioners = {
|
||||
/**
|
||||
* Gets the tooltip position nearest of the item nearest to the event position
|
||||
* @function Chart.Tooltip.positioners.nearest
|
||||
* @param elements {Chart.Element[]} the tooltip elements
|
||||
* @param items {object[]} the tooltip items
|
||||
* @param eventPosition {object} the position of the event in canvas coordinates
|
||||
* @returns {object} the tooltip position
|
||||
*/
|
||||
nearest: function(elements, eventPosition) {
|
||||
nearest: function(items, eventPosition) {
|
||||
var x = eventPosition.x;
|
||||
var y = eventPosition.y;
|
||||
var minDistance = Number.POSITIVE_INFINITY;
|
||||
var i, len, nearestElement;
|
||||
|
||||
for (i = 0, len = elements.length; i < len; ++i) {
|
||||
var el = elements[i].element;
|
||||
for (i = 0, len = items.length; i < len; ++i) {
|
||||
var el = items[i].element;
|
||||
if (el && el.hasValue()) {
|
||||
var center = el.getCenterPoint();
|
||||
var d = helpers.math.distanceBetweenPoints(eventPosition, center);
|
||||
@@ -199,8 +199,8 @@ function pushOrConcat(base, toPush) {
|
||||
|
||||
/**
|
||||
* Returns array of strings split by newline
|
||||
* @param {string} str - The value to split by newline.
|
||||
* @returns {string[]} value if newline present - Returned from String split() method
|
||||
* @param {string|undefined} str - The value to split by newline.
|
||||
* @returns {string|string[]} value if newline present - Returned from String split() method
|
||||
* @function
|
||||
*/
|
||||
function splitNewlines(str) {
|
||||
|
||||
Reference in New Issue
Block a user