* @param {object} metaset - the dataset meta
* @param {string} axis - the axis mide. x|y|xy
* @param {number} value - the value to find
- * @param {boolean} intersect - should the element intersect
+ * @param {boolean} [intersect] - should the element intersect
* @returns {{lo:number, hi:number}} indices to search data array between
*/
function binarySearch(metaset, axis, value, intersect) {
this.paddingRight = undefined;
// scale-specific properties
- /** @type {string} */
+ /** @type {string=} */
this.axis = undefined;
- /** @type {number} */
+ /** @type {number=} */
this.labelRotation = undefined;
this.min = undefined;
this.max = undefined;
/** @type {object[]} */
this.ticks = null;
- /** @type {object[]} */
+ /** @type {object[]|null} */
this._gridLineItems = null;
- /** @type {object[]} */
+ /** @type {object[]|null} */
this._labelItems = null;
- /** @type {object} */
+ /** @type {object|null} */
this._labelSizes = null;
/** @type {number} */
this._length = undefined;
* @param {HTMLElement} domNode - the node to check the constraint on
* @param {string} maxStyle - the style that defines the maximum for the direction we are using ('max-width' / 'max-height')
* @param {string} percentageProperty - property of parent to use when calculating width as a percentage
- * @return {number|undefined} number or undefined if no constraint
+ * @return {number=} number or undefined if no constraint
* @see {@link https://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser}
*/
function getConstraintDimension(domNode, maxStyle, percentageProperty) {
document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
}
-/** @return {number|undefined} number or undefined if no constraint */
+/** @return {number=} number or undefined if no constraint */
function getConstraintWidth(domNode) {
return getConstraintDimension(domNode, 'max-width', 'clientWidth');
}
-/** @return {number|undefined} number or undefined if no constraint */
+/** @return {number=} number or undefined if no constraint */
function getConstraintHeight(domNode) {
return getConstraintDimension(domNode, 'max-height', 'clientHeight');
}
/**
* Converts the given font object into a CSS font string.
* @param {object} font - A font object.
- * @return {string} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
+ * @return {string|null} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
* @private
*/
function toFontString(font) {
* @param {number} segment.end - end index of the segment, referring the points array
* @param {boolean} segment.loop - indicates that the segment is a loop
* @param {Point[]} points - the points that this segment refers to
- * @param {object} bounds
+ * @param {object} [bounds]
* @param {string} bounds.property - the property of a `Point` we are bounding. `x`, `y` or `angle`.
* @param {number} bounds.start - start value of the property
* @param {number} bounds.end - end value of the property
/**
* Returns the segments of the line that are inside given bounds
* @param {Line} line
- * @param {object} bounds
+ * @param {object} [bounds]
* @param {string} bounds.property - the property we are bounding with. `x`, `y` or `angle`.
* @param {number} bounds.start - start value of the `property`
* @param {number} bounds.end - end value of the `property`
* the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.
* @param {HTMLCanvasElement} canvas - The canvas from which to acquire context (platform specific)
* @param {object} options - The chart options
- * @returns {CanvasRenderingContext2D} context2d instance
*/
- acquireContext(canvas, options) { // eslint-disable-line no-unused-vars
- return undefined;
- }
+ acquireContext(canvas, options) {} // eslint-disable-line no-unused-vars
/**
* Called at chart destruction time, releases any resources associated to the context
* `element` has a size relative to its parent and this last one is not yet displayed,
* for example because of `display: none` on a parent node.
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
- * @returns {number} Size in pixels or undefined if unknown.
+ * @returns {number=} Size in pixels or undefined if unknown.
*/
function readUsedSize(element, property) {
const value = helpers.dom.getStyle(element, property);
/**
* @param {HTMLCanvasElement} canvas
* @param {{ options: { aspectRatio?: number; }; }} config
- * @return {CanvasRenderingContext2D=}
+ * @return {CanvasRenderingContext2D|null}
*/
acquireContext(canvas, config) {
// To prevent canvas fingerprinting, some add-ons undefine the getContext
import {almostEquals, almostWhole, log10, _decimalPlaces, _setMinAndMaxByKey, sign} from '../helpers/helpers.math';
import Scale from '../core/core.scale';
-// Implementation of the nice number algorithm used in determining where axis labels will go
+/**
+ * Implementation of the nice number algorithm used in determining where axis labels will go
+ * @return {number}
+ */
function niceNum(range, round) {
const exponent = Math.floor(log10(range));
const fraction = range / Math.pow(10, exponent);
* @param {object} obj
* @param {string} axis
* @param {number} index
- * @return {number}
+ * @return {number|null}
* @private
*/
_parseObject(obj, axis, index) {