code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function getHsla(string) { if (!string) { return; } var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; var match = string.match(hsl); if (match) { var alpha = parseFloat(match[4]); var h = scale(parseInt(match[1]), 0, 36...
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
getHsla
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getHwb(string) { if (!string) { return; } var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/; var match = string.match(hwb); if (match) { var alpha = parseFloat(match[4]); var h = scale(parseInt(match[1]), 0, 360), ...
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
getHwb
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getRgb(string) { var rgba = getRgba(string); return rgba && rgba.slice(0, 3); }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
getRgb
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getHsl(string) { var hsla = getHsla(string); return hsla && hsla.slice(0, 3); }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
getHsl
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getAlpha(string) { var vals = getRgba(string); if (vals) { return vals[3]; } else if (vals = getHsla(string)) { return vals[3]; } else if (vals = getHwb(string)) { return vals[3]; } }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
getAlpha
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function hexString(rgba, a) { var a = (a !== undefined && rgba.length === 3) ? a : rgba[3]; return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + ( (a >= 0 && a < 1) ? hexDouble(Math.round(a * 255)) ...
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
hexString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function rgbString(rgba, alpha) { if (alpha < 1 || (rgba[3] && rgba[3] < 1)) { return rgbaString(rgba, alpha); } return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
rgbString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function rgbaString(rgba, alpha) { if (alpha === undefined) { alpha = (rgba[3] !== undefined ? rgba[3] : 1); } return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ", " + alpha + ")"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
rgbaString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function percentString(rgba, alpha) { if (alpha < 1 || (rgba[3] && rgba[3] < 1)) { return percentaString(rgba, alpha); } var r = Math.round(rgba[0]/255 * 100), g = Math.round(rgba[1]/255 * 100), b = Math.round(rgba[2]/255 * 100); return "rgb(" + r + "%, " + g + "%, " + b + "%)"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
percentString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function percentaString(rgba, alpha) { var r = Math.round(rgba[0]/255 * 100), g = Math.round(rgba[1]/255 * 100), b = Math.round(rgba[2]/255 * 100); return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
percentaString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function hslString(hsla, alpha) { if (alpha < 1 || (hsla[3] && hsla[3] < 1)) { return hslaString(hsla, alpha); } return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
hslString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function hslaString(hsla, alpha) { if (alpha === undefined) { alpha = (hsla[3] !== undefined ? hsla[3] : 1); } return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + alpha + ")"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
hslaString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function hwbString(hwb, alpha) { if (alpha === undefined) { alpha = (hwb[3] !== undefined ? hwb[3] : 1); } return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%" + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")"; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
hwbString
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function keyword(rgb) { return reverseNames[rgb.slice(0, 3)]; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
keyword
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function scale(num, min, max) { return Math.min(Math.max(min, num), max); }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
scale
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function hexDouble(num) { var str = num.toString(16).toUpperCase(); return (str.length < 2) ? "0" + str : str; }
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
hexDouble
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
Color = function (obj) { if (obj instanceof Color) { return obj; } if (!(this instanceof Color)) { return new Color(obj); } this.valid = false; this.values = { rgb: [0, 0, 0], hsl: [0, 0, 0], hsv: [0, 0, 0], hwb: [0, 0, 0], cmyk: [0, 0, 0, 0], alpha: 1 }; // parse Color() argument var vals; ...
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
Color
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function isValidKey(key) { return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1; }
Ported from sass implementation in C https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
isValidKey
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
Surrogate = function() { this.constructor = ChartElement; }
Basic javascript inheritance based on the model created in Backbone.js
Surrogate
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
getRtlAdapter = function(rectX, width) { return { x: function(x) { return rectX + rectX + width - x; }, setWidth: function(w) { width = w; }, textAlign: function(align) { if (align === 'center') { return align; } return align === 'right' ? 'left' : 'right'; }, xPlus: function(x, value)...
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
getRtlAdapter
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
getLtrAdapter = function() { return { x: function(x) { return x; }, setWidth: function(w) { // eslint-disable-line no-unused-vars }, textAlign: function(align) { return align; }, xPlus: function(x, value) { return x + value; }, leftForLtr: function(x, _itemWidth) { // eslint-disable-line no-...
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
getLtrAdapter
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
getAdapter = function(rtl, rectX, width) { return rtl ? getRtlAdapter(rectX, width) : getLtrAdapter(); }
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
getAdapter
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
overrideTextDirection = function(ctx, direction) { var style, original; if (direction === 'ltr' || direction === 'rtl') { style = ctx.canvas.style; original = [ style.getPropertyValue('direction'), style.getPropertyPriority('direction'), ]; style.setProperty('direction', direction, 'important'); ctx....
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
overrideTextDirection
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
restoreTextDirection = function(ctx) { var original = ctx.prevTextDirection; if (original !== undefined) { delete ctx.prevTextDirection; ctx.canvas.style.setProperty('direction', original[0], original[1]); } }
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
restoreTextDirection
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function interpolate(start, view, model, ease) { var keys = Object.keys(model); var i, ilen, key, actual, origin, target, type, c0, c1; for (i = 0, ilen = keys.length; i < ilen; ++i) { key = keys[i]; target = model[key]; // if a value is added to the model after pivot() has been called, the view // doesn'...
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
interpolate
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
Element = function(configuration) { helpers$1.extend(this, configuration); this.initialize.apply(this, arguments); }
Provided for backward compatibility, use Chart.helpers.math.log10 instead. @namespace Chart.helpers.log10 @deprecated since version 2.9.0 @todo remove at version 3 @private
Element
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function listenArrayEvents(array, listener) { if (array._chartjs) { array._chartjs.listeners.push(listener); return; } Object.defineProperty(array, '_chartjs', { configurable: true, enumerable: false, value: { listeners: [listener] } }); arrayEvents.forEach(function(key) { var method = 'onData' ...
Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice', 'unshift') and notify the listener AFTER the array has been altered. Listeners are called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.
listenArrayEvents
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function unlistenArrayEvents(array, listener) { var stub = array._chartjs; if (!stub) { return; } var listeners = stub.listeners; var index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } if (listeners.length > 0) { return; } arrayEvents.forEach(function(key) { dele...
Removes the given array event listener and cleanup extra attached properties (such as the _chartjs stub and overridden methods) if array doesn't have any more listeners.
unlistenArrayEvents
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
DatasetController = function(chart, datasetIndex) { this.initialize(chart, datasetIndex); }
Removes the given array event listener and cleanup extra attached properties (such as the _chartjs stub and overridden methods) if array doesn't have any more listeners.
DatasetController
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getBarBounds(vm) { var x1, x2, y1, y2, half; if (isVertical(vm)) { half = vm.width / 2; x1 = vm.x - half; x2 = vm.x + half; y1 = Math.min(vm.y, vm.base); y2 = Math.max(vm.y, vm.base); } else { half = vm.height / 2; x1 = Math.min(vm.x, vm.base); x2 = Math.max(vm.x, vm.base); y1 = vm.y - ha...
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
getBarBounds
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function swap(orig, v1, v2) { return orig === v1 ? v2 : orig === v2 ? v1 : orig; }
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
swap
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseBorderSkipped(vm) { var edge = vm.borderSkipped; var res = {}; if (!edge) { return res; } if (vm.horizontal) { if (vm.base > vm.x) { edge = swap(edge, 'left', 'right'); } } else if (vm.base < vm.y) { edge = swap(edge, 'bottom', 'top'); } res[edge] = true; return res; }
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
parseBorderSkipped
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseBorderWidth(vm, maxW, maxH) { var value = vm.borderWidth; var skip = parseBorderSkipped(vm); var t, r, b, l; if (helpers$1.isObject(value)) { t = +value.top || 0; r = +value.right || 0; b = +value.bottom || 0; l = +value.left || 0; } else { t = r = b = l = +value || 0; } return { t: s...
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
parseBorderWidth
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function boundingRects(vm) { var bounds = getBarBounds(vm); var width = bounds.right - bounds.left; var height = bounds.bottom - bounds.top; var border = parseBorderWidth(vm, width / 2, height / 2); return { outer: { x: bounds.left, y: bounds.top, w: width, h: height }, inner: { x: bounds.lef...
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
boundingRects
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function inRange(vm, x, y) { var skipX = x === null; var skipY = y === null; var bounds = !vm || (skipX && skipY) ? false : getBarBounds(vm); return bounds && (skipX || x >= bounds.left && x <= bounds.right) && (skipY || y >= bounds.top && y <= bounds.bottom); }
Helper function to get the bounds of the bar regardless of the orientation @param bar {Chart.Element.Rectangle} the bar @return {Bounds} bounds of the bar @private
inRange
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function computeMinSampleSize(scale, pixels) { var min = scale._length; var prev, curr, i, ilen; for (i = 1, ilen = pixels.length; i < ilen; ++i) { min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1])); } for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) { curr = scale.getPixelForTick(i); min =...
Computes the "optimal" sample size to maintain bars equally sized while preventing overlap. @private
computeMinSampleSize
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function computeFitCategoryTraits(index, ruler, options) { var thickness = options.barThickness; var count = ruler.stackCount; var curr = ruler.pixels[index]; var min = helpers$1.isNullOrUndef(thickness) ? computeMinSampleSize(ruler.scale, ruler.pixels) : -1; var size, ratio; if (helpers$1.isNullOrUndef(thic...
Computes an "ideal" category based on the absolute bar thickness or, if undefined or null, uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This mode currently always generates bars equally sized (until we introduce scriptable options?). @private
computeFitCategoryTraits
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function computeFlexCategoryTraits(index, ruler, options) { var pixels = ruler.pixels; var curr = pixels[index]; var prev = index > 0 ? pixels[index - 1] : null; var next = index < pixels.length - 1 ? pixels[index + 1] : null; var percent = options.categoryPercentage; var start, size; if (prev === null) { // ...
Computes an "optimal" category that globally arranges bars side by side (no gap when percentage options are 1), based on the previous and following categories. This mode generates bars with different widths when data are not evenly spaced. @private
computeFlexCategoryTraits
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getRelativePosition(e, chart) { if (e.native) { return { x: e.x, y: e.y }; } return helpers$1.getRelativePosition(e, chart); }
Helper function to get relative position for an event @param {Event|IEvent} event - The event to get the position for @param {Chart} chart - The chart @returns {object} the event position
getRelativePosition
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseVisibleItems(chart, handler) { var metasets = chart._getSortedVisibleDatasetMetas(); var metadata, i, j, ilen, jlen, element; for (i = 0, ilen = metasets.length; i < ilen; ++i) { metadata = metasets[i].data; for (j = 0, jlen = metadata.length; j < jlen; ++j) { element = metadata[j]; if (!ele...
Helper function to traverse all of the visible elements in the chart @param {Chart} chart - the chart @param {function} handler - the callback to execute for each visible item
parseVisibleItems
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getIntersectItems(chart, position) { var elements = []; parseVisibleItems(chart, function(element) { if (element.inRange(position.x, position.y)) { elements.push(element); } }); return elements; }
Helper function to get the items that intersect the event position @param {ChartElement[]} items - elements to filter @param {object} position - the point to be nearest to @return {ChartElement[]} the nearest items
getIntersectItems
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getNearestItems(chart, position, intersect, distanceMetric) { var minDistance = Number.POSITIVE_INFINITY; var nearestItems = []; parseVisibleItems(chart, function(element) { if (intersect && !element.inRange(position.x, position.y)) { return; } var center = element.getCenterPoint(); var distanc...
Helper function to get the items nearest to the event position considering all visible items in teh chart @param {Chart} chart - the chart to look at elements from @param {object} position - the point to be nearest to @param {boolean} intersect - if true, only consider items that intersect the position @param {function...
getNearestItems
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getDistanceMetricForAxis(axis) { var useX = axis.indexOf('x') !== -1; var useY = axis.indexOf('y') !== -1; return function(pt1, pt2) { var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0; var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0; return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); }; }
Get a distance metric function for two points based on the axis mode setting @param {string} axis - the axis mode. x|y|xy
getDistanceMetricForAxis
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function indexMode(chart, e, options) { var position = getRelativePosition(e, chart); // Default axis for index mode is 'x' to match old behaviour options.axis = options.axis || 'x'; var distanceMetric = getDistanceMetricForAxis(options.axis); var items = options.intersect ? getIntersectItems(chart, position) : ge...
Get a distance metric function for two points based on the axis mode setting @param {string} axis - the axis mode. x|y|xy
indexMode
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function filterByPosition(array, position) { return helpers$1.where(array, function(v) { return v.pos === position; }); }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
filterByPosition
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function sortByWeight(array, reverse) { return array.sort(function(a, b) { var v0 = reverse ? b : a; var v1 = reverse ? a : b; return v0.weight === v1.weight ? v0.index - v1.index : v0.weight - v1.weight; }); }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
sortByWeight
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function wrapBoxes(boxes) { var layoutBoxes = []; var i, ilen, box; for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) { box = boxes[i]; layoutBoxes.push({ index: i, box: box, pos: box.position, horizontal: box.isHorizontal(), weight: box.weight }); } return layoutBoxes; }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
wrapBoxes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function setLayoutDims(layouts, params) { var i, ilen, layout; for (i = 0, ilen = layouts.length; i < ilen; ++i) { layout = layouts[i]; // store width used instead of chartArea.w in fitBoxes layout.width = layout.horizontal ? layout.box.fullWidth && params.availableWidth : params.vBoxMaxWidth; // store ...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
setLayoutDims
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function buildLayoutBoxes(boxes) { var layoutBoxes = wrapBoxes(boxes); var left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true); var right = sortByWeight(filterByPosition(layoutBoxes, 'right')); var top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true); var bottom = sortByWeight(filterByPositi...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
buildLayoutBoxes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getCombinedMax(maxPadding, chartArea, a, b) { return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]); }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
getCombinedMax
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function updateDims(chartArea, params, layout) { var box = layout.box; var maxPadding = chartArea.maxPadding; var newWidth, newHeight; if (layout.size) { // this layout was already counted for, lets first reduce old size chartArea[layout.pos] -= layout.size; } layout.size = layout.horizontal ? box.height : b...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
updateDims
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function handleMaxPadding(chartArea) { var maxPadding = chartArea.maxPadding; function updatePos(pos) { var change = Math.max(maxPadding[pos] - chartArea[pos], 0); chartArea[pos] += change; return change; } chartArea.y += updatePos('top'); chartArea.x += updatePos('left'); updatePos('right'); updatePos('b...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
handleMaxPadding
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function updatePos(pos) { var change = Math.max(maxPadding[pos] - chartArea[pos], 0); chartArea[pos] += change; return change; }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
updatePos
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getMargins(horizontal, chartArea) { var maxPadding = chartArea.maxPadding; function marginForPositions(positions) { var margin = {left: 0, top: 0, right: 0, bottom: 0}; positions.forEach(function(pos) { margin[pos] = Math.max(chartArea[pos], maxPadding[pos]); }); return margin; } return horizo...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
getMargins
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function marginForPositions(positions) { var margin = {left: 0, top: 0, right: 0, bottom: 0}; positions.forEach(function(pos) { margin[pos] = Math.max(chartArea[pos], maxPadding[pos]); }); return margin; }
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
marginForPositions
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function fitBoxes(boxes, chartArea, params) { var refitBoxes = []; var i, ilen, layout, box, refit, changed; for (i = 0, ilen = boxes.length; i < ilen; ++i) { layout = boxes[i]; box = layout.box; box.update( layout.width || chartArea.w, layout.height || chartArea.h, getMargins(layout.horizontal, cha...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
fitBoxes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function placeBoxes(boxes, chartArea, params) { var userPadding = params.padding; var x = chartArea.x; var y = chartArea.y; var i, ilen, layout, box; for (i = 0, ilen = boxes.length; i < ilen; ++i) { layout = boxes[i]; box = layout.box; if (layout.horizontal) { box.left = box.fullWidth ? userPadding.left...
y mode returns the elements that hit-test at the current y coordinate @function Chart.Interaction.modes.y @param {Chart} chart - the chart we are returning items from @param {Event} e - the event we are find things at @param {IInteractionOptions} options - options to use @return {Chart.Element[]} Array of elements that...
placeBoxes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function initCanvas(canvas, config) { var style = canvas.style; // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it // returns null or '' if no explicit value has been set to the canvas attribute. var renderHeight = canvas.getAttribute('height'); var renderWidth = canvas.getAttribute('...
Initializes the canvas style and render size without modifying the canvas display size, since responsiveness is handled by the controller.resize() method. The config is used to determine the aspect ratio to apply in case no explicit height has been specified.
initCanvas
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function injectCSS(rootNode, css) { // https://stackoverflow.com/q/3922139 var expando = rootNode[EXPANDO_KEY] || (rootNode[EXPANDO_KEY] = {}); if (!expando.containsStyles) { expando.containsStyles = true; css = '/* Chart.js */\n' + css; var style = document.createElement('style'); style.setAttribute('type',...
Injects CSS styles inline if the styles are not already present. @param {HTMLDocument|ShadowRoot} rootNode - the node to contain the <style>. @param {string} css - the CSS to be injected.
injectCSS
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function pushOrConcat(base, toPush) { if (toPush) { if (helpers$1.isArray(toPush)) { // base = base.concat(toPush); Array.prototype.push.apply(base, toPush); } else { base.push(toPush); } } return base; }
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 eventPosition {object} the position of the event in canvas coordinates @returns {object} the tooltip position
pushOrConcat
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function splitNewlines(str) { if ((typeof str === 'string' || str instanceof String) && str.indexOf('\n') > -1) { return str.split('\n'); } return str; }
Returns array of strings split by newline @param {string} value - The value to split by newline. @returns {string[]} value if newline present - Returned from String split() method @function
splitNewlines
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function createTooltipItem(element) { var xScale = element._xScale; var yScale = element._yScale || element._scale; // handle radar || polarArea charts var index = element._index; var datasetIndex = element._datasetIndex; var controller = element._chart.getDatasetMeta(datasetIndex).controller; var indexScale = co...
Private helper to create a tooltip item model @param element - the chart element (point, arc, bar) to create the tooltip item for @return new tooltip item
createTooltipItem
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getBaseModel(tooltipOpts) { var globalDefaults = core_defaults.global; return { // Positioning xPadding: tooltipOpts.xPadding, yPadding: tooltipOpts.yPadding, xAlign: tooltipOpts.xAlign, yAlign: tooltipOpts.yAlign, // Drawing direction and text direction rtl: tooltipOpts.rtl, textDirection:...
Helper to get the reset model for the tooltip @param tooltipOpts {object} the tooltip options
getBaseModel
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getTooltipSize(tooltip, model) { var ctx = tooltip._chart.ctx; var height = model.yPadding * 2; // Tooltip Padding var width = 0; // Count of all lines in the body var body = model.body; var combinedBodyLength = body.reduce(function(count, bodyItem) { return count + bodyItem.before.length + bodyItem....
Get the size of the tooltip
getTooltipSize
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
maxLineWidth = function(line) { width = Math.max(width, ctx.measureText(line).width + widthPadding); }
Get the size of the tooltip
maxLineWidth
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function determineAlignment(tooltip, size) { var model = tooltip._model; var chart = tooltip._chart; var chartArea = tooltip._chart.chartArea; var xAlign = 'center'; var yAlign = 'center'; if (model.y < size.height) { yAlign = 'top'; } else if (model.y > (chart.height - size.height)) { yAlign = 'bottom'; }...
Helper to get the alignment of a tooltip given the size
determineAlignment
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getBackgroundPoint(vm, size, alignment, chart) { // Background Position var x = vm.x; var y = vm.y; var caretSize = vm.caretSize; var caretPadding = vm.caretPadding; var cornerRadius = vm.cornerRadius; var xAlign = alignment.xAlign; var yAlign = alignment.yAlign; var paddingAndSize = caretSize + care...
Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment
getBackgroundPoint
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getAlignedX(vm, align) { return align === 'center' ? vm.x + vm.width / 2 : align === 'right' ? vm.x + vm.width - vm.xPadding : vm.x + vm.xPadding; }
Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment
getAlignedX
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getBeforeAfterBodyLines(callback) { return pushOrConcat([], splitNewlines(callback)); }
Helper to build before and after body lines
getBeforeAfterBodyLines
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
fillLineOfText = function(line) { ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyFontSize / 2); pt.y += bodyFontSize + bodySpacing; }
Helper to build before and after body lines
fillLineOfText
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function mergeScaleConfig(/* config objects ... */) { return helpers$1.merge(Object.create(null), [].slice.call(arguments), { merger: function(key, target, source, options) { if (key === 'xAxes' || key === 'yAxes') { var slen = source[key].length; var i, type, scale; if (!target[key]) { target[k...
Recursively merge the given config objects representing the `scales` option by incorporating scale defaults in `xAxes` and `yAxes` array items, then returns a deep copy of the result, thus doesn't alter inputs.
mergeScaleConfig
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function mergeConfig(/* config objects ... */) { return helpers$1.merge(Object.create(null), [].slice.call(arguments), { merger: function(key, target, source, options) { var tval = target[key] || Object.create(null); var sval = source[key]; if (key === 'scales') { // scale config merging is complex. Ad...
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
mergeConfig
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function initConfig(config) { config = config || Object.create(null); // Do NOT use mergeConfig for the data object because this method merges arrays // and so would change references to labels and datasets, preventing data updates. var data = config.data = config.data || {}; data.datasets = data.datasets || []; ...
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
initConfig
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function updateConfig(chart) { var newOptions = chart.options; helpers$1.each(chart.scales, function(scale) { core_layouts.removeBox(chart, scale); }); newOptions = mergeConfig( core_defaults.global, core_defaults[chart.config.type], newOptions); chart.options = chart.config.options = newOptions; chart...
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
updateConfig
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function nextAvailableScaleId(axesOpts, prefix, index) { var id; var hasId = function(obj) { return obj.id === id; }; do { id = prefix + index++; } while (helpers$1.findIndex(axesOpts, hasId) >= 0); return id; }
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
nextAvailableScaleId
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
hasId = function(obj) { return obj.id === id; }
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
hasId
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function positionIsHorizontal(position) { return position === 'top' || position === 'bottom'; }
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
positionIsHorizontal
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function compare2Level(l1, l2) { return function(a, b) { return a[l1] === b[l1] ? a[l2] - b[l2] : a[l1] - b[l1]; }; }
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
compare2Level
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
Chart = function(item, config) { this.construct(item, config); return this; }
Recursively merge the given config objects as the root options by handling default scale options for the `scales` and `scale` properties, then returns a deep copy of the result, thus doesn't alter inputs.
Chart
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
onComplete = function(animation) { core_plugins.notify(me, 'afterRender'); helpers$1.callback(animationOptions && animationOptions.onComplete, [animation], me); }
Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate` hook, in which case, plugins will not be called on `afterDatasetUpdate`. @private
onComplete
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseMaxStyle(styleValue, node, parentProperty) { var valueInPixels; if (typeof styleValue === 'string') { valueInPixels = parseInt(styleValue, 10); if (styleValue.indexOf('%') !== -1) { // percentage * size in dimension valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty]; ...
Returns the aligned pixel value to avoid anti-aliasing blur @param {Chart} chart - The chart instance. @param {number} pixel - A pixel value. @param {number} width - The width of the element. @returns {number} The aligned pixel value. @private
parseMaxStyle
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function isConstrainedValue(value) { return value !== undefined && value !== null && value !== 'none'; }
Returns if the given value contains an effective constraint. @private
isConstrainedValue
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getConstraintDimension(domNode, maxStyle, percentageProperty) { var view = document.defaultView; var parentNode = helpers$1._getParentNode(domNode); var constrainedNode = view.getComputedStyle(domNode)[maxStyle]; var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle]; var hasCNode = i...
Returns the max width or height of the given DOM node in a cross-browser compatible fashion @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 - pr...
getConstraintDimension
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function computeLabelSizes(ctx, tickFonts, ticks, caches) { var length = ticks.length; var widths = []; var heights = []; var offsets = []; var widestLabelSize = 0; var highestLabelSize = 0; var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest; for (i = 0;...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
computeLabelSizes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function valueAt(idx) { return { width: widths[idx] || 0, height: heights[idx] || 0, offset: offsets[idx] || 0 }; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
valueAt
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getTickMarkLength(options) { return options.drawTicks ? options.tickMarkLength : 0; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
getTickMarkLength
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getScaleLabelHeight(options) { var font, padding; if (!options.display) { return 0; } font = helpers$1.options._parseFont(options); padding = helpers$1.options.toPadding(options.padding); return font.lineHeight + padding.height; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
getScaleLabelHeight
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseFontOptions(options, nestedOpts) { return helpers$1.extend(helpers$1.options._parseFont({ fontFamily: valueOrDefault$a(nestedOpts.fontFamily, options.fontFamily), fontSize: valueOrDefault$a(nestedOpts.fontSize, options.fontSize), fontStyle: valueOrDefault$a(nestedOpts.fontStyle, options.fontStyle),...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
parseFontOptions
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function parseTickFontOptions(options) { var minor = parseFontOptions(options, options.minor); var major = options.major.enabled ? parseFontOptions(options, options.major) : minor; return {minor: minor, major: major}; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
parseTickFontOptions
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function nonSkipped(ticksToFilter) { var filtered = []; var item, index, len; for (index = 0, len = ticksToFilter.length; index < len; ++index) { item = ticksToFilter[index]; if (typeof item._index !== 'undefined') { filtered.push(item); } } return filtered; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
nonSkipped
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getEvenSpacing(arr) { var len = arr.length; var i, diff; if (len < 2) { return false; } for (diff = arr[0], i = 1; i < len; ++i) { if (arr[i] - arr[i - 1] !== diff) { return false; } } return diff; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
getEvenSpacing
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function calculateSpacing(majorIndices, ticks, axisLength, ticksLimit) { var evenMajorSpacing = getEvenSpacing(majorIndices); var spacing = (ticks.length - 1) / ticksLimit; var factors, factor, i, ilen; // If the major ticks are evenly spaced apart, place the minor ticks // so that they divide the major ticks int...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
calculateSpacing
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getMajorIndices(ticks) { var result = []; var i, ilen; for (i = 0, ilen = ticks.length; i < ilen; i++) { if (ticks[i].major) { result.push(i); } } return result; }
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
getMajorIndices
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function skipMajors(ticks, majorIndices, spacing) { var count = 0; var next = majorIndices[0]; var i, tick; spacing = Math.ceil(spacing); for (i = 0; i < ticks.length; i++) { tick = ticks[i]; if (i === next) { tick._index = i; count++; next = majorIndices[count * spacing]; } else { delete tick.l...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
skipMajors
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function skip(ticks, spacing, majorStart, majorEnd) { var start = valueOrDefault$a(majorStart, 0); var end = Math.min(valueOrDefault$a(majorEnd, ticks.length), ticks.length); var count = 0; var length, i, tick, next; spacing = Math.ceil(spacing); if (majorEnd) { length = majorEnd - majorStart; spacing = leng...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
skip
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function generateTicks(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var MIN_SPACING =...
Generate a set of linear ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
generateTicks
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function getOrCreateStack(stacks, stacked, meta) { var key = [ meta.type, // we have a separate stack for stack=undefined datasets when the opts.stacked is undefined stacked === undefined && meta.stack === undefined ? meta.index : '', meta.stack ].join('.'); if (stacks[key] === undefined) { stacks[key] = ...
Generate a set of linear ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
getOrCreateStack
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function stackData(scale, stacks, meta, data) { var opts = scale.options; var stacked = opts.stacked; var stack = getOrCreateStack(stacks, stacked, meta); var pos = stack.pos; var neg = stack.neg; var ilen = data.length; var i, value; for (i = 0; i < ilen; ++i) { value = scale._parseValue(data[i]); if (isN...
Generate a set of linear ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
stackData
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function updateMinMax(scale, meta, data) { var ilen = data.length; var i, value; for (i = 0; i < ilen; ++i) { value = scale._parseValue(data[i]); if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden) { continue; } scale.min = Math.min(scale.min, value.min); scale.max = Math.max(scale.max, v...
Generate a set of linear ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
updateMinMax
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT
function generateTicks$1(generationOptions, dataRange) { var ticks = []; var tickVal = valueOrDefault$b(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min)))); var endExp = Math.floor(log10(dataRange.max)); var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp)); var exp, significand...
Generate a set of logarithmic ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
generateTicks$1
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls-demo.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls-demo.js
MIT