id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1 value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,500 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (options, isX, redraw, animation) {
var key = isX ? 'xAxis' : 'yAxis',
chartOptions = this.options,
axis;
/*jslint unused: false*/
axis = new Axis(this, merge(options, {
index: this[key].length,
isX: isX
}));
/*jslint unused: true*/
// Push the new axis options to the chart options
chartOptions[key] = splat(chartOptions[key] || {});
chartOptions[key].push(options);
if (pick(redraw, true)) {
this.redraw(animation);
}
} | javascript | function (options, isX, redraw, animation) {
var key = isX ? 'xAxis' : 'yAxis',
chartOptions = this.options,
axis;
/*jslint unused: false*/
axis = new Axis(this, merge(options, {
index: this[key].length,
isX: isX
}));
/*jslint unused: true*/
// Push the new axis options to the chart options
chartOptions[key] = splat(chartOptions[key] || {});
chartOptions[key].push(options);
if (pick(redraw, true)) {
this.redraw(animation);
}
} | [
"function",
"(",
"options",
",",
"isX",
",",
"redraw",
",",
"animation",
")",
"{",
"var",
"key",
"=",
"isX",
"?",
"'xAxis'",
":",
"'yAxis'",
",",
"chartOptions",
"=",
"this",
".",
"options",
",",
"axis",
";",
"/*jslint unused: false*/",
"axis",
"=",
"new",
"Axis",
"(",
"this",
",",
"merge",
"(",
"options",
",",
"{",
"index",
":",
"this",
"[",
"key",
"]",
".",
"length",
",",
"isX",
":",
"isX",
"}",
")",
")",
";",
"/*jslint unused: true*/",
"// Push the new axis options to the chart options",
"chartOptions",
"[",
"key",
"]",
"=",
"splat",
"(",
"chartOptions",
"[",
"key",
"]",
"||",
"{",
"}",
")",
";",
"chartOptions",
"[",
"key",
"]",
".",
"push",
"(",
"options",
")",
";",
"if",
"(",
"pick",
"(",
"redraw",
",",
"true",
")",
")",
"{",
"this",
".",
"redraw",
"(",
"animation",
")",
";",
"}",
"}"
] | Add an axis to the chart
@param {Object} options The axis option
@param {Boolean} isX Whether it is an X axis or a value axis | [
"Add",
"an",
"axis",
"to",
"the",
"chart"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10674-L10693 | |
23,501 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (plotX, plotY, inverted) {
var x = inverted ? plotY : plotX,
y = inverted ? plotX : plotY;
return x >= 0 &&
x <= this.plotWidth &&
y >= 0 &&
y <= this.plotHeight;
} | javascript | function (plotX, plotY, inverted) {
var x = inverted ? plotY : plotX,
y = inverted ? plotX : plotY;
return x >= 0 &&
x <= this.plotWidth &&
y >= 0 &&
y <= this.plotHeight;
} | [
"function",
"(",
"plotX",
",",
"plotY",
",",
"inverted",
")",
"{",
"var",
"x",
"=",
"inverted",
"?",
"plotY",
":",
"plotX",
",",
"y",
"=",
"inverted",
"?",
"plotX",
":",
"plotY",
";",
"return",
"x",
">=",
"0",
"&&",
"x",
"<=",
"this",
".",
"plotWidth",
"&&",
"y",
">=",
"0",
"&&",
"y",
"<=",
"this",
".",
"plotHeight",
";",
"}"
] | Check whether a given point is within the plot area
@param {Number} plotX Pixel x relative to the plot area
@param {Number} plotY Pixel y relative to the plot area
@param {Boolean} inverted Whether the chart is inverted | [
"Check",
"whether",
"a",
"given",
"point",
"is",
"within",
"the",
"plot",
"area"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10702-L10710 | |
23,502 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (str) {
var chart = this,
options = chart.options,
loadingDiv = chart.loadingDiv;
var loadingOptions = options.loading;
// create the layer at the first call
if (!loadingDiv) {
chart.loadingDiv = loadingDiv = createElement(DIV, {
className: PREFIX + 'loading'
}, extend(loadingOptions.style, {
zIndex: 10,
display: NONE
}), chart.container);
chart.loadingSpan = createElement(
'span',
null,
loadingOptions.labelStyle,
loadingDiv
);
}
// update text
chart.loadingSpan.innerHTML = str || options.lang.loading;
// show it
if (!chart.loadingShown) {
css(loadingDiv, {
opacity: 0,
display: '',
left: chart.plotLeft + PX,
top: chart.plotTop + PX,
width: chart.plotWidth + PX,
height: chart.plotHeight + PX
});
animate(loadingDiv, {
opacity: loadingOptions.style.opacity
}, {
duration: loadingOptions.showDuration || 0
});
chart.loadingShown = true;
}
} | javascript | function (str) {
var chart = this,
options = chart.options,
loadingDiv = chart.loadingDiv;
var loadingOptions = options.loading;
// create the layer at the first call
if (!loadingDiv) {
chart.loadingDiv = loadingDiv = createElement(DIV, {
className: PREFIX + 'loading'
}, extend(loadingOptions.style, {
zIndex: 10,
display: NONE
}), chart.container);
chart.loadingSpan = createElement(
'span',
null,
loadingOptions.labelStyle,
loadingDiv
);
}
// update text
chart.loadingSpan.innerHTML = str || options.lang.loading;
// show it
if (!chart.loadingShown) {
css(loadingDiv, {
opacity: 0,
display: '',
left: chart.plotLeft + PX,
top: chart.plotTop + PX,
width: chart.plotWidth + PX,
height: chart.plotHeight + PX
});
animate(loadingDiv, {
opacity: loadingOptions.style.opacity
}, {
duration: loadingOptions.showDuration || 0
});
chart.loadingShown = true;
}
} | [
"function",
"(",
"str",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"options",
"=",
"chart",
".",
"options",
",",
"loadingDiv",
"=",
"chart",
".",
"loadingDiv",
";",
"var",
"loadingOptions",
"=",
"options",
".",
"loading",
";",
"// create the layer at the first call",
"if",
"(",
"!",
"loadingDiv",
")",
"{",
"chart",
".",
"loadingDiv",
"=",
"loadingDiv",
"=",
"createElement",
"(",
"DIV",
",",
"{",
"className",
":",
"PREFIX",
"+",
"'loading'",
"}",
",",
"extend",
"(",
"loadingOptions",
".",
"style",
",",
"{",
"zIndex",
":",
"10",
",",
"display",
":",
"NONE",
"}",
")",
",",
"chart",
".",
"container",
")",
";",
"chart",
".",
"loadingSpan",
"=",
"createElement",
"(",
"'span'",
",",
"null",
",",
"loadingOptions",
".",
"labelStyle",
",",
"loadingDiv",
")",
";",
"}",
"// update text",
"chart",
".",
"loadingSpan",
".",
"innerHTML",
"=",
"str",
"||",
"options",
".",
"lang",
".",
"loading",
";",
"// show it",
"if",
"(",
"!",
"chart",
".",
"loadingShown",
")",
"{",
"css",
"(",
"loadingDiv",
",",
"{",
"opacity",
":",
"0",
",",
"display",
":",
"''",
",",
"left",
":",
"chart",
".",
"plotLeft",
"+",
"PX",
",",
"top",
":",
"chart",
".",
"plotTop",
"+",
"PX",
",",
"width",
":",
"chart",
".",
"plotWidth",
"+",
"PX",
",",
"height",
":",
"chart",
".",
"plotHeight",
"+",
"PX",
"}",
")",
";",
"animate",
"(",
"loadingDiv",
",",
"{",
"opacity",
":",
"loadingOptions",
".",
"style",
".",
"opacity",
"}",
",",
"{",
"duration",
":",
"loadingOptions",
".",
"showDuration",
"||",
"0",
"}",
")",
";",
"chart",
".",
"loadingShown",
"=",
"true",
";",
"}",
"}"
] | Dim the chart and show a loading text or symbol
@param {String} str An optional text to show in the loading label instead of the default one | [
"Dim",
"the",
"chart",
"and",
"show",
"a",
"loading",
"text",
"or",
"symbol"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10884-L10929 | |
23,503 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var options = this.options,
loadingDiv = this.loadingDiv;
if (loadingDiv) {
animate(loadingDiv, {
opacity: 0
}, {
duration: options.loading.hideDuration || 100,
complete: function () {
css(loadingDiv, { display: NONE });
}
});
}
this.loadingShown = false;
} | javascript | function () {
var options = this.options,
loadingDiv = this.loadingDiv;
if (loadingDiv) {
animate(loadingDiv, {
opacity: 0
}, {
duration: options.loading.hideDuration || 100,
complete: function () {
css(loadingDiv, { display: NONE });
}
});
}
this.loadingShown = false;
} | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"loadingDiv",
"=",
"this",
".",
"loadingDiv",
";",
"if",
"(",
"loadingDiv",
")",
"{",
"animate",
"(",
"loadingDiv",
",",
"{",
"opacity",
":",
"0",
"}",
",",
"{",
"duration",
":",
"options",
".",
"loading",
".",
"hideDuration",
"||",
"100",
",",
"complete",
":",
"function",
"(",
")",
"{",
"css",
"(",
"loadingDiv",
",",
"{",
"display",
":",
"NONE",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"this",
".",
"loadingShown",
"=",
"false",
";",
"}"
] | Hide the loading layer | [
"Hide",
"the",
"loading",
"layer"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L10934-L10949 | |
23,504 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var points = [];
each(this.series, function (serie) {
points = points.concat(grep(serie.points || [], function (point) {
return point.selected;
}));
});
return points;
} | javascript | function () {
var points = [];
each(this.series, function (serie) {
points = points.concat(grep(serie.points || [], function (point) {
return point.selected;
}));
});
return points;
} | [
"function",
"(",
")",
"{",
"var",
"points",
"=",
"[",
"]",
";",
"each",
"(",
"this",
".",
"series",
",",
"function",
"(",
"serie",
")",
"{",
"points",
"=",
"points",
".",
"concat",
"(",
"grep",
"(",
"serie",
".",
"points",
"||",
"[",
"]",
",",
"function",
"(",
"point",
")",
"{",
"return",
"point",
".",
"selected",
";",
"}",
")",
")",
";",
"}",
")",
";",
"return",
"points",
";",
"}"
] | Get the currently selected points from all series | [
"Get",
"the",
"currently",
"selected",
"points",
"from",
"all",
"series"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11025-L11033 | |
23,505 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this;
// reset stacks for each yAxis
each(chart.yAxis, function (axis) {
if (axis.stacks && axis.hasVisibleSeries) {
axis.oldStacks = axis.stacks;
}
});
each(chart.series, function (series) {
if (series.options.stacking && (series.visible === true || chart.options.chart.ignoreHiddenSeries === false)) {
series.stackKey = series.type + pick(series.options.stack, '');
}
});
} | javascript | function () {
var chart = this;
// reset stacks for each yAxis
each(chart.yAxis, function (axis) {
if (axis.stacks && axis.hasVisibleSeries) {
axis.oldStacks = axis.stacks;
}
});
each(chart.series, function (series) {
if (series.options.stacking && (series.visible === true || chart.options.chart.ignoreHiddenSeries === false)) {
series.stackKey = series.type + pick(series.options.stack, '');
}
});
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
";",
"// reset stacks for each yAxis",
"each",
"(",
"chart",
".",
"yAxis",
",",
"function",
"(",
"axis",
")",
"{",
"if",
"(",
"axis",
".",
"stacks",
"&&",
"axis",
".",
"hasVisibleSeries",
")",
"{",
"axis",
".",
"oldStacks",
"=",
"axis",
".",
"stacks",
";",
"}",
"}",
")",
";",
"each",
"(",
"chart",
".",
"series",
",",
"function",
"(",
"series",
")",
"{",
"if",
"(",
"series",
".",
"options",
".",
"stacking",
"&&",
"(",
"series",
".",
"visible",
"===",
"true",
"||",
"chart",
".",
"options",
".",
"chart",
".",
"ignoreHiddenSeries",
"===",
"false",
")",
")",
"{",
"series",
".",
"stackKey",
"=",
"series",
".",
"type",
"+",
"pick",
"(",
"series",
".",
"options",
".",
"stack",
",",
"''",
")",
";",
"}",
"}",
")",
";",
"}"
] | Generate stacks for each series and calculate stacks total values | [
"Generate",
"stacks",
"for",
"each",
"series",
"and",
"calculate",
"stacks",
"total",
"values"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11047-L11062 | |
23,506 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
lang = defaultOptions.lang,
btnOptions = chart.options.chart.resetZoomButton,
theme = btnOptions.theme,
states = theme.states,
alignTo = btnOptions.relativeTo === 'chart' ? null : 'plotBox';
this.resetZoomButton = chart.renderer.button(lang.resetZoom, null, null, function () { chart.zoomOut(); }, theme, states && states.hover)
.attr({
align: btnOptions.position.align,
title: lang.resetZoomTitle
})
.add()
.align(btnOptions.position, false, alignTo);
} | javascript | function () {
var chart = this,
lang = defaultOptions.lang,
btnOptions = chart.options.chart.resetZoomButton,
theme = btnOptions.theme,
states = theme.states,
alignTo = btnOptions.relativeTo === 'chart' ? null : 'plotBox';
this.resetZoomButton = chart.renderer.button(lang.resetZoom, null, null, function () { chart.zoomOut(); }, theme, states && states.hover)
.attr({
align: btnOptions.position.align,
title: lang.resetZoomTitle
})
.add()
.align(btnOptions.position, false, alignTo);
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"lang",
"=",
"defaultOptions",
".",
"lang",
",",
"btnOptions",
"=",
"chart",
".",
"options",
".",
"chart",
".",
"resetZoomButton",
",",
"theme",
"=",
"btnOptions",
".",
"theme",
",",
"states",
"=",
"theme",
".",
"states",
",",
"alignTo",
"=",
"btnOptions",
".",
"relativeTo",
"===",
"'chart'",
"?",
"null",
":",
"'plotBox'",
";",
"this",
".",
"resetZoomButton",
"=",
"chart",
".",
"renderer",
".",
"button",
"(",
"lang",
".",
"resetZoom",
",",
"null",
",",
"null",
",",
"function",
"(",
")",
"{",
"chart",
".",
"zoomOut",
"(",
")",
";",
"}",
",",
"theme",
",",
"states",
"&&",
"states",
".",
"hover",
")",
".",
"attr",
"(",
"{",
"align",
":",
"btnOptions",
".",
"position",
".",
"align",
",",
"title",
":",
"lang",
".",
"resetZoomTitle",
"}",
")",
".",
"add",
"(",
")",
".",
"align",
"(",
"btnOptions",
".",
"position",
",",
"false",
",",
"alignTo",
")",
";",
"}"
] | Display the zoom button | [
"Display",
"the",
"zoom",
"button"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11067-L11083 | |
23,507 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (event) {
var chart = this,
hasZoomed,
pointer = chart.pointer,
displayButton = false,
resetZoomButton;
// If zoom is called with no arguments, reset the axes
if (!event || event.resetSelection) {
each(chart.axes, function (axis) {
hasZoomed = axis.zoom();
});
} else { // else, zoom in on all axes
each(event.xAxis.concat(event.yAxis), function (axisData) {
var axis = axisData.axis,
isXAxis = axis.isXAxis;
// don't zoom more than minRange
if (pointer[isXAxis ? 'zoomX' : 'zoomY'] || pointer[isXAxis ? 'pinchX' : 'pinchY']) {
hasZoomed = axis.zoom(axisData.min, axisData.max);
if (axis.displayBtn) {
displayButton = true;
}
}
});
}
// Show or hide the Reset zoom button
resetZoomButton = chart.resetZoomButton;
if (displayButton && !resetZoomButton) {
chart.showResetZoom();
} else if (!displayButton && isObject(resetZoomButton)) {
chart.resetZoomButton = resetZoomButton.destroy();
}
// Redraw
if (hasZoomed) {
chart.redraw(
pick(chart.options.chart.animation, event && event.animation, chart.pointCount < 100) // animation
);
}
} | javascript | function (event) {
var chart = this,
hasZoomed,
pointer = chart.pointer,
displayButton = false,
resetZoomButton;
// If zoom is called with no arguments, reset the axes
if (!event || event.resetSelection) {
each(chart.axes, function (axis) {
hasZoomed = axis.zoom();
});
} else { // else, zoom in on all axes
each(event.xAxis.concat(event.yAxis), function (axisData) {
var axis = axisData.axis,
isXAxis = axis.isXAxis;
// don't zoom more than minRange
if (pointer[isXAxis ? 'zoomX' : 'zoomY'] || pointer[isXAxis ? 'pinchX' : 'pinchY']) {
hasZoomed = axis.zoom(axisData.min, axisData.max);
if (axis.displayBtn) {
displayButton = true;
}
}
});
}
// Show or hide the Reset zoom button
resetZoomButton = chart.resetZoomButton;
if (displayButton && !resetZoomButton) {
chart.showResetZoom();
} else if (!displayButton && isObject(resetZoomButton)) {
chart.resetZoomButton = resetZoomButton.destroy();
}
// Redraw
if (hasZoomed) {
chart.redraw(
pick(chart.options.chart.animation, event && event.animation, chart.pointCount < 100) // animation
);
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"hasZoomed",
",",
"pointer",
"=",
"chart",
".",
"pointer",
",",
"displayButton",
"=",
"false",
",",
"resetZoomButton",
";",
"// If zoom is called with no arguments, reset the axes",
"if",
"(",
"!",
"event",
"||",
"event",
".",
"resetSelection",
")",
"{",
"each",
"(",
"chart",
".",
"axes",
",",
"function",
"(",
"axis",
")",
"{",
"hasZoomed",
"=",
"axis",
".",
"zoom",
"(",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"// else, zoom in on all axes",
"each",
"(",
"event",
".",
"xAxis",
".",
"concat",
"(",
"event",
".",
"yAxis",
")",
",",
"function",
"(",
"axisData",
")",
"{",
"var",
"axis",
"=",
"axisData",
".",
"axis",
",",
"isXAxis",
"=",
"axis",
".",
"isXAxis",
";",
"// don't zoom more than minRange",
"if",
"(",
"pointer",
"[",
"isXAxis",
"?",
"'zoomX'",
":",
"'zoomY'",
"]",
"||",
"pointer",
"[",
"isXAxis",
"?",
"'pinchX'",
":",
"'pinchY'",
"]",
")",
"{",
"hasZoomed",
"=",
"axis",
".",
"zoom",
"(",
"axisData",
".",
"min",
",",
"axisData",
".",
"max",
")",
";",
"if",
"(",
"axis",
".",
"displayBtn",
")",
"{",
"displayButton",
"=",
"true",
";",
"}",
"}",
"}",
")",
";",
"}",
"// Show or hide the Reset zoom button",
"resetZoomButton",
"=",
"chart",
".",
"resetZoomButton",
";",
"if",
"(",
"displayButton",
"&&",
"!",
"resetZoomButton",
")",
"{",
"chart",
".",
"showResetZoom",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"displayButton",
"&&",
"isObject",
"(",
"resetZoomButton",
")",
")",
"{",
"chart",
".",
"resetZoomButton",
"=",
"resetZoomButton",
".",
"destroy",
"(",
")",
";",
"}",
"// Redraw",
"if",
"(",
"hasZoomed",
")",
"{",
"chart",
".",
"redraw",
"(",
"pick",
"(",
"chart",
".",
"options",
".",
"chart",
".",
"animation",
",",
"event",
"&&",
"event",
".",
"animation",
",",
"chart",
".",
"pointCount",
"<",
"100",
")",
"// animation",
")",
";",
"}",
"}"
] | Zoom into a given portion of the chart given by axis coordinates
@param {Object} event | [
"Zoom",
"into",
"a",
"given",
"portion",
"of",
"the",
"chart",
"given",
"by",
"axis",
"coordinates"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11099-L11141 | |
23,508 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (e, panning) {
var chart = this,
hoverPoints = chart.hoverPoints,
doRedraw;
// remove active points for shared tooltip
if (hoverPoints) {
each(hoverPoints, function (point) {
point.setState();
});
}
each(panning === 'xy' ? [1, 0] : [1], function (isX) { // xy is used in maps
var mousePos = e[isX ? 'chartX' : 'chartY'],
axis = chart[isX ? 'xAxis' : 'yAxis'][0],
startPos = chart[isX ? 'mouseDownX' : 'mouseDownY'],
halfPointRange = (axis.pointRange || 0) / 2,
extremes = axis.getExtremes(),
newMin = axis.toValue(startPos - mousePos, true) + halfPointRange,
newMax = axis.toValue(startPos + chart[isX ? 'plotWidth' : 'plotHeight'] - mousePos, true) - halfPointRange;
if (axis.series.length && newMin > mathMin(extremes.dataMin, extremes.min) && newMax < mathMax(extremes.dataMax, extremes.max)) {
axis.setExtremes(newMin, newMax, false, false, { trigger: 'pan' });
doRedraw = true;
}
chart[isX ? 'mouseDownX' : 'mouseDownY'] = mousePos; // set new reference for next run
});
if (doRedraw) {
chart.redraw(false);
}
css(chart.container, { cursor: 'move' });
} | javascript | function (e, panning) {
var chart = this,
hoverPoints = chart.hoverPoints,
doRedraw;
// remove active points for shared tooltip
if (hoverPoints) {
each(hoverPoints, function (point) {
point.setState();
});
}
each(panning === 'xy' ? [1, 0] : [1], function (isX) { // xy is used in maps
var mousePos = e[isX ? 'chartX' : 'chartY'],
axis = chart[isX ? 'xAxis' : 'yAxis'][0],
startPos = chart[isX ? 'mouseDownX' : 'mouseDownY'],
halfPointRange = (axis.pointRange || 0) / 2,
extremes = axis.getExtremes(),
newMin = axis.toValue(startPos - mousePos, true) + halfPointRange,
newMax = axis.toValue(startPos + chart[isX ? 'plotWidth' : 'plotHeight'] - mousePos, true) - halfPointRange;
if (axis.series.length && newMin > mathMin(extremes.dataMin, extremes.min) && newMax < mathMax(extremes.dataMax, extremes.max)) {
axis.setExtremes(newMin, newMax, false, false, { trigger: 'pan' });
doRedraw = true;
}
chart[isX ? 'mouseDownX' : 'mouseDownY'] = mousePos; // set new reference for next run
});
if (doRedraw) {
chart.redraw(false);
}
css(chart.container, { cursor: 'move' });
} | [
"function",
"(",
"e",
",",
"panning",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"hoverPoints",
"=",
"chart",
".",
"hoverPoints",
",",
"doRedraw",
";",
"// remove active points for shared tooltip",
"if",
"(",
"hoverPoints",
")",
"{",
"each",
"(",
"hoverPoints",
",",
"function",
"(",
"point",
")",
"{",
"point",
".",
"setState",
"(",
")",
";",
"}",
")",
";",
"}",
"each",
"(",
"panning",
"===",
"'xy'",
"?",
"[",
"1",
",",
"0",
"]",
":",
"[",
"1",
"]",
",",
"function",
"(",
"isX",
")",
"{",
"// xy is used in maps",
"var",
"mousePos",
"=",
"e",
"[",
"isX",
"?",
"'chartX'",
":",
"'chartY'",
"]",
",",
"axis",
"=",
"chart",
"[",
"isX",
"?",
"'xAxis'",
":",
"'yAxis'",
"]",
"[",
"0",
"]",
",",
"startPos",
"=",
"chart",
"[",
"isX",
"?",
"'mouseDownX'",
":",
"'mouseDownY'",
"]",
",",
"halfPointRange",
"=",
"(",
"axis",
".",
"pointRange",
"||",
"0",
")",
"/",
"2",
",",
"extremes",
"=",
"axis",
".",
"getExtremes",
"(",
")",
",",
"newMin",
"=",
"axis",
".",
"toValue",
"(",
"startPos",
"-",
"mousePos",
",",
"true",
")",
"+",
"halfPointRange",
",",
"newMax",
"=",
"axis",
".",
"toValue",
"(",
"startPos",
"+",
"chart",
"[",
"isX",
"?",
"'plotWidth'",
":",
"'plotHeight'",
"]",
"-",
"mousePos",
",",
"true",
")",
"-",
"halfPointRange",
";",
"if",
"(",
"axis",
".",
"series",
".",
"length",
"&&",
"newMin",
">",
"mathMin",
"(",
"extremes",
".",
"dataMin",
",",
"extremes",
".",
"min",
")",
"&&",
"newMax",
"<",
"mathMax",
"(",
"extremes",
".",
"dataMax",
",",
"extremes",
".",
"max",
")",
")",
"{",
"axis",
".",
"setExtremes",
"(",
"newMin",
",",
"newMax",
",",
"false",
",",
"false",
",",
"{",
"trigger",
":",
"'pan'",
"}",
")",
";",
"doRedraw",
"=",
"true",
";",
"}",
"chart",
"[",
"isX",
"?",
"'mouseDownX'",
":",
"'mouseDownY'",
"]",
"=",
"mousePos",
";",
"// set new reference for next run",
"}",
")",
";",
"if",
"(",
"doRedraw",
")",
"{",
"chart",
".",
"redraw",
"(",
"false",
")",
";",
"}",
"css",
"(",
"chart",
".",
"container",
",",
"{",
"cursor",
":",
"'move'",
"}",
")",
";",
"}"
] | Pan the chart by dragging the mouse across the pane. This function is called
on mouse move, and the distance to pan is computed from chartX compared to
the first chartX position in the dragging operation. | [
"Pan",
"the",
"chart",
"by",
"dragging",
"the",
"mouse",
"across",
"the",
"pane",
".",
"This",
"function",
"is",
"called",
"on",
"mouse",
"move",
"and",
"the",
"distance",
"to",
"pan",
"is",
"computed",
"from",
"chartX",
"compared",
"to",
"the",
"first",
"chartX",
"position",
"in",
"the",
"dragging",
"operation",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11148-L11182 | |
23,509 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (revert) {
var clone = this.renderToClone,
container = this.container;
// Destroy the clone and bring the container back to the real renderTo div
if (revert) {
if (clone) {
this.renderTo.appendChild(container);
discardElement(clone);
delete this.renderToClone;
}
// Set up the clone
} else {
if (container && container.parentNode === this.renderTo) {
this.renderTo.removeChild(container); // do not clone this
}
this.renderToClone = clone = this.renderTo.cloneNode(0);
css(clone, {
position: ABSOLUTE,
top: '-9999px',
display: 'block' // #833
});
doc.body.appendChild(clone);
if (container) {
clone.appendChild(container);
}
}
} | javascript | function (revert) {
var clone = this.renderToClone,
container = this.container;
// Destroy the clone and bring the container back to the real renderTo div
if (revert) {
if (clone) {
this.renderTo.appendChild(container);
discardElement(clone);
delete this.renderToClone;
}
// Set up the clone
} else {
if (container && container.parentNode === this.renderTo) {
this.renderTo.removeChild(container); // do not clone this
}
this.renderToClone = clone = this.renderTo.cloneNode(0);
css(clone, {
position: ABSOLUTE,
top: '-9999px',
display: 'block' // #833
});
doc.body.appendChild(clone);
if (container) {
clone.appendChild(container);
}
}
} | [
"function",
"(",
"revert",
")",
"{",
"var",
"clone",
"=",
"this",
".",
"renderToClone",
",",
"container",
"=",
"this",
".",
"container",
";",
"// Destroy the clone and bring the container back to the real renderTo div",
"if",
"(",
"revert",
")",
"{",
"if",
"(",
"clone",
")",
"{",
"this",
".",
"renderTo",
".",
"appendChild",
"(",
"container",
")",
";",
"discardElement",
"(",
"clone",
")",
";",
"delete",
"this",
".",
"renderToClone",
";",
"}",
"// Set up the clone",
"}",
"else",
"{",
"if",
"(",
"container",
"&&",
"container",
".",
"parentNode",
"===",
"this",
".",
"renderTo",
")",
"{",
"this",
".",
"renderTo",
".",
"removeChild",
"(",
"container",
")",
";",
"// do not clone this",
"}",
"this",
".",
"renderToClone",
"=",
"clone",
"=",
"this",
".",
"renderTo",
".",
"cloneNode",
"(",
"0",
")",
";",
"css",
"(",
"clone",
",",
"{",
"position",
":",
"ABSOLUTE",
",",
"top",
":",
"'-9999px'",
",",
"display",
":",
"'block'",
"// #833",
"}",
")",
";",
"doc",
".",
"body",
".",
"appendChild",
"(",
"clone",
")",
";",
"if",
"(",
"container",
")",
"{",
"clone",
".",
"appendChild",
"(",
"container",
")",
";",
"}",
"}",
"}"
] | Create a clone of the chart's renderTo div and place it outside the viewport to allow
size computation on chart.render and chart.redraw | [
"Create",
"a",
"clone",
"of",
"the",
"chart",
"s",
"renderTo",
"div",
"and",
"place",
"it",
"outside",
"the",
"viewport",
"to",
"allow",
"size",
"computation",
"on",
"chart",
".",
"render",
"and",
"chart",
".",
"redraw"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11294-L11322 | |
23,510 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
spacing = chart.spacing,
axisOffset,
legend = chart.legend,
margin = chart.margin,
legendOptions = chart.options.legend,
legendMargin = pick(legendOptions.margin, 10),
legendX = legendOptions.x,
legendY = legendOptions.y,
align = legendOptions.align,
verticalAlign = legendOptions.verticalAlign,
titleOffset = chart.titleOffset;
chart.resetMargins();
axisOffset = chart.axisOffset;
// Adjust for title and subtitle
if (titleOffset && !defined(margin[0])) {
chart.plotTop = mathMax(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]);
}
// Adjust for legend
if (legend.display && !legendOptions.floating) {
if (align === 'right') { // horizontal alignment handled first
if (!defined(margin[1])) {
chart.marginRight = mathMax(
chart.marginRight,
legend.legendWidth - legendX + legendMargin + spacing[1]
);
}
} else if (align === 'left') {
if (!defined(margin[3])) {
chart.plotLeft = mathMax(
chart.plotLeft,
legend.legendWidth + legendX + legendMargin + spacing[3]
);
}
} else if (verticalAlign === 'top') {
if (!defined(margin[0])) {
chart.plotTop = mathMax(
chart.plotTop,
legend.legendHeight + legendY + legendMargin + spacing[0]
);
}
} else if (verticalAlign === 'bottom') {
if (!defined(margin[2])) {
chart.marginBottom = mathMax(
chart.marginBottom,
legend.legendHeight - legendY + legendMargin + spacing[2]
);
}
}
}
// adjust for scroller
if (chart.extraBottomMargin) {
chart.marginBottom += chart.extraBottomMargin;
}
if (chart.extraTopMargin) {
chart.plotTop += chart.extraTopMargin;
}
// pre-render axes to get labels offset width
if (chart.hasCartesianSeries) {
each(chart.axes, function (axis) {
axis.getOffset();
});
}
if (!defined(margin[3])) {
chart.plotLeft += axisOffset[3];
}
if (!defined(margin[0])) {
chart.plotTop += axisOffset[0];
}
if (!defined(margin[2])) {
chart.marginBottom += axisOffset[2];
}
if (!defined(margin[1])) {
chart.marginRight += axisOffset[1];
}
chart.setChartSize();
} | javascript | function () {
var chart = this,
spacing = chart.spacing,
axisOffset,
legend = chart.legend,
margin = chart.margin,
legendOptions = chart.options.legend,
legendMargin = pick(legendOptions.margin, 10),
legendX = legendOptions.x,
legendY = legendOptions.y,
align = legendOptions.align,
verticalAlign = legendOptions.verticalAlign,
titleOffset = chart.titleOffset;
chart.resetMargins();
axisOffset = chart.axisOffset;
// Adjust for title and subtitle
if (titleOffset && !defined(margin[0])) {
chart.plotTop = mathMax(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]);
}
// Adjust for legend
if (legend.display && !legendOptions.floating) {
if (align === 'right') { // horizontal alignment handled first
if (!defined(margin[1])) {
chart.marginRight = mathMax(
chart.marginRight,
legend.legendWidth - legendX + legendMargin + spacing[1]
);
}
} else if (align === 'left') {
if (!defined(margin[3])) {
chart.plotLeft = mathMax(
chart.plotLeft,
legend.legendWidth + legendX + legendMargin + spacing[3]
);
}
} else if (verticalAlign === 'top') {
if (!defined(margin[0])) {
chart.plotTop = mathMax(
chart.plotTop,
legend.legendHeight + legendY + legendMargin + spacing[0]
);
}
} else if (verticalAlign === 'bottom') {
if (!defined(margin[2])) {
chart.marginBottom = mathMax(
chart.marginBottom,
legend.legendHeight - legendY + legendMargin + spacing[2]
);
}
}
}
// adjust for scroller
if (chart.extraBottomMargin) {
chart.marginBottom += chart.extraBottomMargin;
}
if (chart.extraTopMargin) {
chart.plotTop += chart.extraTopMargin;
}
// pre-render axes to get labels offset width
if (chart.hasCartesianSeries) {
each(chart.axes, function (axis) {
axis.getOffset();
});
}
if (!defined(margin[3])) {
chart.plotLeft += axisOffset[3];
}
if (!defined(margin[0])) {
chart.plotTop += axisOffset[0];
}
if (!defined(margin[2])) {
chart.marginBottom += axisOffset[2];
}
if (!defined(margin[1])) {
chart.marginRight += axisOffset[1];
}
chart.setChartSize();
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"spacing",
"=",
"chart",
".",
"spacing",
",",
"axisOffset",
",",
"legend",
"=",
"chart",
".",
"legend",
",",
"margin",
"=",
"chart",
".",
"margin",
",",
"legendOptions",
"=",
"chart",
".",
"options",
".",
"legend",
",",
"legendMargin",
"=",
"pick",
"(",
"legendOptions",
".",
"margin",
",",
"10",
")",
",",
"legendX",
"=",
"legendOptions",
".",
"x",
",",
"legendY",
"=",
"legendOptions",
".",
"y",
",",
"align",
"=",
"legendOptions",
".",
"align",
",",
"verticalAlign",
"=",
"legendOptions",
".",
"verticalAlign",
",",
"titleOffset",
"=",
"chart",
".",
"titleOffset",
";",
"chart",
".",
"resetMargins",
"(",
")",
";",
"axisOffset",
"=",
"chart",
".",
"axisOffset",
";",
"// Adjust for title and subtitle",
"if",
"(",
"titleOffset",
"&&",
"!",
"defined",
"(",
"margin",
"[",
"0",
"]",
")",
")",
"{",
"chart",
".",
"plotTop",
"=",
"mathMax",
"(",
"chart",
".",
"plotTop",
",",
"titleOffset",
"+",
"chart",
".",
"options",
".",
"title",
".",
"margin",
"+",
"spacing",
"[",
"0",
"]",
")",
";",
"}",
"// Adjust for legend",
"if",
"(",
"legend",
".",
"display",
"&&",
"!",
"legendOptions",
".",
"floating",
")",
"{",
"if",
"(",
"align",
"===",
"'right'",
")",
"{",
"// horizontal alignment handled first",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"1",
"]",
")",
")",
"{",
"chart",
".",
"marginRight",
"=",
"mathMax",
"(",
"chart",
".",
"marginRight",
",",
"legend",
".",
"legendWidth",
"-",
"legendX",
"+",
"legendMargin",
"+",
"spacing",
"[",
"1",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"align",
"===",
"'left'",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"3",
"]",
")",
")",
"{",
"chart",
".",
"plotLeft",
"=",
"mathMax",
"(",
"chart",
".",
"plotLeft",
",",
"legend",
".",
"legendWidth",
"+",
"legendX",
"+",
"legendMargin",
"+",
"spacing",
"[",
"3",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"verticalAlign",
"===",
"'top'",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"0",
"]",
")",
")",
"{",
"chart",
".",
"plotTop",
"=",
"mathMax",
"(",
"chart",
".",
"plotTop",
",",
"legend",
".",
"legendHeight",
"+",
"legendY",
"+",
"legendMargin",
"+",
"spacing",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"verticalAlign",
"===",
"'bottom'",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"2",
"]",
")",
")",
"{",
"chart",
".",
"marginBottom",
"=",
"mathMax",
"(",
"chart",
".",
"marginBottom",
",",
"legend",
".",
"legendHeight",
"-",
"legendY",
"+",
"legendMargin",
"+",
"spacing",
"[",
"2",
"]",
")",
";",
"}",
"}",
"}",
"// adjust for scroller",
"if",
"(",
"chart",
".",
"extraBottomMargin",
")",
"{",
"chart",
".",
"marginBottom",
"+=",
"chart",
".",
"extraBottomMargin",
";",
"}",
"if",
"(",
"chart",
".",
"extraTopMargin",
")",
"{",
"chart",
".",
"plotTop",
"+=",
"chart",
".",
"extraTopMargin",
";",
"}",
"// pre-render axes to get labels offset width",
"if",
"(",
"chart",
".",
"hasCartesianSeries",
")",
"{",
"each",
"(",
"chart",
".",
"axes",
",",
"function",
"(",
"axis",
")",
"{",
"axis",
".",
"getOffset",
"(",
")",
";",
"}",
")",
";",
"}",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"3",
"]",
")",
")",
"{",
"chart",
".",
"plotLeft",
"+=",
"axisOffset",
"[",
"3",
"]",
";",
"}",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"0",
"]",
")",
")",
"{",
"chart",
".",
"plotTop",
"+=",
"axisOffset",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"2",
"]",
")",
")",
"{",
"chart",
".",
"marginBottom",
"+=",
"axisOffset",
"[",
"2",
"]",
";",
"}",
"if",
"(",
"!",
"defined",
"(",
"margin",
"[",
"1",
"]",
")",
")",
"{",
"chart",
".",
"marginRight",
"+=",
"axisOffset",
"[",
"1",
"]",
";",
"}",
"chart",
".",
"setChartSize",
"(",
")",
";",
"}"
] | Calculate margins by rendering axis labels in a preliminary position. Title,
subtitle and legend have already been rendered at this stage, but will be
moved into their final positions | [
"Calculate",
"margins",
"by",
"rendering",
"axis",
"labels",
"in",
"a",
"preliminary",
"position",
".",
"Title",
"subtitle",
"and",
"legend",
"have",
"already",
"been",
"rendered",
"at",
"this",
"stage",
"but",
"will",
"be",
"moved",
"into",
"their",
"final",
"positions"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11415-L11502 | |
23,511 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (skipAxes) {
var chart = this,
inverted = chart.inverted,
renderer = chart.renderer,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
optionsChart = chart.options.chart,
spacing = chart.spacing,
clipOffset = chart.clipOffset,
clipX,
clipY,
plotLeft,
plotTop,
plotWidth,
plotHeight,
plotBorderWidth;
chart.plotLeft = plotLeft = mathRound(chart.plotLeft);
chart.plotTop = plotTop = mathRound(chart.plotTop);
chart.plotWidth = plotWidth = mathMax(0, mathRound(chartWidth - plotLeft - chart.marginRight));
chart.plotHeight = plotHeight = mathMax(0, mathRound(chartHeight - plotTop - chart.marginBottom));
chart.plotSizeX = inverted ? plotHeight : plotWidth;
chart.plotSizeY = inverted ? plotWidth : plotHeight;
chart.plotBorderWidth = optionsChart.plotBorderWidth || 0;
// Set boxes used for alignment
chart.spacingBox = renderer.spacingBox = {
x: spacing[3],
y: spacing[0],
width: chartWidth - spacing[3] - spacing[1],
height: chartHeight - spacing[0] - spacing[2]
};
chart.plotBox = renderer.plotBox = {
x: plotLeft,
y: plotTop,
width: plotWidth,
height: plotHeight
};
plotBorderWidth = 2 * mathFloor(chart.plotBorderWidth / 2);
clipX = mathCeil(mathMax(plotBorderWidth, clipOffset[3]) / 2);
clipY = mathCeil(mathMax(plotBorderWidth, clipOffset[0]) / 2);
chart.clipBox = {
x: clipX,
y: clipY,
width: mathFloor(chart.plotSizeX - mathMax(plotBorderWidth, clipOffset[1]) / 2 - clipX),
height: mathFloor(chart.plotSizeY - mathMax(plotBorderWidth, clipOffset[2]) / 2 - clipY)
};
if (!skipAxes) {
each(chart.axes, function (axis) {
axis.setAxisSize();
axis.setAxisTranslation();
});
}
} | javascript | function (skipAxes) {
var chart = this,
inverted = chart.inverted,
renderer = chart.renderer,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
optionsChart = chart.options.chart,
spacing = chart.spacing,
clipOffset = chart.clipOffset,
clipX,
clipY,
plotLeft,
plotTop,
plotWidth,
plotHeight,
plotBorderWidth;
chart.plotLeft = plotLeft = mathRound(chart.plotLeft);
chart.plotTop = plotTop = mathRound(chart.plotTop);
chart.plotWidth = plotWidth = mathMax(0, mathRound(chartWidth - plotLeft - chart.marginRight));
chart.plotHeight = plotHeight = mathMax(0, mathRound(chartHeight - plotTop - chart.marginBottom));
chart.plotSizeX = inverted ? plotHeight : plotWidth;
chart.plotSizeY = inverted ? plotWidth : plotHeight;
chart.plotBorderWidth = optionsChart.plotBorderWidth || 0;
// Set boxes used for alignment
chart.spacingBox = renderer.spacingBox = {
x: spacing[3],
y: spacing[0],
width: chartWidth - spacing[3] - spacing[1],
height: chartHeight - spacing[0] - spacing[2]
};
chart.plotBox = renderer.plotBox = {
x: plotLeft,
y: plotTop,
width: plotWidth,
height: plotHeight
};
plotBorderWidth = 2 * mathFloor(chart.plotBorderWidth / 2);
clipX = mathCeil(mathMax(plotBorderWidth, clipOffset[3]) / 2);
clipY = mathCeil(mathMax(plotBorderWidth, clipOffset[0]) / 2);
chart.clipBox = {
x: clipX,
y: clipY,
width: mathFloor(chart.plotSizeX - mathMax(plotBorderWidth, clipOffset[1]) / 2 - clipX),
height: mathFloor(chart.plotSizeY - mathMax(plotBorderWidth, clipOffset[2]) / 2 - clipY)
};
if (!skipAxes) {
each(chart.axes, function (axis) {
axis.setAxisSize();
axis.setAxisTranslation();
});
}
} | [
"function",
"(",
"skipAxes",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"inverted",
"=",
"chart",
".",
"inverted",
",",
"renderer",
"=",
"chart",
".",
"renderer",
",",
"chartWidth",
"=",
"chart",
".",
"chartWidth",
",",
"chartHeight",
"=",
"chart",
".",
"chartHeight",
",",
"optionsChart",
"=",
"chart",
".",
"options",
".",
"chart",
",",
"spacing",
"=",
"chart",
".",
"spacing",
",",
"clipOffset",
"=",
"chart",
".",
"clipOffset",
",",
"clipX",
",",
"clipY",
",",
"plotLeft",
",",
"plotTop",
",",
"plotWidth",
",",
"plotHeight",
",",
"plotBorderWidth",
";",
"chart",
".",
"plotLeft",
"=",
"plotLeft",
"=",
"mathRound",
"(",
"chart",
".",
"plotLeft",
")",
";",
"chart",
".",
"plotTop",
"=",
"plotTop",
"=",
"mathRound",
"(",
"chart",
".",
"plotTop",
")",
";",
"chart",
".",
"plotWidth",
"=",
"plotWidth",
"=",
"mathMax",
"(",
"0",
",",
"mathRound",
"(",
"chartWidth",
"-",
"plotLeft",
"-",
"chart",
".",
"marginRight",
")",
")",
";",
"chart",
".",
"plotHeight",
"=",
"plotHeight",
"=",
"mathMax",
"(",
"0",
",",
"mathRound",
"(",
"chartHeight",
"-",
"plotTop",
"-",
"chart",
".",
"marginBottom",
")",
")",
";",
"chart",
".",
"plotSizeX",
"=",
"inverted",
"?",
"plotHeight",
":",
"plotWidth",
";",
"chart",
".",
"plotSizeY",
"=",
"inverted",
"?",
"plotWidth",
":",
"plotHeight",
";",
"chart",
".",
"plotBorderWidth",
"=",
"optionsChart",
".",
"plotBorderWidth",
"||",
"0",
";",
"// Set boxes used for alignment",
"chart",
".",
"spacingBox",
"=",
"renderer",
".",
"spacingBox",
"=",
"{",
"x",
":",
"spacing",
"[",
"3",
"]",
",",
"y",
":",
"spacing",
"[",
"0",
"]",
",",
"width",
":",
"chartWidth",
"-",
"spacing",
"[",
"3",
"]",
"-",
"spacing",
"[",
"1",
"]",
",",
"height",
":",
"chartHeight",
"-",
"spacing",
"[",
"0",
"]",
"-",
"spacing",
"[",
"2",
"]",
"}",
";",
"chart",
".",
"plotBox",
"=",
"renderer",
".",
"plotBox",
"=",
"{",
"x",
":",
"plotLeft",
",",
"y",
":",
"plotTop",
",",
"width",
":",
"plotWidth",
",",
"height",
":",
"plotHeight",
"}",
";",
"plotBorderWidth",
"=",
"2",
"*",
"mathFloor",
"(",
"chart",
".",
"plotBorderWidth",
"/",
"2",
")",
";",
"clipX",
"=",
"mathCeil",
"(",
"mathMax",
"(",
"plotBorderWidth",
",",
"clipOffset",
"[",
"3",
"]",
")",
"/",
"2",
")",
";",
"clipY",
"=",
"mathCeil",
"(",
"mathMax",
"(",
"plotBorderWidth",
",",
"clipOffset",
"[",
"0",
"]",
")",
"/",
"2",
")",
";",
"chart",
".",
"clipBox",
"=",
"{",
"x",
":",
"clipX",
",",
"y",
":",
"clipY",
",",
"width",
":",
"mathFloor",
"(",
"chart",
".",
"plotSizeX",
"-",
"mathMax",
"(",
"plotBorderWidth",
",",
"clipOffset",
"[",
"1",
"]",
")",
"/",
"2",
"-",
"clipX",
")",
",",
"height",
":",
"mathFloor",
"(",
"chart",
".",
"plotSizeY",
"-",
"mathMax",
"(",
"plotBorderWidth",
",",
"clipOffset",
"[",
"2",
"]",
")",
"/",
"2",
"-",
"clipY",
")",
"}",
";",
"if",
"(",
"!",
"skipAxes",
")",
"{",
"each",
"(",
"chart",
".",
"axes",
",",
"function",
"(",
"axis",
")",
"{",
"axis",
".",
"setAxisSize",
"(",
")",
";",
"axis",
".",
"setAxisTranslation",
"(",
")",
";",
"}",
")",
";",
"}",
"}"
] | Set the public chart properties. This is done before and after the pre-render
to determine margin sizes | [
"Set",
"the",
"public",
"chart",
"properties",
".",
"This",
"is",
"done",
"before",
"and",
"after",
"the",
"pre",
"-",
"render",
"to",
"determine",
"margin",
"sizes"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11621-L11678 | |
23,512 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
spacing = chart.spacing,
margin = chart.margin;
chart.plotTop = pick(margin[0], spacing[0]);
chart.marginRight = pick(margin[1], spacing[1]);
chart.marginBottom = pick(margin[2], spacing[2]);
chart.plotLeft = pick(margin[3], spacing[3]);
chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left
chart.clipOffset = [0, 0, 0, 0];
} | javascript | function () {
var chart = this,
spacing = chart.spacing,
margin = chart.margin;
chart.plotTop = pick(margin[0], spacing[0]);
chart.marginRight = pick(margin[1], spacing[1]);
chart.marginBottom = pick(margin[2], spacing[2]);
chart.plotLeft = pick(margin[3], spacing[3]);
chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left
chart.clipOffset = [0, 0, 0, 0];
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"spacing",
"=",
"chart",
".",
"spacing",
",",
"margin",
"=",
"chart",
".",
"margin",
";",
"chart",
".",
"plotTop",
"=",
"pick",
"(",
"margin",
"[",
"0",
"]",
",",
"spacing",
"[",
"0",
"]",
")",
";",
"chart",
".",
"marginRight",
"=",
"pick",
"(",
"margin",
"[",
"1",
"]",
",",
"spacing",
"[",
"1",
"]",
")",
";",
"chart",
".",
"marginBottom",
"=",
"pick",
"(",
"margin",
"[",
"2",
"]",
",",
"spacing",
"[",
"2",
"]",
")",
";",
"chart",
".",
"plotLeft",
"=",
"pick",
"(",
"margin",
"[",
"3",
"]",
",",
"spacing",
"[",
"3",
"]",
")",
";",
"chart",
".",
"axisOffset",
"=",
"[",
"0",
",",
"0",
",",
"0",
",",
"0",
"]",
";",
"// top, right, bottom, left",
"chart",
".",
"clipOffset",
"=",
"[",
"0",
",",
"0",
",",
"0",
",",
"0",
"]",
";",
"}"
] | Initial margins before auto size margins are applied | [
"Initial",
"margins",
"before",
"auto",
"size",
"margins",
"are",
"applied"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11683-L11694 | |
23,513 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
optionsChart = chart.options.chart,
renderer = chart.renderer,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
chartBackground = chart.chartBackground,
plotBackground = chart.plotBackground,
plotBorder = chart.plotBorder,
plotBGImage = chart.plotBGImage,
chartBorderWidth = optionsChart.borderWidth || 0,
chartBackgroundColor = optionsChart.backgroundColor,
plotBackgroundColor = optionsChart.plotBackgroundColor,
plotBackgroundImage = optionsChart.plotBackgroundImage,
plotBorderWidth = optionsChart.plotBorderWidth || 0,
mgn,
bgAttr,
plotLeft = chart.plotLeft,
plotTop = chart.plotTop,
plotWidth = chart.plotWidth,
plotHeight = chart.plotHeight,
plotBox = chart.plotBox,
clipRect = chart.clipRect,
clipBox = chart.clipBox;
// Chart area
mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0);
if (chartBorderWidth || chartBackgroundColor) {
if (!chartBackground) {
bgAttr = {
fill: chartBackgroundColor || NONE
};
if (chartBorderWidth) { // #980
bgAttr.stroke = optionsChart.borderColor;
bgAttr['stroke-width'] = chartBorderWidth;
}
chart.chartBackground = renderer.rect(mgn / 2, mgn / 2, chartWidth - mgn, chartHeight - mgn,
optionsChart.borderRadius, chartBorderWidth)
.attr(bgAttr)
.add()
.shadow(optionsChart.shadow);
} else { // resize
chartBackground.animate(
chartBackground.crisp(null, null, null, chartWidth - mgn, chartHeight - mgn)
);
}
}
// Plot background
if (plotBackgroundColor) {
if (!plotBackground) {
chart.plotBackground = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0)
.attr({
fill: plotBackgroundColor
})
.add()
.shadow(optionsChart.plotShadow);
} else {
plotBackground.animate(plotBox);
}
}
if (plotBackgroundImage) {
if (!plotBGImage) {
chart.plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight)
.add();
} else {
plotBGImage.animate(plotBox);
}
}
// Plot clip
if (!clipRect) {
chart.clipRect = renderer.clipRect(clipBox);
} else {
clipRect.animate({
width: clipBox.width,
height: clipBox.height
});
}
// Plot area border
if (plotBorderWidth) {
if (!plotBorder) {
chart.plotBorder = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0, -plotBorderWidth)
.attr({
stroke: optionsChart.plotBorderColor,
'stroke-width': plotBorderWidth,
zIndex: 1
})
.add();
} else {
plotBorder.animate(
plotBorder.crisp(null, plotLeft, plotTop, plotWidth, plotHeight)
);
}
}
// reset
chart.isDirtyBox = false;
} | javascript | function () {
var chart = this,
optionsChart = chart.options.chart,
renderer = chart.renderer,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
chartBackground = chart.chartBackground,
plotBackground = chart.plotBackground,
plotBorder = chart.plotBorder,
plotBGImage = chart.plotBGImage,
chartBorderWidth = optionsChart.borderWidth || 0,
chartBackgroundColor = optionsChart.backgroundColor,
plotBackgroundColor = optionsChart.plotBackgroundColor,
plotBackgroundImage = optionsChart.plotBackgroundImage,
plotBorderWidth = optionsChart.plotBorderWidth || 0,
mgn,
bgAttr,
plotLeft = chart.plotLeft,
plotTop = chart.plotTop,
plotWidth = chart.plotWidth,
plotHeight = chart.plotHeight,
plotBox = chart.plotBox,
clipRect = chart.clipRect,
clipBox = chart.clipBox;
// Chart area
mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0);
if (chartBorderWidth || chartBackgroundColor) {
if (!chartBackground) {
bgAttr = {
fill: chartBackgroundColor || NONE
};
if (chartBorderWidth) { // #980
bgAttr.stroke = optionsChart.borderColor;
bgAttr['stroke-width'] = chartBorderWidth;
}
chart.chartBackground = renderer.rect(mgn / 2, mgn / 2, chartWidth - mgn, chartHeight - mgn,
optionsChart.borderRadius, chartBorderWidth)
.attr(bgAttr)
.add()
.shadow(optionsChart.shadow);
} else { // resize
chartBackground.animate(
chartBackground.crisp(null, null, null, chartWidth - mgn, chartHeight - mgn)
);
}
}
// Plot background
if (plotBackgroundColor) {
if (!plotBackground) {
chart.plotBackground = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0)
.attr({
fill: plotBackgroundColor
})
.add()
.shadow(optionsChart.plotShadow);
} else {
plotBackground.animate(plotBox);
}
}
if (plotBackgroundImage) {
if (!plotBGImage) {
chart.plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight)
.add();
} else {
plotBGImage.animate(plotBox);
}
}
// Plot clip
if (!clipRect) {
chart.clipRect = renderer.clipRect(clipBox);
} else {
clipRect.animate({
width: clipBox.width,
height: clipBox.height
});
}
// Plot area border
if (plotBorderWidth) {
if (!plotBorder) {
chart.plotBorder = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0, -plotBorderWidth)
.attr({
stroke: optionsChart.plotBorderColor,
'stroke-width': plotBorderWidth,
zIndex: 1
})
.add();
} else {
plotBorder.animate(
plotBorder.crisp(null, plotLeft, plotTop, plotWidth, plotHeight)
);
}
}
// reset
chart.isDirtyBox = false;
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"optionsChart",
"=",
"chart",
".",
"options",
".",
"chart",
",",
"renderer",
"=",
"chart",
".",
"renderer",
",",
"chartWidth",
"=",
"chart",
".",
"chartWidth",
",",
"chartHeight",
"=",
"chart",
".",
"chartHeight",
",",
"chartBackground",
"=",
"chart",
".",
"chartBackground",
",",
"plotBackground",
"=",
"chart",
".",
"plotBackground",
",",
"plotBorder",
"=",
"chart",
".",
"plotBorder",
",",
"plotBGImage",
"=",
"chart",
".",
"plotBGImage",
",",
"chartBorderWidth",
"=",
"optionsChart",
".",
"borderWidth",
"||",
"0",
",",
"chartBackgroundColor",
"=",
"optionsChart",
".",
"backgroundColor",
",",
"plotBackgroundColor",
"=",
"optionsChart",
".",
"plotBackgroundColor",
",",
"plotBackgroundImage",
"=",
"optionsChart",
".",
"plotBackgroundImage",
",",
"plotBorderWidth",
"=",
"optionsChart",
".",
"plotBorderWidth",
"||",
"0",
",",
"mgn",
",",
"bgAttr",
",",
"plotLeft",
"=",
"chart",
".",
"plotLeft",
",",
"plotTop",
"=",
"chart",
".",
"plotTop",
",",
"plotWidth",
"=",
"chart",
".",
"plotWidth",
",",
"plotHeight",
"=",
"chart",
".",
"plotHeight",
",",
"plotBox",
"=",
"chart",
".",
"plotBox",
",",
"clipRect",
"=",
"chart",
".",
"clipRect",
",",
"clipBox",
"=",
"chart",
".",
"clipBox",
";",
"// Chart area",
"mgn",
"=",
"chartBorderWidth",
"+",
"(",
"optionsChart",
".",
"shadow",
"?",
"8",
":",
"0",
")",
";",
"if",
"(",
"chartBorderWidth",
"||",
"chartBackgroundColor",
")",
"{",
"if",
"(",
"!",
"chartBackground",
")",
"{",
"bgAttr",
"=",
"{",
"fill",
":",
"chartBackgroundColor",
"||",
"NONE",
"}",
";",
"if",
"(",
"chartBorderWidth",
")",
"{",
"// #980",
"bgAttr",
".",
"stroke",
"=",
"optionsChart",
".",
"borderColor",
";",
"bgAttr",
"[",
"'stroke-width'",
"]",
"=",
"chartBorderWidth",
";",
"}",
"chart",
".",
"chartBackground",
"=",
"renderer",
".",
"rect",
"(",
"mgn",
"/",
"2",
",",
"mgn",
"/",
"2",
",",
"chartWidth",
"-",
"mgn",
",",
"chartHeight",
"-",
"mgn",
",",
"optionsChart",
".",
"borderRadius",
",",
"chartBorderWidth",
")",
".",
"attr",
"(",
"bgAttr",
")",
".",
"add",
"(",
")",
".",
"shadow",
"(",
"optionsChart",
".",
"shadow",
")",
";",
"}",
"else",
"{",
"// resize",
"chartBackground",
".",
"animate",
"(",
"chartBackground",
".",
"crisp",
"(",
"null",
",",
"null",
",",
"null",
",",
"chartWidth",
"-",
"mgn",
",",
"chartHeight",
"-",
"mgn",
")",
")",
";",
"}",
"}",
"// Plot background",
"if",
"(",
"plotBackgroundColor",
")",
"{",
"if",
"(",
"!",
"plotBackground",
")",
"{",
"chart",
".",
"plotBackground",
"=",
"renderer",
".",
"rect",
"(",
"plotLeft",
",",
"plotTop",
",",
"plotWidth",
",",
"plotHeight",
",",
"0",
")",
".",
"attr",
"(",
"{",
"fill",
":",
"plotBackgroundColor",
"}",
")",
".",
"add",
"(",
")",
".",
"shadow",
"(",
"optionsChart",
".",
"plotShadow",
")",
";",
"}",
"else",
"{",
"plotBackground",
".",
"animate",
"(",
"plotBox",
")",
";",
"}",
"}",
"if",
"(",
"plotBackgroundImage",
")",
"{",
"if",
"(",
"!",
"plotBGImage",
")",
"{",
"chart",
".",
"plotBGImage",
"=",
"renderer",
".",
"image",
"(",
"plotBackgroundImage",
",",
"plotLeft",
",",
"plotTop",
",",
"plotWidth",
",",
"plotHeight",
")",
".",
"add",
"(",
")",
";",
"}",
"else",
"{",
"plotBGImage",
".",
"animate",
"(",
"plotBox",
")",
";",
"}",
"}",
"// Plot clip",
"if",
"(",
"!",
"clipRect",
")",
"{",
"chart",
".",
"clipRect",
"=",
"renderer",
".",
"clipRect",
"(",
"clipBox",
")",
";",
"}",
"else",
"{",
"clipRect",
".",
"animate",
"(",
"{",
"width",
":",
"clipBox",
".",
"width",
",",
"height",
":",
"clipBox",
".",
"height",
"}",
")",
";",
"}",
"// Plot area border",
"if",
"(",
"plotBorderWidth",
")",
"{",
"if",
"(",
"!",
"plotBorder",
")",
"{",
"chart",
".",
"plotBorder",
"=",
"renderer",
".",
"rect",
"(",
"plotLeft",
",",
"plotTop",
",",
"plotWidth",
",",
"plotHeight",
",",
"0",
",",
"-",
"plotBorderWidth",
")",
".",
"attr",
"(",
"{",
"stroke",
":",
"optionsChart",
".",
"plotBorderColor",
",",
"'stroke-width'",
":",
"plotBorderWidth",
",",
"zIndex",
":",
"1",
"}",
")",
".",
"add",
"(",
")",
";",
"}",
"else",
"{",
"plotBorder",
".",
"animate",
"(",
"plotBorder",
".",
"crisp",
"(",
"null",
",",
"plotLeft",
",",
"plotTop",
",",
"plotWidth",
",",
"plotHeight",
")",
")",
";",
"}",
"}",
"// reset",
"chart",
".",
"isDirtyBox",
"=",
"false",
";",
"}"
] | Draw the borders and backgrounds for chart and plot area | [
"Draw",
"the",
"borders",
"and",
"backgrounds",
"for",
"chart",
"and",
"plot",
"area"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11699-L11802 | |
23,514 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
optionsChart = chart.options.chart,
klass,
seriesOptions = chart.options.series,
i,
value;
each(['inverted', 'angular', 'polar'], function (key) {
// The default series type's class
klass = seriesTypes[optionsChart.type || optionsChart.defaultSeriesType];
// Get the value from available chart-wide properties
value = (
chart[key] || // 1. it is set before
optionsChart[key] || // 2. it is set in the options
(klass && klass.prototype[key]) // 3. it's default series class requires it
);
// 4. Check if any the chart's series require it
i = seriesOptions && seriesOptions.length;
while (!value && i--) {
klass = seriesTypes[seriesOptions[i].type];
if (klass && klass.prototype[key]) {
value = true;
}
}
// Set the chart property
chart[key] = value;
});
} | javascript | function () {
var chart = this,
optionsChart = chart.options.chart,
klass,
seriesOptions = chart.options.series,
i,
value;
each(['inverted', 'angular', 'polar'], function (key) {
// The default series type's class
klass = seriesTypes[optionsChart.type || optionsChart.defaultSeriesType];
// Get the value from available chart-wide properties
value = (
chart[key] || // 1. it is set before
optionsChart[key] || // 2. it is set in the options
(klass && klass.prototype[key]) // 3. it's default series class requires it
);
// 4. Check if any the chart's series require it
i = seriesOptions && seriesOptions.length;
while (!value && i--) {
klass = seriesTypes[seriesOptions[i].type];
if (klass && klass.prototype[key]) {
value = true;
}
}
// Set the chart property
chart[key] = value;
});
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"optionsChart",
"=",
"chart",
".",
"options",
".",
"chart",
",",
"klass",
",",
"seriesOptions",
"=",
"chart",
".",
"options",
".",
"series",
",",
"i",
",",
"value",
";",
"each",
"(",
"[",
"'inverted'",
",",
"'angular'",
",",
"'polar'",
"]",
",",
"function",
"(",
"key",
")",
"{",
"// The default series type's class",
"klass",
"=",
"seriesTypes",
"[",
"optionsChart",
".",
"type",
"||",
"optionsChart",
".",
"defaultSeriesType",
"]",
";",
"// Get the value from available chart-wide properties",
"value",
"=",
"(",
"chart",
"[",
"key",
"]",
"||",
"// 1. it is set before",
"optionsChart",
"[",
"key",
"]",
"||",
"// 2. it is set in the options",
"(",
"klass",
"&&",
"klass",
".",
"prototype",
"[",
"key",
"]",
")",
"// 3. it's default series class requires it",
")",
";",
"// 4. Check if any the chart's series require it",
"i",
"=",
"seriesOptions",
"&&",
"seriesOptions",
".",
"length",
";",
"while",
"(",
"!",
"value",
"&&",
"i",
"--",
")",
"{",
"klass",
"=",
"seriesTypes",
"[",
"seriesOptions",
"[",
"i",
"]",
".",
"type",
"]",
";",
"if",
"(",
"klass",
"&&",
"klass",
".",
"prototype",
"[",
"key",
"]",
")",
"{",
"value",
"=",
"true",
";",
"}",
"}",
"// Set the chart property",
"chart",
"[",
"key",
"]",
"=",
"value",
";",
"}",
")",
";",
"}"
] | Detect whether a certain chart property is needed based on inspecting its options
and series. This mainly applies to the chart.invert property, and in extensions to
the chart.angular and chart.polar properties. | [
"Detect",
"whether",
"a",
"certain",
"chart",
"property",
"is",
"needed",
"based",
"on",
"inspecting",
"its",
"options",
"and",
"series",
".",
"This",
"mainly",
"applies",
"to",
"the",
"chart",
".",
"invert",
"property",
"and",
"in",
"extensions",
"to",
"the",
"chart",
".",
"angular",
"and",
"chart",
".",
"polar",
"properties",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11809-L11843 | |
23,515 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this,
chartSeries = chart.series;
// Reset links
each(chartSeries, function (series) {
series.linkedSeries.length = 0;
});
// Apply new links
each(chartSeries, function (series) {
var linkedTo = series.options.linkedTo;
if (isString(linkedTo)) {
if (linkedTo === ':previous') {
linkedTo = chart.series[series.index - 1];
} else {
linkedTo = chart.get(linkedTo);
}
if (linkedTo) {
linkedTo.linkedSeries.push(series);
series.linkedParent = linkedTo;
}
}
});
} | javascript | function () {
var chart = this,
chartSeries = chart.series;
// Reset links
each(chartSeries, function (series) {
series.linkedSeries.length = 0;
});
// Apply new links
each(chartSeries, function (series) {
var linkedTo = series.options.linkedTo;
if (isString(linkedTo)) {
if (linkedTo === ':previous') {
linkedTo = chart.series[series.index - 1];
} else {
linkedTo = chart.get(linkedTo);
}
if (linkedTo) {
linkedTo.linkedSeries.push(series);
series.linkedParent = linkedTo;
}
}
});
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
",",
"chartSeries",
"=",
"chart",
".",
"series",
";",
"// Reset links",
"each",
"(",
"chartSeries",
",",
"function",
"(",
"series",
")",
"{",
"series",
".",
"linkedSeries",
".",
"length",
"=",
"0",
";",
"}",
")",
";",
"// Apply new links",
"each",
"(",
"chartSeries",
",",
"function",
"(",
"series",
")",
"{",
"var",
"linkedTo",
"=",
"series",
".",
"options",
".",
"linkedTo",
";",
"if",
"(",
"isString",
"(",
"linkedTo",
")",
")",
"{",
"if",
"(",
"linkedTo",
"===",
"':previous'",
")",
"{",
"linkedTo",
"=",
"chart",
".",
"series",
"[",
"series",
".",
"index",
"-",
"1",
"]",
";",
"}",
"else",
"{",
"linkedTo",
"=",
"chart",
".",
"get",
"(",
"linkedTo",
")",
";",
"}",
"if",
"(",
"linkedTo",
")",
"{",
"linkedTo",
".",
"linkedSeries",
".",
"push",
"(",
"series",
")",
";",
"series",
".",
"linkedParent",
"=",
"linkedTo",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Link two or more series together. This is done initially from Chart.render,
and after Chart.addSeries and Series.remove. | [
"Link",
"two",
"or",
"more",
"series",
"together",
".",
"This",
"is",
"done",
"initially",
"from",
"Chart",
".",
"render",
"and",
"after",
"Chart",
".",
"addSeries",
"and",
"Series",
".",
"remove",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L11849-L11873 | |
23,516 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var chart = this;
// Note: in spite of JSLint's complaints, win == win.top is required
/*jslint eqeq: true*/
if ((!hasSVG && (win == win.top && doc.readyState !== 'complete')) || (useCanVG && !win.canvg)) {
/*jslint eqeq: false*/
if (useCanVG) {
// Delay rendering until canvg library is downloaded and ready
CanVGController.push(function () { chart.firstRender(); }, chart.options.global.canvasToolsURL);
} else {
doc.attachEvent('onreadystatechange', function () {
doc.detachEvent('onreadystatechange', chart.firstRender);
if (doc.readyState === 'complete') {
chart.firstRender();
}
});
}
return false;
}
return true;
} | javascript | function () {
var chart = this;
// Note: in spite of JSLint's complaints, win == win.top is required
/*jslint eqeq: true*/
if ((!hasSVG && (win == win.top && doc.readyState !== 'complete')) || (useCanVG && !win.canvg)) {
/*jslint eqeq: false*/
if (useCanVG) {
// Delay rendering until canvg library is downloaded and ready
CanVGController.push(function () { chart.firstRender(); }, chart.options.global.canvasToolsURL);
} else {
doc.attachEvent('onreadystatechange', function () {
doc.detachEvent('onreadystatechange', chart.firstRender);
if (doc.readyState === 'complete') {
chart.firstRender();
}
});
}
return false;
}
return true;
} | [
"function",
"(",
")",
"{",
"var",
"chart",
"=",
"this",
";",
"// Note: in spite of JSLint's complaints, win == win.top is required",
"/*jslint eqeq: true*/",
"if",
"(",
"(",
"!",
"hasSVG",
"&&",
"(",
"win",
"==",
"win",
".",
"top",
"&&",
"doc",
".",
"readyState",
"!==",
"'complete'",
")",
")",
"||",
"(",
"useCanVG",
"&&",
"!",
"win",
".",
"canvg",
")",
")",
"{",
"/*jslint eqeq: false*/",
"if",
"(",
"useCanVG",
")",
"{",
"// Delay rendering until canvg library is downloaded and ready",
"CanVGController",
".",
"push",
"(",
"function",
"(",
")",
"{",
"chart",
".",
"firstRender",
"(",
")",
";",
"}",
",",
"chart",
".",
"options",
".",
"global",
".",
"canvasToolsURL",
")",
";",
"}",
"else",
"{",
"doc",
".",
"attachEvent",
"(",
"'onreadystatechange'",
",",
"function",
"(",
")",
"{",
"doc",
".",
"detachEvent",
"(",
"'onreadystatechange'",
",",
"chart",
".",
"firstRender",
")",
";",
"if",
"(",
"doc",
".",
"readyState",
"===",
"'complete'",
")",
"{",
"chart",
".",
"firstRender",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | VML namespaces can't be added until after complete. Listening
for Perini's doScroll hack is not enough. | [
"VML",
"namespaces",
"can",
"t",
"be",
"added",
"until",
"after",
"complete",
".",
"Listening",
"for",
"Perini",
"s",
"doScroll",
"hack",
"is",
"not",
"enough",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12054-L12075 | |
23,517 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (target, options) {
var oVar = options[target],
tArray = isObject(oVar) ? oVar : [oVar, oVar, oVar, oVar];
return [pick(options[target + 'Top'], tArray[0]),
pick(options[target + 'Right'], tArray[1]),
pick(options[target + 'Bottom'], tArray[2]),
pick(options[target + 'Left'], tArray[3])];
} | javascript | function (target, options) {
var oVar = options[target],
tArray = isObject(oVar) ? oVar : [oVar, oVar, oVar, oVar];
return [pick(options[target + 'Top'], tArray[0]),
pick(options[target + 'Right'], tArray[1]),
pick(options[target + 'Bottom'], tArray[2]),
pick(options[target + 'Left'], tArray[3])];
} | [
"function",
"(",
"target",
",",
"options",
")",
"{",
"var",
"oVar",
"=",
"options",
"[",
"target",
"]",
",",
"tArray",
"=",
"isObject",
"(",
"oVar",
")",
"?",
"oVar",
":",
"[",
"oVar",
",",
"oVar",
",",
"oVar",
",",
"oVar",
"]",
";",
"return",
"[",
"pick",
"(",
"options",
"[",
"target",
"+",
"'Top'",
"]",
",",
"tArray",
"[",
"0",
"]",
")",
",",
"pick",
"(",
"options",
"[",
"target",
"+",
"'Right'",
"]",
",",
"tArray",
"[",
"1",
"]",
")",
",",
"pick",
"(",
"options",
"[",
"target",
"+",
"'Bottom'",
"]",
",",
"tArray",
"[",
"2",
"]",
")",
",",
"pick",
"(",
"options",
"[",
"target",
"+",
"'Left'",
"]",
",",
"tArray",
"[",
"3",
"]",
")",
"]",
";",
"}"
] | Creates arrays for spacing and margin from given options. | [
"Creates",
"arrays",
"for",
"spacing",
"and",
"margin",
"from",
"given",
"options",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12144-L12152 | |
23,518 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (options) {
var ret,
series = this.series,
pointArrayMap = series.pointArrayMap || ['y'],
valueCount = pointArrayMap.length,
firstItemType,
i = 0,
j = 0;
if (typeof options === 'number' || options === null) {
ret = { y: options };
} else if (isArray(options)) {
ret = {};
// with leading x value
if (options.length > valueCount) {
firstItemType = typeof options[0];
if (firstItemType === 'string') {
ret.name = options[0];
} else if (firstItemType === 'number') {
ret.x = options[0];
}
i++;
}
while (j < valueCount) {
ret[pointArrayMap[j++]] = options[i++];
}
} else if (typeof options === 'object') {
ret = options;
// This is the fastest way to detect if there are individual point dataLabels that need
// to be considered in drawDataLabels. These can only occur in object configs.
if (options.dataLabels) {
series._hasPointLabels = true;
}
// Same approach as above for markers
if (options.marker) {
series._hasPointMarkers = true;
}
}
return ret;
} | javascript | function (options) {
var ret,
series = this.series,
pointArrayMap = series.pointArrayMap || ['y'],
valueCount = pointArrayMap.length,
firstItemType,
i = 0,
j = 0;
if (typeof options === 'number' || options === null) {
ret = { y: options };
} else if (isArray(options)) {
ret = {};
// with leading x value
if (options.length > valueCount) {
firstItemType = typeof options[0];
if (firstItemType === 'string') {
ret.name = options[0];
} else if (firstItemType === 'number') {
ret.x = options[0];
}
i++;
}
while (j < valueCount) {
ret[pointArrayMap[j++]] = options[i++];
}
} else if (typeof options === 'object') {
ret = options;
// This is the fastest way to detect if there are individual point dataLabels that need
// to be considered in drawDataLabels. These can only occur in object configs.
if (options.dataLabels) {
series._hasPointLabels = true;
}
// Same approach as above for markers
if (options.marker) {
series._hasPointMarkers = true;
}
}
return ret;
} | [
"function",
"(",
"options",
")",
"{",
"var",
"ret",
",",
"series",
"=",
"this",
".",
"series",
",",
"pointArrayMap",
"=",
"series",
".",
"pointArrayMap",
"||",
"[",
"'y'",
"]",
",",
"valueCount",
"=",
"pointArrayMap",
".",
"length",
",",
"firstItemType",
",",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"if",
"(",
"typeof",
"options",
"===",
"'number'",
"||",
"options",
"===",
"null",
")",
"{",
"ret",
"=",
"{",
"y",
":",
"options",
"}",
";",
"}",
"else",
"if",
"(",
"isArray",
"(",
"options",
")",
")",
"{",
"ret",
"=",
"{",
"}",
";",
"// with leading x value",
"if",
"(",
"options",
".",
"length",
">",
"valueCount",
")",
"{",
"firstItemType",
"=",
"typeof",
"options",
"[",
"0",
"]",
";",
"if",
"(",
"firstItemType",
"===",
"'string'",
")",
"{",
"ret",
".",
"name",
"=",
"options",
"[",
"0",
"]",
";",
"}",
"else",
"if",
"(",
"firstItemType",
"===",
"'number'",
")",
"{",
"ret",
".",
"x",
"=",
"options",
"[",
"0",
"]",
";",
"}",
"i",
"++",
";",
"}",
"while",
"(",
"j",
"<",
"valueCount",
")",
"{",
"ret",
"[",
"pointArrayMap",
"[",
"j",
"++",
"]",
"]",
"=",
"options",
"[",
"i",
"++",
"]",
";",
"}",
"}",
"else",
"if",
"(",
"typeof",
"options",
"===",
"'object'",
")",
"{",
"ret",
"=",
"options",
";",
"// This is the fastest way to detect if there are individual point dataLabels that need ",
"// to be considered in drawDataLabels. These can only occur in object configs.",
"if",
"(",
"options",
".",
"dataLabels",
")",
"{",
"series",
".",
"_hasPointLabels",
"=",
"true",
";",
"}",
"// Same approach as above for markers",
"if",
"(",
"options",
".",
"marker",
")",
"{",
"series",
".",
"_hasPointMarkers",
"=",
"true",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Transform number or array configs into objects | [
"Transform",
"number",
"or",
"array",
"configs",
"into",
"objects"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12222-L12264 | |
23,519 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var point = this,
props = ['graphic', 'dataLabel', 'dataLabelUpper', 'group', 'connector', 'shadowGroup'],
prop,
i = 6;
while (i--) {
prop = props[i];
if (point[prop]) {
point[prop] = point[prop].destroy();
}
}
} | javascript | function () {
var point = this,
props = ['graphic', 'dataLabel', 'dataLabelUpper', 'group', 'connector', 'shadowGroup'],
prop,
i = 6;
while (i--) {
prop = props[i];
if (point[prop]) {
point[prop] = point[prop].destroy();
}
}
} | [
"function",
"(",
")",
"{",
"var",
"point",
"=",
"this",
",",
"props",
"=",
"[",
"'graphic'",
",",
"'dataLabel'",
",",
"'dataLabelUpper'",
",",
"'group'",
",",
"'connector'",
",",
"'shadowGroup'",
"]",
",",
"prop",
",",
"i",
"=",
"6",
";",
"while",
"(",
"i",
"--",
")",
"{",
"prop",
"=",
"props",
"[",
"i",
"]",
";",
"if",
"(",
"point",
"[",
"prop",
"]",
")",
"{",
"point",
"[",
"prop",
"]",
"=",
"point",
"[",
"prop",
"]",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"}"
] | Destroy SVG elements associated with the point | [
"Destroy",
"SVG",
"elements",
"associated",
"with",
"the",
"point"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12310-L12321 | |
23,520 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var point = this;
return {
x: point.category,
y: point.y,
key: point.name || point.category,
series: point.series,
point: point,
percentage: point.percentage,
total: point.total || point.stackTotal
};
} | javascript | function () {
var point = this;
return {
x: point.category,
y: point.y,
key: point.name || point.category,
series: point.series,
point: point,
percentage: point.percentage,
total: point.total || point.stackTotal
};
} | [
"function",
"(",
")",
"{",
"var",
"point",
"=",
"this",
";",
"return",
"{",
"x",
":",
"point",
".",
"category",
",",
"y",
":",
"point",
".",
"y",
",",
"key",
":",
"point",
".",
"name",
"||",
"point",
".",
"category",
",",
"series",
":",
"point",
".",
"series",
",",
"point",
":",
"point",
",",
"percentage",
":",
"point",
".",
"percentage",
",",
"total",
":",
"point",
".",
"total",
"||",
"point",
".",
"stackTotal",
"}",
";",
"}"
] | Return the configuration hash needed for the data label and tooltip formatters | [
"Return",
"the",
"configuration",
"hash",
"needed",
"for",
"the",
"data",
"label",
"and",
"tooltip",
"formatters"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12326-L12337 | |
23,521 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (eventType, eventArgs, defaultFunction) {
var point = this,
series = this.series,
seriesOptions = series.options;
// load event handlers on demand to save time on mouseover/out
if (seriesOptions.point.events[eventType] || (point.options && point.options.events && point.options.events[eventType])) {
this.importEvents();
}
// add default handler if in selection mode
if (eventType === 'click' && seriesOptions.allowPointSelect) {
defaultFunction = function (event) {
// Control key is for Windows, meta (= Cmd key) for Mac, Shift for Opera
point.select(null, event.ctrlKey || event.metaKey || event.shiftKey);
};
}
fireEvent(this, eventType, eventArgs, defaultFunction);
} | javascript | function (eventType, eventArgs, defaultFunction) {
var point = this,
series = this.series,
seriesOptions = series.options;
// load event handlers on demand to save time on mouseover/out
if (seriesOptions.point.events[eventType] || (point.options && point.options.events && point.options.events[eventType])) {
this.importEvents();
}
// add default handler if in selection mode
if (eventType === 'click' && seriesOptions.allowPointSelect) {
defaultFunction = function (event) {
// Control key is for Windows, meta (= Cmd key) for Mac, Shift for Opera
point.select(null, event.ctrlKey || event.metaKey || event.shiftKey);
};
}
fireEvent(this, eventType, eventArgs, defaultFunction);
} | [
"function",
"(",
"eventType",
",",
"eventArgs",
",",
"defaultFunction",
")",
"{",
"var",
"point",
"=",
"this",
",",
"series",
"=",
"this",
".",
"series",
",",
"seriesOptions",
"=",
"series",
".",
"options",
";",
"// load event handlers on demand to save time on mouseover/out",
"if",
"(",
"seriesOptions",
".",
"point",
".",
"events",
"[",
"eventType",
"]",
"||",
"(",
"point",
".",
"options",
"&&",
"point",
".",
"options",
".",
"events",
"&&",
"point",
".",
"options",
".",
"events",
"[",
"eventType",
"]",
")",
")",
"{",
"this",
".",
"importEvents",
"(",
")",
";",
"}",
"// add default handler if in selection mode",
"if",
"(",
"eventType",
"===",
"'click'",
"&&",
"seriesOptions",
".",
"allowPointSelect",
")",
"{",
"defaultFunction",
"=",
"function",
"(",
"event",
")",
"{",
"// Control key is for Windows, meta (= Cmd key) for Mac, Shift for Opera",
"point",
".",
"select",
"(",
"null",
",",
"event",
".",
"ctrlKey",
"||",
"event",
".",
"metaKey",
"||",
"event",
".",
"shiftKey",
")",
";",
"}",
";",
"}",
"fireEvent",
"(",
"this",
",",
"eventType",
",",
"eventArgs",
",",
"defaultFunction",
")",
";",
"}"
] | Fire an event on the Point object. Must not be renamed to fireEvent, as this
causes a name clash in MooTools
@param {String} eventType
@param {Object} eventArgs Additional event arguments
@param {Function} defaultFunction Default event handler | [
"Fire",
"an",
"event",
"on",
"the",
"Point",
"object",
".",
"Must",
"not",
"be",
"renamed",
"to",
"fireEvent",
"as",
"this",
"causes",
"a",
"name",
"clash",
"in",
"MooTools"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12556-L12575 | |
23,522 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
lastNull = -1,
segments = [],
i,
points = series.points,
pointsLength = points.length;
if (pointsLength) { // no action required for []
// if connect nulls, just remove null points
if (series.options.connectNulls) {
i = pointsLength;
while (i--) {
if (points[i].y === null) {
points.splice(i, 1);
}
}
if (points.length) {
segments = [points];
}
// else, split on null points
} else {
each(points, function (point, i) {
if (point.y === null) {
if (i > lastNull + 1) {
segments.push(points.slice(lastNull + 1, i));
}
lastNull = i;
} else if (i === pointsLength - 1) { // last value
segments.push(points.slice(lastNull + 1, i + 1));
}
});
}
}
// register it
series.segments = segments;
} | javascript | function () {
var series = this,
lastNull = -1,
segments = [],
i,
points = series.points,
pointsLength = points.length;
if (pointsLength) { // no action required for []
// if connect nulls, just remove null points
if (series.options.connectNulls) {
i = pointsLength;
while (i--) {
if (points[i].y === null) {
points.splice(i, 1);
}
}
if (points.length) {
segments = [points];
}
// else, split on null points
} else {
each(points, function (point, i) {
if (point.y === null) {
if (i > lastNull + 1) {
segments.push(points.slice(lastNull + 1, i));
}
lastNull = i;
} else if (i === pointsLength - 1) { // last value
segments.push(points.slice(lastNull + 1, i + 1));
}
});
}
}
// register it
series.segments = segments;
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"lastNull",
"=",
"-",
"1",
",",
"segments",
"=",
"[",
"]",
",",
"i",
",",
"points",
"=",
"series",
".",
"points",
",",
"pointsLength",
"=",
"points",
".",
"length",
";",
"if",
"(",
"pointsLength",
")",
"{",
"// no action required for []",
"// if connect nulls, just remove null points",
"if",
"(",
"series",
".",
"options",
".",
"connectNulls",
")",
"{",
"i",
"=",
"pointsLength",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"points",
"[",
"i",
"]",
".",
"y",
"===",
"null",
")",
"{",
"points",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"}",
"}",
"if",
"(",
"points",
".",
"length",
")",
"{",
"segments",
"=",
"[",
"points",
"]",
";",
"}",
"// else, split on null points",
"}",
"else",
"{",
"each",
"(",
"points",
",",
"function",
"(",
"point",
",",
"i",
")",
"{",
"if",
"(",
"point",
".",
"y",
"===",
"null",
")",
"{",
"if",
"(",
"i",
">",
"lastNull",
"+",
"1",
")",
"{",
"segments",
".",
"push",
"(",
"points",
".",
"slice",
"(",
"lastNull",
"+",
"1",
",",
"i",
")",
")",
";",
"}",
"lastNull",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"i",
"===",
"pointsLength",
"-",
"1",
")",
"{",
"// last value",
"segments",
".",
"push",
"(",
"points",
".",
"slice",
"(",
"lastNull",
"+",
"1",
",",
"i",
"+",
"1",
")",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"// register it",
"series",
".",
"segments",
"=",
"segments",
";",
"}"
] | Divide the series data into segments divided by null values. | [
"Divide",
"the",
"series",
"data",
"into",
"segments",
"divided",
"by",
"null",
"values",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L12856-L12895 | |
23,523 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (redraw, animation) {
var series = this,
chart = series.chart;
redraw = pick(redraw, true);
if (!series.isRemoving) { /* prevent triggering native event in jQuery
(calling the remove function from the remove event) */
series.isRemoving = true;
// fire the event with a default handler of removing the point
fireEvent(series, 'remove', null, function () {
// destroy elements
series.destroy();
// redraw
chart.isDirtyLegend = chart.isDirtyBox = true;
chart.linkSeries();
if (redraw) {
chart.redraw(animation);
}
});
}
series.isRemoving = false;
} | javascript | function (redraw, animation) {
var series = this,
chart = series.chart;
redraw = pick(redraw, true);
if (!series.isRemoving) { /* prevent triggering native event in jQuery
(calling the remove function from the remove event) */
series.isRemoving = true;
// fire the event with a default handler of removing the point
fireEvent(series, 'remove', null, function () {
// destroy elements
series.destroy();
// redraw
chart.isDirtyLegend = chart.isDirtyBox = true;
chart.linkSeries();
if (redraw) {
chart.redraw(animation);
}
});
}
series.isRemoving = false;
} | [
"function",
"(",
"redraw",
",",
"animation",
")",
"{",
"var",
"series",
"=",
"this",
",",
"chart",
"=",
"series",
".",
"chart",
";",
"redraw",
"=",
"pick",
"(",
"redraw",
",",
"true",
")",
";",
"if",
"(",
"!",
"series",
".",
"isRemoving",
")",
"{",
"/* prevent triggering native event in jQuery\n\t\t\t\t(calling the remove function from the remove event) */",
"series",
".",
"isRemoving",
"=",
"true",
";",
"// fire the event with a default handler of removing the point",
"fireEvent",
"(",
"series",
",",
"'remove'",
",",
"null",
",",
"function",
"(",
")",
"{",
"// destroy elements",
"series",
".",
"destroy",
"(",
")",
";",
"// redraw",
"chart",
".",
"isDirtyLegend",
"=",
"chart",
".",
"isDirtyBox",
"=",
"true",
";",
"chart",
".",
"linkSeries",
"(",
")",
";",
"if",
"(",
"redraw",
")",
"{",
"chart",
".",
"redraw",
"(",
"animation",
")",
";",
"}",
"}",
")",
";",
"}",
"series",
".",
"isRemoving",
"=",
"false",
";",
"}"
] | Remove a series and optionally redraw the chart
@param {Boolean} redraw Whether to redraw the chart or wait for an explicit call
@param {Boolean|Object} animation Whether to apply animation, and optionally animation
configuration | [
"Remove",
"a",
"series",
"and",
"optionally",
"redraw",
"the",
"chart"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L13265-L13293 | |
23,524 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
if (!this.options.stacking || (this.visible !== true && this.chart.options.chart.ignoreHiddenSeries !== false)) {
return;
}
var series = this,
xData = series.processedXData,
yData = series.processedYData,
stackedYData = [],
yDataLength = yData.length,
seriesOptions = series.options,
threshold = seriesOptions.threshold,
stackOption = seriesOptions.stack,
stacking = seriesOptions.stacking,
stackKey = series.stackKey,
negKey = '-' + stackKey,
negStacks = series.negStacks,
yAxis = series.yAxis,
stacks = yAxis.stacks,
oldStacks = yAxis.oldStacks,
isNegative,
stack,
other,
key,
i,
x,
y;
// loop over the non-null y values and read them into a local array
for (i = 0; i < yDataLength; i++) {
x = xData[i];
y = yData[i];
// Read stacked values into a stack based on the x value,
// the sign of y and the stack key. Stacking is also handled for null values (#739)
isNegative = negStacks && y < threshold;
key = isNegative ? negKey : stackKey;
// Create empty object for this stack if it doesn't exist yet
if (!stacks[key]) {
stacks[key] = {};
}
// Initialize StackItem for this x
if (!stacks[key][x]) {
if (oldStacks[key] && oldStacks[key][x]) {
stacks[key][x] = oldStacks[key][x];
stacks[key][x].total = null;
} else {
stacks[key][x] = new StackItem(yAxis, yAxis.options.stackLabels, isNegative, x, stackOption, stacking);
}
}
// If the StackItem doesn't exist, create it first
stack = stacks[key][x];
stack.points[series.index] = [stack.cum || 0];
// Add value to the stack total
if (stacking === 'percent') {
// Percent stacked column, totals are the same for the positive and negative stacks
other = isNegative ? stackKey : negKey;
if (negStacks && stacks[other] && stacks[other][x]) {
other = stacks[other][x];
stack.total = other.total = mathMax(other.total, stack.total) + mathAbs(y) || 0;
// Percent stacked areas
} else {
stack.total += mathAbs(y) || 0;
}
} else {
stack.total += y || 0;
}
stack.cum = (stack.cum || 0) + (y || 0);
stack.points[series.index].push(stack.cum);
stackedYData[i] = stack.cum;
}
if (stacking === 'percent') {
yAxis.usePercentage = true;
}
this.stackedYData = stackedYData; // To be used in getExtremes
// Reset old stacks
yAxis.oldStacks = {};
} | javascript | function () {
if (!this.options.stacking || (this.visible !== true && this.chart.options.chart.ignoreHiddenSeries !== false)) {
return;
}
var series = this,
xData = series.processedXData,
yData = series.processedYData,
stackedYData = [],
yDataLength = yData.length,
seriesOptions = series.options,
threshold = seriesOptions.threshold,
stackOption = seriesOptions.stack,
stacking = seriesOptions.stacking,
stackKey = series.stackKey,
negKey = '-' + stackKey,
negStacks = series.negStacks,
yAxis = series.yAxis,
stacks = yAxis.stacks,
oldStacks = yAxis.oldStacks,
isNegative,
stack,
other,
key,
i,
x,
y;
// loop over the non-null y values and read them into a local array
for (i = 0; i < yDataLength; i++) {
x = xData[i];
y = yData[i];
// Read stacked values into a stack based on the x value,
// the sign of y and the stack key. Stacking is also handled for null values (#739)
isNegative = negStacks && y < threshold;
key = isNegative ? negKey : stackKey;
// Create empty object for this stack if it doesn't exist yet
if (!stacks[key]) {
stacks[key] = {};
}
// Initialize StackItem for this x
if (!stacks[key][x]) {
if (oldStacks[key] && oldStacks[key][x]) {
stacks[key][x] = oldStacks[key][x];
stacks[key][x].total = null;
} else {
stacks[key][x] = new StackItem(yAxis, yAxis.options.stackLabels, isNegative, x, stackOption, stacking);
}
}
// If the StackItem doesn't exist, create it first
stack = stacks[key][x];
stack.points[series.index] = [stack.cum || 0];
// Add value to the stack total
if (stacking === 'percent') {
// Percent stacked column, totals are the same for the positive and negative stacks
other = isNegative ? stackKey : negKey;
if (negStacks && stacks[other] && stacks[other][x]) {
other = stacks[other][x];
stack.total = other.total = mathMax(other.total, stack.total) + mathAbs(y) || 0;
// Percent stacked areas
} else {
stack.total += mathAbs(y) || 0;
}
} else {
stack.total += y || 0;
}
stack.cum = (stack.cum || 0) + (y || 0);
stack.points[series.index].push(stack.cum);
stackedYData[i] = stack.cum;
}
if (stacking === 'percent') {
yAxis.usePercentage = true;
}
this.stackedYData = stackedYData; // To be used in getExtremes
// Reset old stacks
yAxis.oldStacks = {};
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"options",
".",
"stacking",
"||",
"(",
"this",
".",
"visible",
"!==",
"true",
"&&",
"this",
".",
"chart",
".",
"options",
".",
"chart",
".",
"ignoreHiddenSeries",
"!==",
"false",
")",
")",
"{",
"return",
";",
"}",
"var",
"series",
"=",
"this",
",",
"xData",
"=",
"series",
".",
"processedXData",
",",
"yData",
"=",
"series",
".",
"processedYData",
",",
"stackedYData",
"=",
"[",
"]",
",",
"yDataLength",
"=",
"yData",
".",
"length",
",",
"seriesOptions",
"=",
"series",
".",
"options",
",",
"threshold",
"=",
"seriesOptions",
".",
"threshold",
",",
"stackOption",
"=",
"seriesOptions",
".",
"stack",
",",
"stacking",
"=",
"seriesOptions",
".",
"stacking",
",",
"stackKey",
"=",
"series",
".",
"stackKey",
",",
"negKey",
"=",
"'-'",
"+",
"stackKey",
",",
"negStacks",
"=",
"series",
".",
"negStacks",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"stacks",
"=",
"yAxis",
".",
"stacks",
",",
"oldStacks",
"=",
"yAxis",
".",
"oldStacks",
",",
"isNegative",
",",
"stack",
",",
"other",
",",
"key",
",",
"i",
",",
"x",
",",
"y",
";",
"// loop over the non-null y values and read them into a local array",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"yDataLength",
";",
"i",
"++",
")",
"{",
"x",
"=",
"xData",
"[",
"i",
"]",
";",
"y",
"=",
"yData",
"[",
"i",
"]",
";",
"// Read stacked values into a stack based on the x value,",
"// the sign of y and the stack key. Stacking is also handled for null values (#739)",
"isNegative",
"=",
"negStacks",
"&&",
"y",
"<",
"threshold",
";",
"key",
"=",
"isNegative",
"?",
"negKey",
":",
"stackKey",
";",
"// Create empty object for this stack if it doesn't exist yet",
"if",
"(",
"!",
"stacks",
"[",
"key",
"]",
")",
"{",
"stacks",
"[",
"key",
"]",
"=",
"{",
"}",
";",
"}",
"// Initialize StackItem for this x",
"if",
"(",
"!",
"stacks",
"[",
"key",
"]",
"[",
"x",
"]",
")",
"{",
"if",
"(",
"oldStacks",
"[",
"key",
"]",
"&&",
"oldStacks",
"[",
"key",
"]",
"[",
"x",
"]",
")",
"{",
"stacks",
"[",
"key",
"]",
"[",
"x",
"]",
"=",
"oldStacks",
"[",
"key",
"]",
"[",
"x",
"]",
";",
"stacks",
"[",
"key",
"]",
"[",
"x",
"]",
".",
"total",
"=",
"null",
";",
"}",
"else",
"{",
"stacks",
"[",
"key",
"]",
"[",
"x",
"]",
"=",
"new",
"StackItem",
"(",
"yAxis",
",",
"yAxis",
".",
"options",
".",
"stackLabels",
",",
"isNegative",
",",
"x",
",",
"stackOption",
",",
"stacking",
")",
";",
"}",
"}",
"// If the StackItem doesn't exist, create it first",
"stack",
"=",
"stacks",
"[",
"key",
"]",
"[",
"x",
"]",
";",
"stack",
".",
"points",
"[",
"series",
".",
"index",
"]",
"=",
"[",
"stack",
".",
"cum",
"||",
"0",
"]",
";",
"// Add value to the stack total",
"if",
"(",
"stacking",
"===",
"'percent'",
")",
"{",
"// Percent stacked column, totals are the same for the positive and negative stacks",
"other",
"=",
"isNegative",
"?",
"stackKey",
":",
"negKey",
";",
"if",
"(",
"negStacks",
"&&",
"stacks",
"[",
"other",
"]",
"&&",
"stacks",
"[",
"other",
"]",
"[",
"x",
"]",
")",
"{",
"other",
"=",
"stacks",
"[",
"other",
"]",
"[",
"x",
"]",
";",
"stack",
".",
"total",
"=",
"other",
".",
"total",
"=",
"mathMax",
"(",
"other",
".",
"total",
",",
"stack",
".",
"total",
")",
"+",
"mathAbs",
"(",
"y",
")",
"||",
"0",
";",
"// Percent stacked areas\t\t\t\t\t",
"}",
"else",
"{",
"stack",
".",
"total",
"+=",
"mathAbs",
"(",
"y",
")",
"||",
"0",
";",
"}",
"}",
"else",
"{",
"stack",
".",
"total",
"+=",
"y",
"||",
"0",
";",
"}",
"stack",
".",
"cum",
"=",
"(",
"stack",
".",
"cum",
"||",
"0",
")",
"+",
"(",
"y",
"||",
"0",
")",
";",
"stack",
".",
"points",
"[",
"series",
".",
"index",
"]",
".",
"push",
"(",
"stack",
".",
"cum",
")",
";",
"stackedYData",
"[",
"i",
"]",
"=",
"stack",
".",
"cum",
";",
"}",
"if",
"(",
"stacking",
"===",
"'percent'",
")",
"{",
"yAxis",
".",
"usePercentage",
"=",
"true",
";",
"}",
"this",
".",
"stackedYData",
"=",
"stackedYData",
";",
"// To be used in getExtremes",
"// Reset old stacks",
"yAxis",
".",
"oldStacks",
"=",
"{",
"}",
";",
"}"
] | Adds series' points value to corresponding stack | [
"Adds",
"series",
"points",
"value",
"to",
"corresponding",
"stack"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L13468-L13557 | |
23,525 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var xAxis = this.xAxis,
yAxis = this.yAxis,
xData = this.processedXData,
yData = this.stackedYData || this.processedYData,
yDataLength = yData.length,
activeYData = [],
activeCounter = 0,
xExtremes = xAxis.getExtremes(), // #2117, need to compensate for log X axis
xMin = xExtremes.min,
xMax = xExtremes.max,
validValue,
withinRange,
dataMin,
dataMax,
x,
y,
i,
j;
for (i = 0; i < yDataLength; i++) {
x = xData[i];
y = yData[i];
// For points within the visible range, including the first point outside the
// visible range, consider y extremes
validValue = y !== null && y !== UNDEFINED && (!yAxis.isLog || (y.length || y > 0));
withinRange = this.getExtremesFromAll || this.cropped || ((xData[i + 1] || x) >= xMin &&
(xData[i - 1] || x) <= xMax);
if (validValue && withinRange) {
j = y.length;
if (j) { // array, like ohlc or range data
while (j--) {
if (y[j] !== null) {
activeYData[activeCounter++] = y[j];
}
}
} else {
activeYData[activeCounter++] = y;
}
}
}
this.dataMin = pick(dataMin, arrayMin(activeYData));
this.dataMax = pick(dataMax, arrayMax(activeYData));
} | javascript | function () {
var xAxis = this.xAxis,
yAxis = this.yAxis,
xData = this.processedXData,
yData = this.stackedYData || this.processedYData,
yDataLength = yData.length,
activeYData = [],
activeCounter = 0,
xExtremes = xAxis.getExtremes(), // #2117, need to compensate for log X axis
xMin = xExtremes.min,
xMax = xExtremes.max,
validValue,
withinRange,
dataMin,
dataMax,
x,
y,
i,
j;
for (i = 0; i < yDataLength; i++) {
x = xData[i];
y = yData[i];
// For points within the visible range, including the first point outside the
// visible range, consider y extremes
validValue = y !== null && y !== UNDEFINED && (!yAxis.isLog || (y.length || y > 0));
withinRange = this.getExtremesFromAll || this.cropped || ((xData[i + 1] || x) >= xMin &&
(xData[i - 1] || x) <= xMax);
if (validValue && withinRange) {
j = y.length;
if (j) { // array, like ohlc or range data
while (j--) {
if (y[j] !== null) {
activeYData[activeCounter++] = y[j];
}
}
} else {
activeYData[activeCounter++] = y;
}
}
}
this.dataMin = pick(dataMin, arrayMin(activeYData));
this.dataMax = pick(dataMax, arrayMax(activeYData));
} | [
"function",
"(",
")",
"{",
"var",
"xAxis",
"=",
"this",
".",
"xAxis",
",",
"yAxis",
"=",
"this",
".",
"yAxis",
",",
"xData",
"=",
"this",
".",
"processedXData",
",",
"yData",
"=",
"this",
".",
"stackedYData",
"||",
"this",
".",
"processedYData",
",",
"yDataLength",
"=",
"yData",
".",
"length",
",",
"activeYData",
"=",
"[",
"]",
",",
"activeCounter",
"=",
"0",
",",
"xExtremes",
"=",
"xAxis",
".",
"getExtremes",
"(",
")",
",",
"// #2117, need to compensate for log X axis",
"xMin",
"=",
"xExtremes",
".",
"min",
",",
"xMax",
"=",
"xExtremes",
".",
"max",
",",
"validValue",
",",
"withinRange",
",",
"dataMin",
",",
"dataMax",
",",
"x",
",",
"y",
",",
"i",
",",
"j",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"yDataLength",
";",
"i",
"++",
")",
"{",
"x",
"=",
"xData",
"[",
"i",
"]",
";",
"y",
"=",
"yData",
"[",
"i",
"]",
";",
"// For points within the visible range, including the first point outside the",
"// visible range, consider y extremes",
"validValue",
"=",
"y",
"!==",
"null",
"&&",
"y",
"!==",
"UNDEFINED",
"&&",
"(",
"!",
"yAxis",
".",
"isLog",
"||",
"(",
"y",
".",
"length",
"||",
"y",
">",
"0",
")",
")",
";",
"withinRange",
"=",
"this",
".",
"getExtremesFromAll",
"||",
"this",
".",
"cropped",
"||",
"(",
"(",
"xData",
"[",
"i",
"+",
"1",
"]",
"||",
"x",
")",
">=",
"xMin",
"&&",
"(",
"xData",
"[",
"i",
"-",
"1",
"]",
"||",
"x",
")",
"<=",
"xMax",
")",
";",
"if",
"(",
"validValue",
"&&",
"withinRange",
")",
"{",
"j",
"=",
"y",
".",
"length",
";",
"if",
"(",
"j",
")",
"{",
"// array, like ohlc or range data",
"while",
"(",
"j",
"--",
")",
"{",
"if",
"(",
"y",
"[",
"j",
"]",
"!==",
"null",
")",
"{",
"activeYData",
"[",
"activeCounter",
"++",
"]",
"=",
"y",
"[",
"j",
"]",
";",
"}",
"}",
"}",
"else",
"{",
"activeYData",
"[",
"activeCounter",
"++",
"]",
"=",
"y",
";",
"}",
"}",
"}",
"this",
".",
"dataMin",
"=",
"pick",
"(",
"dataMin",
",",
"arrayMin",
"(",
"activeYData",
")",
")",
";",
"this",
".",
"dataMax",
"=",
"pick",
"(",
"dataMax",
",",
"arrayMax",
"(",
"activeYData",
")",
")",
";",
"}"
] | Calculate Y extremes for visible data | [
"Calculate",
"Y",
"extremes",
"for",
"visible",
"data"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L13591-L13638 | |
23,526 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (point) {
var series = this,
tooltipOptions = series.tooltipOptions,
xDateFormat = tooltipOptions.xDateFormat,
dateTimeLabelFormats = tooltipOptions.dateTimeLabelFormats,
xAxis = series.xAxis,
isDateTime = xAxis && xAxis.options.type === 'datetime',
headerFormat = tooltipOptions.headerFormat,
closestPointRange = xAxis && xAxis.closestPointRange,
n;
// Guess the best date format based on the closest point distance (#568)
if (isDateTime && !xDateFormat) {
if (closestPointRange) {
for (n in timeUnits) {
if (timeUnits[n] >= closestPointRange) {
xDateFormat = dateTimeLabelFormats[n];
break;
}
}
} else {
xDateFormat = dateTimeLabelFormats.day;
}
}
// Insert the header date format if any
if (isDateTime && xDateFormat && isNumber(point.key)) {
headerFormat = headerFormat.replace('{point.key}', '{point.key:' + xDateFormat + '}');
}
return format(headerFormat, {
point: point,
series: series
});
} | javascript | function (point) {
var series = this,
tooltipOptions = series.tooltipOptions,
xDateFormat = tooltipOptions.xDateFormat,
dateTimeLabelFormats = tooltipOptions.dateTimeLabelFormats,
xAxis = series.xAxis,
isDateTime = xAxis && xAxis.options.type === 'datetime',
headerFormat = tooltipOptions.headerFormat,
closestPointRange = xAxis && xAxis.closestPointRange,
n;
// Guess the best date format based on the closest point distance (#568)
if (isDateTime && !xDateFormat) {
if (closestPointRange) {
for (n in timeUnits) {
if (timeUnits[n] >= closestPointRange) {
xDateFormat = dateTimeLabelFormats[n];
break;
}
}
} else {
xDateFormat = dateTimeLabelFormats.day;
}
}
// Insert the header date format if any
if (isDateTime && xDateFormat && isNumber(point.key)) {
headerFormat = headerFormat.replace('{point.key}', '{point.key:' + xDateFormat + '}');
}
return format(headerFormat, {
point: point,
series: series
});
} | [
"function",
"(",
"point",
")",
"{",
"var",
"series",
"=",
"this",
",",
"tooltipOptions",
"=",
"series",
".",
"tooltipOptions",
",",
"xDateFormat",
"=",
"tooltipOptions",
".",
"xDateFormat",
",",
"dateTimeLabelFormats",
"=",
"tooltipOptions",
".",
"dateTimeLabelFormats",
",",
"xAxis",
"=",
"series",
".",
"xAxis",
",",
"isDateTime",
"=",
"xAxis",
"&&",
"xAxis",
".",
"options",
".",
"type",
"===",
"'datetime'",
",",
"headerFormat",
"=",
"tooltipOptions",
".",
"headerFormat",
",",
"closestPointRange",
"=",
"xAxis",
"&&",
"xAxis",
".",
"closestPointRange",
",",
"n",
";",
"// Guess the best date format based on the closest point distance (#568)",
"if",
"(",
"isDateTime",
"&&",
"!",
"xDateFormat",
")",
"{",
"if",
"(",
"closestPointRange",
")",
"{",
"for",
"(",
"n",
"in",
"timeUnits",
")",
"{",
"if",
"(",
"timeUnits",
"[",
"n",
"]",
">=",
"closestPointRange",
")",
"{",
"xDateFormat",
"=",
"dateTimeLabelFormats",
"[",
"n",
"]",
";",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"xDateFormat",
"=",
"dateTimeLabelFormats",
".",
"day",
";",
"}",
"}",
"// Insert the header date format if any",
"if",
"(",
"isDateTime",
"&&",
"xDateFormat",
"&&",
"isNumber",
"(",
"point",
".",
"key",
")",
")",
"{",
"headerFormat",
"=",
"headerFormat",
".",
"replace",
"(",
"'{point.key}'",
",",
"'{point.key:'",
"+",
"xDateFormat",
"+",
"'}'",
")",
";",
"}",
"return",
"format",
"(",
"headerFormat",
",",
"{",
"point",
":",
"point",
",",
"series",
":",
"series",
"}",
")",
";",
"}"
] | Format the header of the tooltip | [
"Format",
"the",
"header",
"of",
"the",
"tooltip"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L13809-L13843 | |
23,527 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (point, dataLabel, options, alignTo, isNew) {
var chart = this.chart,
inverted = chart.inverted,
plotX = pick(point.plotX, -999),
plotY = pick(point.plotY, -999),
bBox = dataLabel.getBBox(),
visible = this.visible && chart.isInsidePlot(point.plotX, point.plotY, inverted),
alignAttr; // the final position;
if (visible) {
// The alignment box is a singular point
alignTo = extend({
x: inverted ? chart.plotWidth - plotY : plotX,
y: mathRound(inverted ? chart.plotHeight - plotX : plotY),
width: 0,
height: 0
}, alignTo);
// Add the text size for alignment calculation
extend(options, {
width: bBox.width,
height: bBox.height
});
// Allow a hook for changing alignment in the last moment, then do the alignment
if (options.rotation) { // Fancy box alignment isn't supported for rotated text
alignAttr = {
align: options.align,
x: alignTo.x + options.x + alignTo.width / 2,
y: alignTo.y + options.y + alignTo.height / 2
};
dataLabel[isNew ? 'attr' : 'animate'](alignAttr);
} else {
dataLabel.align(options, null, alignTo);
alignAttr = dataLabel.alignAttr;
// Handle justify or crop
if (pick(options.overflow, 'justify') === 'justify') { // docs: overflow: justify, also crop only applies when not justify
this.justifyDataLabel(dataLabel, options, alignAttr, bBox, alignTo, isNew);
} else if (pick(options.crop, true)) {
// Now check that the data label is within the plot area
visible = chart.isInsidePlot(alignAttr.x, alignAttr.y) && chart.isInsidePlot(alignAttr.x + bBox.width, alignAttr.y + bBox.height);
}
}
}
// Show or hide based on the final aligned position
if (!visible) {
dataLabel.attr({ y: -999 });
}
} | javascript | function (point, dataLabel, options, alignTo, isNew) {
var chart = this.chart,
inverted = chart.inverted,
plotX = pick(point.plotX, -999),
plotY = pick(point.plotY, -999),
bBox = dataLabel.getBBox(),
visible = this.visible && chart.isInsidePlot(point.plotX, point.plotY, inverted),
alignAttr; // the final position;
if (visible) {
// The alignment box is a singular point
alignTo = extend({
x: inverted ? chart.plotWidth - plotY : plotX,
y: mathRound(inverted ? chart.plotHeight - plotX : plotY),
width: 0,
height: 0
}, alignTo);
// Add the text size for alignment calculation
extend(options, {
width: bBox.width,
height: bBox.height
});
// Allow a hook for changing alignment in the last moment, then do the alignment
if (options.rotation) { // Fancy box alignment isn't supported for rotated text
alignAttr = {
align: options.align,
x: alignTo.x + options.x + alignTo.width / 2,
y: alignTo.y + options.y + alignTo.height / 2
};
dataLabel[isNew ? 'attr' : 'animate'](alignAttr);
} else {
dataLabel.align(options, null, alignTo);
alignAttr = dataLabel.alignAttr;
// Handle justify or crop
if (pick(options.overflow, 'justify') === 'justify') { // docs: overflow: justify, also crop only applies when not justify
this.justifyDataLabel(dataLabel, options, alignAttr, bBox, alignTo, isNew);
} else if (pick(options.crop, true)) {
// Now check that the data label is within the plot area
visible = chart.isInsidePlot(alignAttr.x, alignAttr.y) && chart.isInsidePlot(alignAttr.x + bBox.width, alignAttr.y + bBox.height);
}
}
}
// Show or hide based on the final aligned position
if (!visible) {
dataLabel.attr({ y: -999 });
}
} | [
"function",
"(",
"point",
",",
"dataLabel",
",",
"options",
",",
"alignTo",
",",
"isNew",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"inverted",
"=",
"chart",
".",
"inverted",
",",
"plotX",
"=",
"pick",
"(",
"point",
".",
"plotX",
",",
"-",
"999",
")",
",",
"plotY",
"=",
"pick",
"(",
"point",
".",
"plotY",
",",
"-",
"999",
")",
",",
"bBox",
"=",
"dataLabel",
".",
"getBBox",
"(",
")",
",",
"visible",
"=",
"this",
".",
"visible",
"&&",
"chart",
".",
"isInsidePlot",
"(",
"point",
".",
"plotX",
",",
"point",
".",
"plotY",
",",
"inverted",
")",
",",
"alignAttr",
";",
"// the final position;",
"if",
"(",
"visible",
")",
"{",
"// The alignment box is a singular point",
"alignTo",
"=",
"extend",
"(",
"{",
"x",
":",
"inverted",
"?",
"chart",
".",
"plotWidth",
"-",
"plotY",
":",
"plotX",
",",
"y",
":",
"mathRound",
"(",
"inverted",
"?",
"chart",
".",
"plotHeight",
"-",
"plotX",
":",
"plotY",
")",
",",
"width",
":",
"0",
",",
"height",
":",
"0",
"}",
",",
"alignTo",
")",
";",
"// Add the text size for alignment calculation",
"extend",
"(",
"options",
",",
"{",
"width",
":",
"bBox",
".",
"width",
",",
"height",
":",
"bBox",
".",
"height",
"}",
")",
";",
"// Allow a hook for changing alignment in the last moment, then do the alignment",
"if",
"(",
"options",
".",
"rotation",
")",
"{",
"// Fancy box alignment isn't supported for rotated text",
"alignAttr",
"=",
"{",
"align",
":",
"options",
".",
"align",
",",
"x",
":",
"alignTo",
".",
"x",
"+",
"options",
".",
"x",
"+",
"alignTo",
".",
"width",
"/",
"2",
",",
"y",
":",
"alignTo",
".",
"y",
"+",
"options",
".",
"y",
"+",
"alignTo",
".",
"height",
"/",
"2",
"}",
";",
"dataLabel",
"[",
"isNew",
"?",
"'attr'",
":",
"'animate'",
"]",
"(",
"alignAttr",
")",
";",
"}",
"else",
"{",
"dataLabel",
".",
"align",
"(",
"options",
",",
"null",
",",
"alignTo",
")",
";",
"alignAttr",
"=",
"dataLabel",
".",
"alignAttr",
";",
"// Handle justify or crop",
"if",
"(",
"pick",
"(",
"options",
".",
"overflow",
",",
"'justify'",
")",
"===",
"'justify'",
")",
"{",
"// docs: overflow: justify, also crop only applies when not justify",
"this",
".",
"justifyDataLabel",
"(",
"dataLabel",
",",
"options",
",",
"alignAttr",
",",
"bBox",
",",
"alignTo",
",",
"isNew",
")",
";",
"}",
"else",
"if",
"(",
"pick",
"(",
"options",
".",
"crop",
",",
"true",
")",
")",
"{",
"// Now check that the data label is within the plot area",
"visible",
"=",
"chart",
".",
"isInsidePlot",
"(",
"alignAttr",
".",
"x",
",",
"alignAttr",
".",
"y",
")",
"&&",
"chart",
".",
"isInsidePlot",
"(",
"alignAttr",
".",
"x",
"+",
"bBox",
".",
"width",
",",
"alignAttr",
".",
"y",
"+",
"bBox",
".",
"height",
")",
";",
"}",
"}",
"}",
"// Show or hide based on the final aligned position",
"if",
"(",
"!",
"visible",
")",
"{",
"dataLabel",
".",
"attr",
"(",
"{",
"y",
":",
"-",
"999",
"}",
")",
";",
"}",
"}"
] | Align each individual data label | [
"Align",
"each",
"individual",
"data",
"label"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14468-L14522 | |
23,528 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (dataLabel, options, alignAttr, bBox, alignTo, isNew) {
var chart = this.chart,
align = options.align,
verticalAlign = options.verticalAlign,
off,
justified;
// Off left
off = alignAttr.x;
if (off < 0) {
if (align === 'right') {
options.align = 'left';
} else {
options.x = -off;
}
justified = true;
}
// Off right
off = alignAttr.x + bBox.width;
if (off > chart.plotWidth) {
if (align === 'left') {
options.align = 'right';
} else {
options.x = chart.plotWidth - off;
}
justified = true;
}
// Off top
off = alignAttr.y;
if (off < 0) {
if (verticalAlign === 'bottom') {
options.verticalAlign = 'top';
} else {
options.y = -off;
}
justified = true;
}
// Off bottom
off = alignAttr.y + bBox.height;
if (off > chart.plotHeight) {
if (verticalAlign === 'top') {
options.verticalAlign = 'bottom';
} else {
options.y = chart.plotHeight - off;
}
justified = true;
}
if (justified) {
dataLabel.placed = !isNew;
dataLabel.align(options, null, alignTo);
}
} | javascript | function (dataLabel, options, alignAttr, bBox, alignTo, isNew) {
var chart = this.chart,
align = options.align,
verticalAlign = options.verticalAlign,
off,
justified;
// Off left
off = alignAttr.x;
if (off < 0) {
if (align === 'right') {
options.align = 'left';
} else {
options.x = -off;
}
justified = true;
}
// Off right
off = alignAttr.x + bBox.width;
if (off > chart.plotWidth) {
if (align === 'left') {
options.align = 'right';
} else {
options.x = chart.plotWidth - off;
}
justified = true;
}
// Off top
off = alignAttr.y;
if (off < 0) {
if (verticalAlign === 'bottom') {
options.verticalAlign = 'top';
} else {
options.y = -off;
}
justified = true;
}
// Off bottom
off = alignAttr.y + bBox.height;
if (off > chart.plotHeight) {
if (verticalAlign === 'top') {
options.verticalAlign = 'bottom';
} else {
options.y = chart.plotHeight - off;
}
justified = true;
}
if (justified) {
dataLabel.placed = !isNew;
dataLabel.align(options, null, alignTo);
}
} | [
"function",
"(",
"dataLabel",
",",
"options",
",",
"alignAttr",
",",
"bBox",
",",
"alignTo",
",",
"isNew",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
",",
"align",
"=",
"options",
".",
"align",
",",
"verticalAlign",
"=",
"options",
".",
"verticalAlign",
",",
"off",
",",
"justified",
";",
"// Off left",
"off",
"=",
"alignAttr",
".",
"x",
";",
"if",
"(",
"off",
"<",
"0",
")",
"{",
"if",
"(",
"align",
"===",
"'right'",
")",
"{",
"options",
".",
"align",
"=",
"'left'",
";",
"}",
"else",
"{",
"options",
".",
"x",
"=",
"-",
"off",
";",
"}",
"justified",
"=",
"true",
";",
"}",
"// Off right",
"off",
"=",
"alignAttr",
".",
"x",
"+",
"bBox",
".",
"width",
";",
"if",
"(",
"off",
">",
"chart",
".",
"plotWidth",
")",
"{",
"if",
"(",
"align",
"===",
"'left'",
")",
"{",
"options",
".",
"align",
"=",
"'right'",
";",
"}",
"else",
"{",
"options",
".",
"x",
"=",
"chart",
".",
"plotWidth",
"-",
"off",
";",
"}",
"justified",
"=",
"true",
";",
"}",
"// Off top",
"off",
"=",
"alignAttr",
".",
"y",
";",
"if",
"(",
"off",
"<",
"0",
")",
"{",
"if",
"(",
"verticalAlign",
"===",
"'bottom'",
")",
"{",
"options",
".",
"verticalAlign",
"=",
"'top'",
";",
"}",
"else",
"{",
"options",
".",
"y",
"=",
"-",
"off",
";",
"}",
"justified",
"=",
"true",
";",
"}",
"// Off bottom",
"off",
"=",
"alignAttr",
".",
"y",
"+",
"bBox",
".",
"height",
";",
"if",
"(",
"off",
">",
"chart",
".",
"plotHeight",
")",
"{",
"if",
"(",
"verticalAlign",
"===",
"'top'",
")",
"{",
"options",
".",
"verticalAlign",
"=",
"'bottom'",
";",
"}",
"else",
"{",
"options",
".",
"y",
"=",
"chart",
".",
"plotHeight",
"-",
"off",
";",
"}",
"justified",
"=",
"true",
";",
"}",
"if",
"(",
"justified",
")",
"{",
"dataLabel",
".",
"placed",
"=",
"!",
"isNew",
";",
"dataLabel",
".",
"align",
"(",
"options",
",",
"null",
",",
"alignTo",
")",
";",
"}",
"}"
] | If data labels fall partly outside the plot area, align them back in, in a way that
doesn't hide the point. | [
"If",
"data",
"labels",
"fall",
"partly",
"outside",
"the",
"plot",
"area",
"align",
"them",
"back",
"in",
"in",
"a",
"way",
"that",
"doesn",
"t",
"hide",
"the",
"point",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14528-L14583 | |
23,529 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (segment) {
var series = this,
segmentPath = [],
step = series.options.step;
// build the segment line
each(segment, function (point, i) {
var plotX = point.plotX,
plotY = point.plotY,
lastPoint;
if (series.getPointSpline) { // generate the spline as defined in the SplineSeries object
segmentPath.push.apply(segmentPath, series.getPointSpline(segment, point, i));
} else {
// moveTo or lineTo
segmentPath.push(i ? L : M);
// step line?
if (step && i) {
lastPoint = segment[i - 1];
if (step === 'right') {
segmentPath.push(
lastPoint.plotX,
plotY
);
} else if (step === 'center') {
segmentPath.push(
(lastPoint.plotX + plotX) / 2,
lastPoint.plotY,
(lastPoint.plotX + plotX) / 2,
plotY
);
} else {
segmentPath.push(
plotX,
lastPoint.plotY
);
}
}
// normal line to next point
segmentPath.push(
point.plotX,
point.plotY
);
}
});
return segmentPath;
} | javascript | function (segment) {
var series = this,
segmentPath = [],
step = series.options.step;
// build the segment line
each(segment, function (point, i) {
var plotX = point.plotX,
plotY = point.plotY,
lastPoint;
if (series.getPointSpline) { // generate the spline as defined in the SplineSeries object
segmentPath.push.apply(segmentPath, series.getPointSpline(segment, point, i));
} else {
// moveTo or lineTo
segmentPath.push(i ? L : M);
// step line?
if (step && i) {
lastPoint = segment[i - 1];
if (step === 'right') {
segmentPath.push(
lastPoint.plotX,
plotY
);
} else if (step === 'center') {
segmentPath.push(
(lastPoint.plotX + plotX) / 2,
lastPoint.plotY,
(lastPoint.plotX + plotX) / 2,
plotY
);
} else {
segmentPath.push(
plotX,
lastPoint.plotY
);
}
}
// normal line to next point
segmentPath.push(
point.plotX,
point.plotY
);
}
});
return segmentPath;
} | [
"function",
"(",
"segment",
")",
"{",
"var",
"series",
"=",
"this",
",",
"segmentPath",
"=",
"[",
"]",
",",
"step",
"=",
"series",
".",
"options",
".",
"step",
";",
"// build the segment line",
"each",
"(",
"segment",
",",
"function",
"(",
"point",
",",
"i",
")",
"{",
"var",
"plotX",
"=",
"point",
".",
"plotX",
",",
"plotY",
"=",
"point",
".",
"plotY",
",",
"lastPoint",
";",
"if",
"(",
"series",
".",
"getPointSpline",
")",
"{",
"// generate the spline as defined in the SplineSeries object",
"segmentPath",
".",
"push",
".",
"apply",
"(",
"segmentPath",
",",
"series",
".",
"getPointSpline",
"(",
"segment",
",",
"point",
",",
"i",
")",
")",
";",
"}",
"else",
"{",
"// moveTo or lineTo",
"segmentPath",
".",
"push",
"(",
"i",
"?",
"L",
":",
"M",
")",
";",
"// step line?",
"if",
"(",
"step",
"&&",
"i",
")",
"{",
"lastPoint",
"=",
"segment",
"[",
"i",
"-",
"1",
"]",
";",
"if",
"(",
"step",
"===",
"'right'",
")",
"{",
"segmentPath",
".",
"push",
"(",
"lastPoint",
".",
"plotX",
",",
"plotY",
")",
";",
"}",
"else",
"if",
"(",
"step",
"===",
"'center'",
")",
"{",
"segmentPath",
".",
"push",
"(",
"(",
"lastPoint",
".",
"plotX",
"+",
"plotX",
")",
"/",
"2",
",",
"lastPoint",
".",
"plotY",
",",
"(",
"lastPoint",
".",
"plotX",
"+",
"plotX",
")",
"/",
"2",
",",
"plotY",
")",
";",
"}",
"else",
"{",
"segmentPath",
".",
"push",
"(",
"plotX",
",",
"lastPoint",
".",
"plotY",
")",
";",
"}",
"}",
"// normal line to next point",
"segmentPath",
".",
"push",
"(",
"point",
".",
"plotX",
",",
"point",
".",
"plotY",
")",
";",
"}",
"}",
")",
";",
"return",
"segmentPath",
";",
"}"
] | Return the graph path of a segment | [
"Return",
"the",
"graph",
"path",
"of",
"a",
"segment"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14588-L14642 | |
23,530 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
graphPath = [],
segmentPath,
singlePoints = []; // used in drawTracker
// Divide into segments and build graph and area paths
each(series.segments, function (segment) {
segmentPath = series.getSegmentPath(segment);
// add the segment to the graph, or a single point for tracking
if (segment.length > 1) {
graphPath = graphPath.concat(segmentPath);
} else {
singlePoints.push(segment[0]);
}
});
// Record it for use in drawGraph and drawTracker, and return graphPath
series.singlePoints = singlePoints;
series.graphPath = graphPath;
return graphPath;
} | javascript | function () {
var series = this,
graphPath = [],
segmentPath,
singlePoints = []; // used in drawTracker
// Divide into segments and build graph and area paths
each(series.segments, function (segment) {
segmentPath = series.getSegmentPath(segment);
// add the segment to the graph, or a single point for tracking
if (segment.length > 1) {
graphPath = graphPath.concat(segmentPath);
} else {
singlePoints.push(segment[0]);
}
});
// Record it for use in drawGraph and drawTracker, and return graphPath
series.singlePoints = singlePoints;
series.graphPath = graphPath;
return graphPath;
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"graphPath",
"=",
"[",
"]",
",",
"segmentPath",
",",
"singlePoints",
"=",
"[",
"]",
";",
"// used in drawTracker",
"// Divide into segments and build graph and area paths",
"each",
"(",
"series",
".",
"segments",
",",
"function",
"(",
"segment",
")",
"{",
"segmentPath",
"=",
"series",
".",
"getSegmentPath",
"(",
"segment",
")",
";",
"// add the segment to the graph, or a single point for tracking",
"if",
"(",
"segment",
".",
"length",
">",
"1",
")",
"{",
"graphPath",
"=",
"graphPath",
".",
"concat",
"(",
"segmentPath",
")",
";",
"}",
"else",
"{",
"singlePoints",
".",
"push",
"(",
"segment",
"[",
"0",
"]",
")",
";",
"}",
"}",
")",
";",
"// Record it for use in drawGraph and drawTracker, and return graphPath",
"series",
".",
"singlePoints",
"=",
"singlePoints",
";",
"series",
".",
"graphPath",
"=",
"graphPath",
";",
"return",
"graphPath",
";",
"}"
] | Get the graph path | [
"Get",
"the",
"graph",
"path"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14647-L14672 | |
23,531 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var options = this.options,
chart = this.chart,
renderer = chart.renderer,
negativeColor = options.negativeColor || options.negativeFillColor,
translatedThreshold,
posAttr,
negAttr,
graph = this.graph,
area = this.area,
posClip = this.posClip,
negClip = this.negClip,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
chartSizeMax = mathMax(chartWidth, chartHeight),
yAxis = this.yAxis,
above,
below;
if (negativeColor && (graph || area)) {
translatedThreshold = mathRound(yAxis.toPixels(options.threshold || 0, true));
above = {
x: 0,
y: 0,
width: chartSizeMax,
height: translatedThreshold
};
below = {
x: 0,
y: translatedThreshold,
width: chartSizeMax,
height: chartSizeMax
};
if (chart.inverted) {
above.height = below.y = chart.plotWidth - translatedThreshold;
if (renderer.isVML) {
above = {
x: chart.plotWidth - translatedThreshold - chart.plotLeft,
y: 0,
width: chartWidth,
height: chartHeight
};
below = {
x: translatedThreshold + chart.plotLeft - chartWidth,
y: 0,
width: chart.plotLeft + translatedThreshold,
height: chartWidth
};
}
}
if (yAxis.reversed) {
posAttr = below;
negAttr = above;
} else {
posAttr = above;
negAttr = below;
}
if (posClip) { // update
posClip.animate(posAttr);
negClip.animate(negAttr);
} else {
this.posClip = posClip = renderer.clipRect(posAttr);
this.negClip = negClip = renderer.clipRect(negAttr);
if (graph && this.graphNeg) {
graph.clip(posClip);
this.graphNeg.clip(negClip);
}
if (area) {
area.clip(posClip);
this.areaNeg.clip(negClip);
}
}
}
} | javascript | function () {
var options = this.options,
chart = this.chart,
renderer = chart.renderer,
negativeColor = options.negativeColor || options.negativeFillColor,
translatedThreshold,
posAttr,
negAttr,
graph = this.graph,
area = this.area,
posClip = this.posClip,
negClip = this.negClip,
chartWidth = chart.chartWidth,
chartHeight = chart.chartHeight,
chartSizeMax = mathMax(chartWidth, chartHeight),
yAxis = this.yAxis,
above,
below;
if (negativeColor && (graph || area)) {
translatedThreshold = mathRound(yAxis.toPixels(options.threshold || 0, true));
above = {
x: 0,
y: 0,
width: chartSizeMax,
height: translatedThreshold
};
below = {
x: 0,
y: translatedThreshold,
width: chartSizeMax,
height: chartSizeMax
};
if (chart.inverted) {
above.height = below.y = chart.plotWidth - translatedThreshold;
if (renderer.isVML) {
above = {
x: chart.plotWidth - translatedThreshold - chart.plotLeft,
y: 0,
width: chartWidth,
height: chartHeight
};
below = {
x: translatedThreshold + chart.plotLeft - chartWidth,
y: 0,
width: chart.plotLeft + translatedThreshold,
height: chartWidth
};
}
}
if (yAxis.reversed) {
posAttr = below;
negAttr = above;
} else {
posAttr = above;
negAttr = below;
}
if (posClip) { // update
posClip.animate(posAttr);
negClip.animate(negAttr);
} else {
this.posClip = posClip = renderer.clipRect(posAttr);
this.negClip = negClip = renderer.clipRect(negAttr);
if (graph && this.graphNeg) {
graph.clip(posClip);
this.graphNeg.clip(negClip);
}
if (area) {
area.clip(posClip);
this.areaNeg.clip(negClip);
}
}
}
} | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"chart",
"=",
"this",
".",
"chart",
",",
"renderer",
"=",
"chart",
".",
"renderer",
",",
"negativeColor",
"=",
"options",
".",
"negativeColor",
"||",
"options",
".",
"negativeFillColor",
",",
"translatedThreshold",
",",
"posAttr",
",",
"negAttr",
",",
"graph",
"=",
"this",
".",
"graph",
",",
"area",
"=",
"this",
".",
"area",
",",
"posClip",
"=",
"this",
".",
"posClip",
",",
"negClip",
"=",
"this",
".",
"negClip",
",",
"chartWidth",
"=",
"chart",
".",
"chartWidth",
",",
"chartHeight",
"=",
"chart",
".",
"chartHeight",
",",
"chartSizeMax",
"=",
"mathMax",
"(",
"chartWidth",
",",
"chartHeight",
")",
",",
"yAxis",
"=",
"this",
".",
"yAxis",
",",
"above",
",",
"below",
";",
"if",
"(",
"negativeColor",
"&&",
"(",
"graph",
"||",
"area",
")",
")",
"{",
"translatedThreshold",
"=",
"mathRound",
"(",
"yAxis",
".",
"toPixels",
"(",
"options",
".",
"threshold",
"||",
"0",
",",
"true",
")",
")",
";",
"above",
"=",
"{",
"x",
":",
"0",
",",
"y",
":",
"0",
",",
"width",
":",
"chartSizeMax",
",",
"height",
":",
"translatedThreshold",
"}",
";",
"below",
"=",
"{",
"x",
":",
"0",
",",
"y",
":",
"translatedThreshold",
",",
"width",
":",
"chartSizeMax",
",",
"height",
":",
"chartSizeMax",
"}",
";",
"if",
"(",
"chart",
".",
"inverted",
")",
"{",
"above",
".",
"height",
"=",
"below",
".",
"y",
"=",
"chart",
".",
"plotWidth",
"-",
"translatedThreshold",
";",
"if",
"(",
"renderer",
".",
"isVML",
")",
"{",
"above",
"=",
"{",
"x",
":",
"chart",
".",
"plotWidth",
"-",
"translatedThreshold",
"-",
"chart",
".",
"plotLeft",
",",
"y",
":",
"0",
",",
"width",
":",
"chartWidth",
",",
"height",
":",
"chartHeight",
"}",
";",
"below",
"=",
"{",
"x",
":",
"translatedThreshold",
"+",
"chart",
".",
"plotLeft",
"-",
"chartWidth",
",",
"y",
":",
"0",
",",
"width",
":",
"chart",
".",
"plotLeft",
"+",
"translatedThreshold",
",",
"height",
":",
"chartWidth",
"}",
";",
"}",
"}",
"if",
"(",
"yAxis",
".",
"reversed",
")",
"{",
"posAttr",
"=",
"below",
";",
"negAttr",
"=",
"above",
";",
"}",
"else",
"{",
"posAttr",
"=",
"above",
";",
"negAttr",
"=",
"below",
";",
"}",
"if",
"(",
"posClip",
")",
"{",
"// update",
"posClip",
".",
"animate",
"(",
"posAttr",
")",
";",
"negClip",
".",
"animate",
"(",
"negAttr",
")",
";",
"}",
"else",
"{",
"this",
".",
"posClip",
"=",
"posClip",
"=",
"renderer",
".",
"clipRect",
"(",
"posAttr",
")",
";",
"this",
".",
"negClip",
"=",
"negClip",
"=",
"renderer",
".",
"clipRect",
"(",
"negAttr",
")",
";",
"if",
"(",
"graph",
"&&",
"this",
".",
"graphNeg",
")",
"{",
"graph",
".",
"clip",
"(",
"posClip",
")",
";",
"this",
".",
"graphNeg",
".",
"clip",
"(",
"negClip",
")",
";",
"}",
"if",
"(",
"area",
")",
"{",
"area",
".",
"clip",
"(",
"posClip",
")",
";",
"this",
".",
"areaNeg",
".",
"clip",
"(",
"negClip",
")",
";",
"}",
"}",
"}",
"}"
] | Clip the graphs into the positive and negative coloured graphs | [
"Clip",
"the",
"graphs",
"into",
"the",
"positive",
"and",
"negative",
"coloured",
"graphs"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14723-L14803 | |
23,532 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
chart = series.chart;
// Pie, go away (#1736)
if (!series.xAxis) {
return;
}
// A fixed size is needed for inversion to work
function setInvert() {
var size = {
width: series.yAxis.len,
height: series.xAxis.len
};
each(['group', 'markerGroup'], function (groupName) {
if (series[groupName]) {
series[groupName].attr(size).invert();
}
});
}
addEvent(chart, 'resize', setInvert); // do it on resize
addEvent(series, 'destroy', function () {
removeEvent(chart, 'resize', setInvert);
});
// Do it now
setInvert(); // do it now
// On subsequent render and redraw, just do setInvert without setting up events again
series.invertGroups = setInvert;
} | javascript | function () {
var series = this,
chart = series.chart;
// Pie, go away (#1736)
if (!series.xAxis) {
return;
}
// A fixed size is needed for inversion to work
function setInvert() {
var size = {
width: series.yAxis.len,
height: series.xAxis.len
};
each(['group', 'markerGroup'], function (groupName) {
if (series[groupName]) {
series[groupName].attr(size).invert();
}
});
}
addEvent(chart, 'resize', setInvert); // do it on resize
addEvent(series, 'destroy', function () {
removeEvent(chart, 'resize', setInvert);
});
// Do it now
setInvert(); // do it now
// On subsequent render and redraw, just do setInvert without setting up events again
series.invertGroups = setInvert;
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"chart",
"=",
"series",
".",
"chart",
";",
"// Pie, go away (#1736)",
"if",
"(",
"!",
"series",
".",
"xAxis",
")",
"{",
"return",
";",
"}",
"// A fixed size is needed for inversion to work",
"function",
"setInvert",
"(",
")",
"{",
"var",
"size",
"=",
"{",
"width",
":",
"series",
".",
"yAxis",
".",
"len",
",",
"height",
":",
"series",
".",
"xAxis",
".",
"len",
"}",
";",
"each",
"(",
"[",
"'group'",
",",
"'markerGroup'",
"]",
",",
"function",
"(",
"groupName",
")",
"{",
"if",
"(",
"series",
"[",
"groupName",
"]",
")",
"{",
"series",
"[",
"groupName",
"]",
".",
"attr",
"(",
"size",
")",
".",
"invert",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"addEvent",
"(",
"chart",
",",
"'resize'",
",",
"setInvert",
")",
";",
"// do it on resize",
"addEvent",
"(",
"series",
",",
"'destroy'",
",",
"function",
"(",
")",
"{",
"removeEvent",
"(",
"chart",
",",
"'resize'",
",",
"setInvert",
")",
";",
"}",
")",
";",
"// Do it now",
"setInvert",
"(",
")",
";",
"// do it now",
"// On subsequent render and redraw, just do setInvert without setting up events again",
"series",
".",
"invertGroups",
"=",
"setInvert",
";",
"}"
] | Initialize and perform group inversion on series.group and series.markerGroup | [
"Initialize",
"and",
"perform",
"group",
"inversion",
"on",
"series",
".",
"group",
"and",
"series",
".",
"markerGroup"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14808-L14841 | |
23,533 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | setInvert | function setInvert() {
var size = {
width: series.yAxis.len,
height: series.xAxis.len
};
each(['group', 'markerGroup'], function (groupName) {
if (series[groupName]) {
series[groupName].attr(size).invert();
}
});
} | javascript | function setInvert() {
var size = {
width: series.yAxis.len,
height: series.xAxis.len
};
each(['group', 'markerGroup'], function (groupName) {
if (series[groupName]) {
series[groupName].attr(size).invert();
}
});
} | [
"function",
"setInvert",
"(",
")",
"{",
"var",
"size",
"=",
"{",
"width",
":",
"series",
".",
"yAxis",
".",
"len",
",",
"height",
":",
"series",
".",
"xAxis",
".",
"len",
"}",
";",
"each",
"(",
"[",
"'group'",
",",
"'markerGroup'",
"]",
",",
"function",
"(",
"groupName",
")",
"{",
"if",
"(",
"series",
"[",
"groupName",
"]",
")",
"{",
"series",
"[",
"groupName",
"]",
".",
"attr",
"(",
"size",
")",
".",
"invert",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | A fixed size is needed for inversion to work | [
"A",
"fixed",
"size",
"is",
"needed",
"for",
"inversion",
"to",
"work"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14818-L14829 |
23,534 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (prop, name, visibility, zIndex, parent) {
var group = this[prop],
isNew = !group;
// Generate it on first call
if (isNew) {
this[prop] = group = this.chart.renderer.g(name)
.attr({
visibility: visibility,
zIndex: zIndex || 0.1 // IE8 needs this
})
.add(parent);
}
// Place it on first and subsequent (redraw) calls
group[isNew ? 'attr' : 'animate'](this.getPlotBox());
return group;
} | javascript | function (prop, name, visibility, zIndex, parent) {
var group = this[prop],
isNew = !group;
// Generate it on first call
if (isNew) {
this[prop] = group = this.chart.renderer.g(name)
.attr({
visibility: visibility,
zIndex: zIndex || 0.1 // IE8 needs this
})
.add(parent);
}
// Place it on first and subsequent (redraw) calls
group[isNew ? 'attr' : 'animate'](this.getPlotBox());
return group;
} | [
"function",
"(",
"prop",
",",
"name",
",",
"visibility",
",",
"zIndex",
",",
"parent",
")",
"{",
"var",
"group",
"=",
"this",
"[",
"prop",
"]",
",",
"isNew",
"=",
"!",
"group",
";",
"// Generate it on first call",
"if",
"(",
"isNew",
")",
"{",
"this",
"[",
"prop",
"]",
"=",
"group",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"g",
"(",
"name",
")",
".",
"attr",
"(",
"{",
"visibility",
":",
"visibility",
",",
"zIndex",
":",
"zIndex",
"||",
"0.1",
"// IE8 needs this",
"}",
")",
".",
"add",
"(",
"parent",
")",
";",
"}",
"// Place it on first and subsequent (redraw) calls",
"group",
"[",
"isNew",
"?",
"'attr'",
":",
"'animate'",
"]",
"(",
"this",
".",
"getPlotBox",
"(",
")",
")",
";",
"return",
"group",
";",
"}"
] | General abstraction for creating plot groups like series.group, series.dataLabelsGroup and
series.markerGroup. On subsequent calls, the group will only be adjusted to the updated plot size. | [
"General",
"abstraction",
"for",
"creating",
"plot",
"groups",
"like",
"series",
".",
"group",
"series",
".",
"dataLabelsGroup",
"and",
"series",
".",
"markerGroup",
".",
"On",
"subsequent",
"calls",
"the",
"group",
"will",
"only",
"be",
"adjusted",
"to",
"the",
"updated",
"plot",
"size",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L14847-L14863 | |
23,535 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (path, segment, translatedThreshold) {
path.push(
L,
segment[segment.length - 1].plotX,
translatedThreshold,
L,
segment[0].plotX,
translatedThreshold
);
} | javascript | function (path, segment, translatedThreshold) {
path.push(
L,
segment[segment.length - 1].plotX,
translatedThreshold,
L,
segment[0].plotX,
translatedThreshold
);
} | [
"function",
"(",
"path",
",",
"segment",
",",
"translatedThreshold",
")",
"{",
"path",
".",
"push",
"(",
"L",
",",
"segment",
"[",
"segment",
".",
"length",
"-",
"1",
"]",
".",
"plotX",
",",
"translatedThreshold",
",",
"L",
",",
"segment",
"[",
"0",
"]",
".",
"plotX",
",",
"translatedThreshold",
")",
";",
"}"
] | Extendable method to close the segment path of an area. This is overridden in polar
charts. | [
"Extendable",
"method",
"to",
"close",
"the",
"segment",
"path",
"of",
"an",
"area",
".",
"This",
"is",
"overridden",
"in",
"polar",
"charts",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L15359-L15368 | |
23,536 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
// Define or reset areaPath
this.areaPath = [];
// Call the base method
Series.prototype.drawGraph.apply(this);
// Define local variables
var series = this,
areaPath = this.areaPath,
options = this.options,
negativeColor = options.negativeColor,
negativeFillColor = options.negativeFillColor,
props = [['area', this.color, options.fillColor]]; // area name, main color, fill color
if (negativeColor || negativeFillColor) {
props.push(['areaNeg', negativeColor, negativeFillColor]);
}
each(props, function (prop) {
var areaKey = prop[0],
area = series[areaKey];
// Create or update the area
if (area) { // update
area.animate({ d: areaPath });
} else { // create
series[areaKey] = series.chart.renderer.path(areaPath)
.attr({
fill: pick(
prop[2],
Color(prop[1]).setOpacity(pick(options.fillOpacity, 0.75)).get()
),
zIndex: 0 // #1069
}).add(series.group);
}
});
} | javascript | function () {
// Define or reset areaPath
this.areaPath = [];
// Call the base method
Series.prototype.drawGraph.apply(this);
// Define local variables
var series = this,
areaPath = this.areaPath,
options = this.options,
negativeColor = options.negativeColor,
negativeFillColor = options.negativeFillColor,
props = [['area', this.color, options.fillColor]]; // area name, main color, fill color
if (negativeColor || negativeFillColor) {
props.push(['areaNeg', negativeColor, negativeFillColor]);
}
each(props, function (prop) {
var areaKey = prop[0],
area = series[areaKey];
// Create or update the area
if (area) { // update
area.animate({ d: areaPath });
} else { // create
series[areaKey] = series.chart.renderer.path(areaPath)
.attr({
fill: pick(
prop[2],
Color(prop[1]).setOpacity(pick(options.fillOpacity, 0.75)).get()
),
zIndex: 0 // #1069
}).add(series.group);
}
});
} | [
"function",
"(",
")",
"{",
"// Define or reset areaPath",
"this",
".",
"areaPath",
"=",
"[",
"]",
";",
"// Call the base method",
"Series",
".",
"prototype",
".",
"drawGraph",
".",
"apply",
"(",
"this",
")",
";",
"// Define local variables",
"var",
"series",
"=",
"this",
",",
"areaPath",
"=",
"this",
".",
"areaPath",
",",
"options",
"=",
"this",
".",
"options",
",",
"negativeColor",
"=",
"options",
".",
"negativeColor",
",",
"negativeFillColor",
"=",
"options",
".",
"negativeFillColor",
",",
"props",
"=",
"[",
"[",
"'area'",
",",
"this",
".",
"color",
",",
"options",
".",
"fillColor",
"]",
"]",
";",
"// area name, main color, fill color",
"if",
"(",
"negativeColor",
"||",
"negativeFillColor",
")",
"{",
"props",
".",
"push",
"(",
"[",
"'areaNeg'",
",",
"negativeColor",
",",
"negativeFillColor",
"]",
")",
";",
"}",
"each",
"(",
"props",
",",
"function",
"(",
"prop",
")",
"{",
"var",
"areaKey",
"=",
"prop",
"[",
"0",
"]",
",",
"area",
"=",
"series",
"[",
"areaKey",
"]",
";",
"// Create or update the area",
"if",
"(",
"area",
")",
"{",
"// update",
"area",
".",
"animate",
"(",
"{",
"d",
":",
"areaPath",
"}",
")",
";",
"}",
"else",
"{",
"// create",
"series",
"[",
"areaKey",
"]",
"=",
"series",
".",
"chart",
".",
"renderer",
".",
"path",
"(",
"areaPath",
")",
".",
"attr",
"(",
"{",
"fill",
":",
"pick",
"(",
"prop",
"[",
"2",
"]",
",",
"Color",
"(",
"prop",
"[",
"1",
"]",
")",
".",
"setOpacity",
"(",
"pick",
"(",
"options",
".",
"fillOpacity",
",",
"0.75",
")",
")",
".",
"get",
"(",
")",
")",
",",
"zIndex",
":",
"0",
"// #1069",
"}",
")",
".",
"add",
"(",
"series",
".",
"group",
")",
";",
"}",
"}",
")",
";",
"}"
] | Draw the graph and the underlying area. This method calls the Series base
function and adds the area. The areaPath is calculated in the getSegmentPath
method called from Series.prototype.drawGraph. | [
"Draw",
"the",
"graph",
"and",
"the",
"underlying",
"area",
".",
"This",
"method",
"calls",
"the",
"Series",
"base",
"function",
"and",
"adds",
"the",
"area",
".",
"The",
"areaPath",
"is",
"calculated",
"in",
"the",
"getSegmentPath",
"method",
"called",
"from",
"Series",
".",
"prototype",
".",
"drawGraph",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L15375-L15414 | |
23,537 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
options = series.options,
xAxis = series.xAxis,
yAxis = series.yAxis,
reversedXAxis = xAxis.reversed,
stackKey,
stackGroups = {},
columnIndex,
columnCount = 0;
// Get the total number of column type series.
// This is called on every series. Consider moving this logic to a
// chart.orderStacks() function and call it on init, addSeries and removeSeries
if (options.grouping === false) {
columnCount = 1;
} else {
each(series.chart.series, function (otherSeries) {
var otherOptions = otherSeries.options,
otherYAxis = otherSeries.yAxis;
if (otherSeries.type === series.type && otherSeries.visible &&
yAxis.len === otherYAxis.len && yAxis.pos === otherYAxis.pos) { // #642, #2086
if (otherOptions.stacking) {
stackKey = otherSeries.stackKey;
if (stackGroups[stackKey] === UNDEFINED) {
stackGroups[stackKey] = columnCount++;
}
columnIndex = stackGroups[stackKey];
} else if (otherOptions.grouping !== false) { // #1162
columnIndex = columnCount++;
}
otherSeries.columnIndex = columnIndex;
}
});
}
var categoryWidth = mathMin(
mathAbs(xAxis.transA) * (xAxis.ordinalSlope || options.pointRange || xAxis.closestPointRange || 1),
xAxis.len // #1535
),
groupPadding = categoryWidth * options.groupPadding,
groupWidth = categoryWidth - 2 * groupPadding,
pointOffsetWidth = groupWidth / columnCount,
optionPointWidth = options.pointWidth,
pointPadding = defined(optionPointWidth) ? (pointOffsetWidth - optionPointWidth) / 2 :
pointOffsetWidth * options.pointPadding,
pointWidth = pick(optionPointWidth, pointOffsetWidth - 2 * pointPadding), // exact point width, used in polar charts
colIndex = (reversedXAxis ?
columnCount - (series.columnIndex || 0) : // #1251
series.columnIndex) || 0,
pointXOffset = pointPadding + (groupPadding + colIndex *
pointOffsetWidth - (categoryWidth / 2)) *
(reversedXAxis ? -1 : 1);
// Save it for reading in linked series (Error bars particularly)
return (series.columnMetrics = {
width: pointWidth,
offset: pointXOffset
});
} | javascript | function () {
var series = this,
options = series.options,
xAxis = series.xAxis,
yAxis = series.yAxis,
reversedXAxis = xAxis.reversed,
stackKey,
stackGroups = {},
columnIndex,
columnCount = 0;
// Get the total number of column type series.
// This is called on every series. Consider moving this logic to a
// chart.orderStacks() function and call it on init, addSeries and removeSeries
if (options.grouping === false) {
columnCount = 1;
} else {
each(series.chart.series, function (otherSeries) {
var otherOptions = otherSeries.options,
otherYAxis = otherSeries.yAxis;
if (otherSeries.type === series.type && otherSeries.visible &&
yAxis.len === otherYAxis.len && yAxis.pos === otherYAxis.pos) { // #642, #2086
if (otherOptions.stacking) {
stackKey = otherSeries.stackKey;
if (stackGroups[stackKey] === UNDEFINED) {
stackGroups[stackKey] = columnCount++;
}
columnIndex = stackGroups[stackKey];
} else if (otherOptions.grouping !== false) { // #1162
columnIndex = columnCount++;
}
otherSeries.columnIndex = columnIndex;
}
});
}
var categoryWidth = mathMin(
mathAbs(xAxis.transA) * (xAxis.ordinalSlope || options.pointRange || xAxis.closestPointRange || 1),
xAxis.len // #1535
),
groupPadding = categoryWidth * options.groupPadding,
groupWidth = categoryWidth - 2 * groupPadding,
pointOffsetWidth = groupWidth / columnCount,
optionPointWidth = options.pointWidth,
pointPadding = defined(optionPointWidth) ? (pointOffsetWidth - optionPointWidth) / 2 :
pointOffsetWidth * options.pointPadding,
pointWidth = pick(optionPointWidth, pointOffsetWidth - 2 * pointPadding), // exact point width, used in polar charts
colIndex = (reversedXAxis ?
columnCount - (series.columnIndex || 0) : // #1251
series.columnIndex) || 0,
pointXOffset = pointPadding + (groupPadding + colIndex *
pointOffsetWidth - (categoryWidth / 2)) *
(reversedXAxis ? -1 : 1);
// Save it for reading in linked series (Error bars particularly)
return (series.columnMetrics = {
width: pointWidth,
offset: pointXOffset
});
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"options",
"=",
"series",
".",
"options",
",",
"xAxis",
"=",
"series",
".",
"xAxis",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"reversedXAxis",
"=",
"xAxis",
".",
"reversed",
",",
"stackKey",
",",
"stackGroups",
"=",
"{",
"}",
",",
"columnIndex",
",",
"columnCount",
"=",
"0",
";",
"// Get the total number of column type series.",
"// This is called on every series. Consider moving this logic to a",
"// chart.orderStacks() function and call it on init, addSeries and removeSeries",
"if",
"(",
"options",
".",
"grouping",
"===",
"false",
")",
"{",
"columnCount",
"=",
"1",
";",
"}",
"else",
"{",
"each",
"(",
"series",
".",
"chart",
".",
"series",
",",
"function",
"(",
"otherSeries",
")",
"{",
"var",
"otherOptions",
"=",
"otherSeries",
".",
"options",
",",
"otherYAxis",
"=",
"otherSeries",
".",
"yAxis",
";",
"if",
"(",
"otherSeries",
".",
"type",
"===",
"series",
".",
"type",
"&&",
"otherSeries",
".",
"visible",
"&&",
"yAxis",
".",
"len",
"===",
"otherYAxis",
".",
"len",
"&&",
"yAxis",
".",
"pos",
"===",
"otherYAxis",
".",
"pos",
")",
"{",
"// #642, #2086",
"if",
"(",
"otherOptions",
".",
"stacking",
")",
"{",
"stackKey",
"=",
"otherSeries",
".",
"stackKey",
";",
"if",
"(",
"stackGroups",
"[",
"stackKey",
"]",
"===",
"UNDEFINED",
")",
"{",
"stackGroups",
"[",
"stackKey",
"]",
"=",
"columnCount",
"++",
";",
"}",
"columnIndex",
"=",
"stackGroups",
"[",
"stackKey",
"]",
";",
"}",
"else",
"if",
"(",
"otherOptions",
".",
"grouping",
"!==",
"false",
")",
"{",
"// #1162",
"columnIndex",
"=",
"columnCount",
"++",
";",
"}",
"otherSeries",
".",
"columnIndex",
"=",
"columnIndex",
";",
"}",
"}",
")",
";",
"}",
"var",
"categoryWidth",
"=",
"mathMin",
"(",
"mathAbs",
"(",
"xAxis",
".",
"transA",
")",
"*",
"(",
"xAxis",
".",
"ordinalSlope",
"||",
"options",
".",
"pointRange",
"||",
"xAxis",
".",
"closestPointRange",
"||",
"1",
")",
",",
"xAxis",
".",
"len",
"// #1535",
")",
",",
"groupPadding",
"=",
"categoryWidth",
"*",
"options",
".",
"groupPadding",
",",
"groupWidth",
"=",
"categoryWidth",
"-",
"2",
"*",
"groupPadding",
",",
"pointOffsetWidth",
"=",
"groupWidth",
"/",
"columnCount",
",",
"optionPointWidth",
"=",
"options",
".",
"pointWidth",
",",
"pointPadding",
"=",
"defined",
"(",
"optionPointWidth",
")",
"?",
"(",
"pointOffsetWidth",
"-",
"optionPointWidth",
")",
"/",
"2",
":",
"pointOffsetWidth",
"*",
"options",
".",
"pointPadding",
",",
"pointWidth",
"=",
"pick",
"(",
"optionPointWidth",
",",
"pointOffsetWidth",
"-",
"2",
"*",
"pointPadding",
")",
",",
"// exact point width, used in polar charts",
"colIndex",
"=",
"(",
"reversedXAxis",
"?",
"columnCount",
"-",
"(",
"series",
".",
"columnIndex",
"||",
"0",
")",
":",
"// #1251",
"series",
".",
"columnIndex",
")",
"||",
"0",
",",
"pointXOffset",
"=",
"pointPadding",
"+",
"(",
"groupPadding",
"+",
"colIndex",
"*",
"pointOffsetWidth",
"-",
"(",
"categoryWidth",
"/",
"2",
")",
")",
"*",
"(",
"reversedXAxis",
"?",
"-",
"1",
":",
"1",
")",
";",
"// Save it for reading in linked series (Error bars particularly)",
"return",
"(",
"series",
".",
"columnMetrics",
"=",
"{",
"width",
":",
"pointWidth",
",",
"offset",
":",
"pointXOffset",
"}",
")",
";",
"}"
] | Return the width and x offset of the columns adjusted for grouping, groupPadding, pointPadding,
pointWidth etc. | [
"Return",
"the",
"width",
"and",
"x",
"offset",
"of",
"the",
"columns",
"adjusted",
"for",
"grouping",
"groupPadding",
"pointPadding",
"pointWidth",
"etc",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L15659-L15720 | |
23,538 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
chart = series.chart,
pointer = chart.pointer,
cursor = series.options.cursor,
css = cursor && { cursor: cursor },
onMouseOver = function (e) {
var target = e.target,
point;
if (chart.hoverSeries !== series) {
series.onMouseOver();
}
while (target && !point) {
point = target.point;
target = target.parentNode;
}
if (point !== UNDEFINED && point !== chart.hoverPoint) { // undefined on graph in scatterchart
point.onMouseOver(e);
}
};
// Add reference to the point
each(series.points, function (point) {
if (point.graphic) {
point.graphic.element.point = point;
}
if (point.dataLabel) {
point.dataLabel.element.point = point;
}
});
// Add the event listeners, we need to do this only once
if (!series._hasTracking) {
each(series.trackerGroups, function (key) {
if (series[key]) { // we don't always have dataLabelsGroup
series[key]
.addClass(PREFIX + 'tracker')
.on('mouseover', onMouseOver)
.on('mouseout', function (e) { pointer.onTrackerMouseOut(e); })
.css(css);
if (hasTouch) {
series[key].on('touchstart', onMouseOver);
}
}
});
series._hasTracking = true;
}
} | javascript | function () {
var series = this,
chart = series.chart,
pointer = chart.pointer,
cursor = series.options.cursor,
css = cursor && { cursor: cursor },
onMouseOver = function (e) {
var target = e.target,
point;
if (chart.hoverSeries !== series) {
series.onMouseOver();
}
while (target && !point) {
point = target.point;
target = target.parentNode;
}
if (point !== UNDEFINED && point !== chart.hoverPoint) { // undefined on graph in scatterchart
point.onMouseOver(e);
}
};
// Add reference to the point
each(series.points, function (point) {
if (point.graphic) {
point.graphic.element.point = point;
}
if (point.dataLabel) {
point.dataLabel.element.point = point;
}
});
// Add the event listeners, we need to do this only once
if (!series._hasTracking) {
each(series.trackerGroups, function (key) {
if (series[key]) { // we don't always have dataLabelsGroup
series[key]
.addClass(PREFIX + 'tracker')
.on('mouseover', onMouseOver)
.on('mouseout', function (e) { pointer.onTrackerMouseOut(e); })
.css(css);
if (hasTouch) {
series[key].on('touchstart', onMouseOver);
}
}
});
series._hasTracking = true;
}
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"chart",
"=",
"series",
".",
"chart",
",",
"pointer",
"=",
"chart",
".",
"pointer",
",",
"cursor",
"=",
"series",
".",
"options",
".",
"cursor",
",",
"css",
"=",
"cursor",
"&&",
"{",
"cursor",
":",
"cursor",
"}",
",",
"onMouseOver",
"=",
"function",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
",",
"point",
";",
"if",
"(",
"chart",
".",
"hoverSeries",
"!==",
"series",
")",
"{",
"series",
".",
"onMouseOver",
"(",
")",
";",
"}",
"while",
"(",
"target",
"&&",
"!",
"point",
")",
"{",
"point",
"=",
"target",
".",
"point",
";",
"target",
"=",
"target",
".",
"parentNode",
";",
"}",
"if",
"(",
"point",
"!==",
"UNDEFINED",
"&&",
"point",
"!==",
"chart",
".",
"hoverPoint",
")",
"{",
"// undefined on graph in scatterchart",
"point",
".",
"onMouseOver",
"(",
"e",
")",
";",
"}",
"}",
";",
"// Add reference to the point",
"each",
"(",
"series",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"if",
"(",
"point",
".",
"graphic",
")",
"{",
"point",
".",
"graphic",
".",
"element",
".",
"point",
"=",
"point",
";",
"}",
"if",
"(",
"point",
".",
"dataLabel",
")",
"{",
"point",
".",
"dataLabel",
".",
"element",
".",
"point",
"=",
"point",
";",
"}",
"}",
")",
";",
"// Add the event listeners, we need to do this only once",
"if",
"(",
"!",
"series",
".",
"_hasTracking",
")",
"{",
"each",
"(",
"series",
".",
"trackerGroups",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"series",
"[",
"key",
"]",
")",
"{",
"// we don't always have dataLabelsGroup",
"series",
"[",
"key",
"]",
".",
"addClass",
"(",
"PREFIX",
"+",
"'tracker'",
")",
".",
"on",
"(",
"'mouseover'",
",",
"onMouseOver",
")",
".",
"on",
"(",
"'mouseout'",
",",
"function",
"(",
"e",
")",
"{",
"pointer",
".",
"onTrackerMouseOut",
"(",
"e",
")",
";",
"}",
")",
".",
"css",
"(",
"css",
")",
";",
"if",
"(",
"hasTouch",
")",
"{",
"series",
"[",
"key",
"]",
".",
"on",
"(",
"'touchstart'",
",",
"onMouseOver",
")",
";",
"}",
"}",
"}",
")",
";",
"series",
".",
"_hasTracking",
"=",
"true",
";",
"}",
"}"
] | Add tracking event listener to the series group, so the point graphics
themselves act as trackers | [
"Add",
"tracking",
"event",
"listener",
"to",
"the",
"series",
"group",
"so",
"the",
"point",
"graphics",
"themselves",
"act",
"as",
"trackers"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L15863-L15911 | |
23,539 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var series = this,
chart = series.chart;
// column and bar series affects other series of the same type
// as they are either stacked or grouped
if (chart.hasRendered) {
each(chart.series, function (otherSeries) {
if (otherSeries.type === series.type) {
otherSeries.isDirty = true;
}
});
}
Series.prototype.remove.apply(series, arguments);
} | javascript | function () {
var series = this,
chart = series.chart;
// column and bar series affects other series of the same type
// as they are either stacked or grouped
if (chart.hasRendered) {
each(chart.series, function (otherSeries) {
if (otherSeries.type === series.type) {
otherSeries.isDirty = true;
}
});
}
Series.prototype.remove.apply(series, arguments);
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"chart",
"=",
"series",
".",
"chart",
";",
"// column and bar series affects other series of the same type",
"// as they are either stacked or grouped",
"if",
"(",
"chart",
".",
"hasRendered",
")",
"{",
"each",
"(",
"chart",
".",
"series",
",",
"function",
"(",
"otherSeries",
")",
"{",
"if",
"(",
"otherSeries",
".",
"type",
"===",
"series",
".",
"type",
")",
"{",
"otherSeries",
".",
"isDirty",
"=",
"true",
";",
"}",
"}",
")",
";",
"}",
"Series",
".",
"prototype",
".",
"remove",
".",
"apply",
"(",
"series",
",",
"arguments",
")",
";",
"}"
] | Remove this series from the chart | [
"Remove",
"this",
"series",
"from",
"the",
"chart"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16001-L16016 | |
23,540 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (init) {
var series = this,
points = series.points,
startAngleRad = series.startAngleRad;
if (!init) {
each(points, function (point) {
var graphic = point.graphic,
args = point.shapeArgs;
if (graphic) {
// start values
graphic.attr({
r: series.center[3] / 2, // animate from inner radius (#779)
start: startAngleRad,
end: startAngleRad
});
// animate
graphic.animate({
r: args.r,
start: args.start,
end: args.end
}, series.options.animation);
}
});
// delete this function to allow it only once
series.animate = null;
}
} | javascript | function (init) {
var series = this,
points = series.points,
startAngleRad = series.startAngleRad;
if (!init) {
each(points, function (point) {
var graphic = point.graphic,
args = point.shapeArgs;
if (graphic) {
// start values
graphic.attr({
r: series.center[3] / 2, // animate from inner radius (#779)
start: startAngleRad,
end: startAngleRad
});
// animate
graphic.animate({
r: args.r,
start: args.start,
end: args.end
}, series.options.animation);
}
});
// delete this function to allow it only once
series.animate = null;
}
} | [
"function",
"(",
"init",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
",",
"startAngleRad",
"=",
"series",
".",
"startAngleRad",
";",
"if",
"(",
"!",
"init",
")",
"{",
"each",
"(",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"graphic",
"=",
"point",
".",
"graphic",
",",
"args",
"=",
"point",
".",
"shapeArgs",
";",
"if",
"(",
"graphic",
")",
"{",
"// start values",
"graphic",
".",
"attr",
"(",
"{",
"r",
":",
"series",
".",
"center",
"[",
"3",
"]",
"/",
"2",
",",
"// animate from inner radius (#779)",
"start",
":",
"startAngleRad",
",",
"end",
":",
"startAngleRad",
"}",
")",
";",
"// animate",
"graphic",
".",
"animate",
"(",
"{",
"r",
":",
"args",
".",
"r",
",",
"start",
":",
"args",
".",
"start",
",",
"end",
":",
"args",
".",
"end",
"}",
",",
"series",
".",
"options",
".",
"animation",
")",
";",
"}",
"}",
")",
";",
"// delete this function to allow it only once",
"series",
".",
"animate",
"=",
"null",
";",
"}",
"}"
] | Animate the pies in | [
"Animate",
"the",
"pies",
"in"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16230-L16260 | |
23,541 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (data, redraw) {
Series.prototype.setData.call(this, data, false);
this.processData();
this.generatePoints();
if (pick(redraw, true)) {
this.chart.redraw();
}
} | javascript | function (data, redraw) {
Series.prototype.setData.call(this, data, false);
this.processData();
this.generatePoints();
if (pick(redraw, true)) {
this.chart.redraw();
}
} | [
"function",
"(",
"data",
",",
"redraw",
")",
"{",
"Series",
".",
"prototype",
".",
"setData",
".",
"call",
"(",
"this",
",",
"data",
",",
"false",
")",
";",
"this",
".",
"processData",
"(",
")",
";",
"this",
".",
"generatePoints",
"(",
")",
";",
"if",
"(",
"pick",
"(",
"redraw",
",",
"true",
")",
")",
"{",
"this",
".",
"chart",
".",
"redraw",
"(",
")",
";",
"}",
"}"
] | Extend the basic setData method by running processData and generatePoints immediately,
in order to access the points from the legend. | [
"Extend",
"the",
"basic",
"setData",
"method",
"by",
"running",
"processData",
"and",
"generatePoints",
"immediately",
"in",
"order",
"to",
"access",
"the",
"points",
"from",
"the",
"legend",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16266-L16273 | |
23,542 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
var i,
total = 0,
points,
len,
point,
ignoreHiddenPoint = this.options.ignoreHiddenPoint;
Series.prototype.generatePoints.call(this);
// Populate local vars
points = this.points;
len = points.length;
// Get the total sum
for (i = 0; i < len; i++) {
point = points[i];
total += (ignoreHiddenPoint && !point.visible) ? 0 : point.y;
}
this.total = total;
// Set each point's properties
for (i = 0; i < len; i++) {
point = points[i];
point.percentage = total > 0 ? (point.y / total) * 100 : 0;
point.total = total;
}
} | javascript | function () {
var i,
total = 0,
points,
len,
point,
ignoreHiddenPoint = this.options.ignoreHiddenPoint;
Series.prototype.generatePoints.call(this);
// Populate local vars
points = this.points;
len = points.length;
// Get the total sum
for (i = 0; i < len; i++) {
point = points[i];
total += (ignoreHiddenPoint && !point.visible) ? 0 : point.y;
}
this.total = total;
// Set each point's properties
for (i = 0; i < len; i++) {
point = points[i];
point.percentage = total > 0 ? (point.y / total) * 100 : 0;
point.total = total;
}
} | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"total",
"=",
"0",
",",
"points",
",",
"len",
",",
"point",
",",
"ignoreHiddenPoint",
"=",
"this",
".",
"options",
".",
"ignoreHiddenPoint",
";",
"Series",
".",
"prototype",
".",
"generatePoints",
".",
"call",
"(",
"this",
")",
";",
"// Populate local vars",
"points",
"=",
"this",
".",
"points",
";",
"len",
"=",
"points",
".",
"length",
";",
"// Get the total sum",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"point",
"=",
"points",
"[",
"i",
"]",
";",
"total",
"+=",
"(",
"ignoreHiddenPoint",
"&&",
"!",
"point",
".",
"visible",
")",
"?",
"0",
":",
"point",
".",
"y",
";",
"}",
"this",
".",
"total",
"=",
"total",
";",
"// Set each point's properties",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"point",
"=",
"points",
"[",
"i",
"]",
";",
"point",
".",
"percentage",
"=",
"total",
">",
"0",
"?",
"(",
"point",
".",
"y",
"/",
"total",
")",
"*",
"100",
":",
"0",
";",
"point",
".",
"total",
"=",
"total",
";",
"}",
"}"
] | Extend the generatePoints method by adding total and percentage properties to each point | [
"Extend",
"the",
"generatePoints",
"method",
"by",
"adding",
"total",
"and",
"percentage",
"properties",
"to",
"each",
"point"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16278-L16306 | |
23,543 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | 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 = mathMin(plotWidth, plotHeight),
isPercent;
return map(positions, function (length, i) {
isPercent = /%$/.test(length);
handleSlicingRoom = i < 2 || (i === 2 && isPercent);
return (isPercent ?
// i == 0: centerX, relative to width
// i == 1: centerY, relative to height
// i == 2: size, relative to smallestSize
// i == 4: innerSize, relative to smallestSize
[plotWidth, plotHeight, smallestSize, smallestSize][i] *
pInt(length) / 100 :
length) + (handleSlicingRoom ? slicingRoom : 0);
});
} | javascript | 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 = mathMin(plotWidth, plotHeight),
isPercent;
return map(positions, function (length, i) {
isPercent = /%$/.test(length);
handleSlicingRoom = i < 2 || (i === 2 && isPercent);
return (isPercent ?
// i == 0: centerX, relative to width
// i == 1: centerY, relative to height
// i == 2: size, relative to smallestSize
// i == 4: innerSize, relative to smallestSize
[plotWidth, plotHeight, smallestSize, smallestSize][i] *
pInt(length) / 100 :
length) + (handleSlicingRoom ? slicingRoom : 0);
});
} | [
"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",
"=",
"mathMin",
"(",
"plotWidth",
",",
"plotHeight",
")",
",",
"isPercent",
";",
"return",
"map",
"(",
"positions",
",",
"function",
"(",
"length",
",",
"i",
")",
"{",
"isPercent",
"=",
"/",
"%$",
"/",
".",
"test",
"(",
"length",
")",
";",
"handleSlicingRoom",
"=",
"i",
"<",
"2",
"||",
"(",
"i",
"===",
"2",
"&&",
"isPercent",
")",
";",
"return",
"(",
"isPercent",
"?",
"// i == 0: centerX, relative to width",
"// i == 1: centerY, relative to height",
"// i == 2: size, relative to smallestSize",
"// i == 4: innerSize, relative to smallestSize",
"[",
"plotWidth",
",",
"plotHeight",
",",
"smallestSize",
",",
"smallestSize",
"]",
"[",
"i",
"]",
"*",
"pInt",
"(",
"length",
")",
"/",
"100",
":",
"length",
")",
"+",
"(",
"handleSlicingRoom",
"?",
"slicingRoom",
":",
"0",
")",
";",
"}",
")",
";",
"}"
] | 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. | [
"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",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16312-L16337 | |
23,544 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function (points, sign) {
points.sort(function (a, b) {
return a.angle !== undefined && (b.angle - a.angle) * sign;
});
} | javascript | function (points, sign) {
points.sort(function (a, b) {
return a.angle !== undefined && (b.angle - a.angle) * sign;
});
} | [
"function",
"(",
"points",
",",
"sign",
")",
"{",
"points",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"angle",
"!==",
"undefined",
"&&",
"(",
"b",
".",
"angle",
"-",
"a",
".",
"angle",
")",
"*",
"sign",
";",
"}",
")",
";",
"}"
] | Utility for sorting data labels | [
"Utility",
"for",
"sorting",
"data",
"labels"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16519-L16523 | |
23,545 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/highcharts.src.js | function () {
each(this.points, function (point) {
var dataLabel = point.dataLabel,
_pos;
if (dataLabel) {
_pos = dataLabel._pos;
if (_pos) {
dataLabel.attr(dataLabel._attr);
dataLabel[dataLabel.moved ? 'animate' : 'attr'](_pos);
dataLabel.moved = true;
} else if (dataLabel) {
dataLabel.attr({ y: -999 });
}
}
});
} | javascript | function () {
each(this.points, function (point) {
var dataLabel = point.dataLabel,
_pos;
if (dataLabel) {
_pos = dataLabel._pos;
if (_pos) {
dataLabel.attr(dataLabel._attr);
dataLabel[dataLabel.moved ? 'animate' : 'attr'](_pos);
dataLabel.moved = true;
} else if (dataLabel) {
dataLabel.attr({ y: -999 });
}
}
});
} | [
"function",
"(",
")",
"{",
"each",
"(",
"this",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"dataLabel",
"=",
"point",
".",
"dataLabel",
",",
"_pos",
";",
"if",
"(",
"dataLabel",
")",
"{",
"_pos",
"=",
"dataLabel",
".",
"_pos",
";",
"if",
"(",
"_pos",
")",
"{",
"dataLabel",
".",
"attr",
"(",
"dataLabel",
".",
"_attr",
")",
";",
"dataLabel",
"[",
"dataLabel",
".",
"moved",
"?",
"'animate'",
":",
"'attr'",
"]",
"(",
"_pos",
")",
";",
"dataLabel",
".",
"moved",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"dataLabel",
")",
"{",
"dataLabel",
".",
"attr",
"(",
"{",
"y",
":",
"-",
"999",
"}",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Perform the final placement of the data labels after we have verified that they
fall within the plot area. | [
"Perform",
"the",
"final",
"placement",
"of",
"the",
"data",
"labels",
"after",
"we",
"have",
"verified",
"that",
"they",
"fall",
"within",
"the",
"plot",
"area",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/highcharts.src.js#L16884-L16900 | |
23,546 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js | function(viewPort) {
if (!that.hasValue()) return 0;
var s = that.value+'';
if (s.match(/em$/)) return that.numValue() * this.EM(viewPort);
if (s.match(/ex$/)) return that.numValue() * this.EM(viewPort) / 2.0;
if (s.match(/px$/)) return that.numValue();
if (s.match(/pt$/)) return that.numValue() * 1.25;
if (s.match(/pc$/)) return that.numValue() * 15;
if (s.match(/cm$/)) return that.numValue() * this.DPI(viewPort) / 2.54;
if (s.match(/mm$/)) return that.numValue() * this.DPI(viewPort) / 25.4;
if (s.match(/in$/)) return that.numValue() * this.DPI(viewPort);
if (s.match(/%$/)) return that.numValue() * svg.ViewPort.ComputeSize(viewPort);
return that.numValue();
} | javascript | function(viewPort) {
if (!that.hasValue()) return 0;
var s = that.value+'';
if (s.match(/em$/)) return that.numValue() * this.EM(viewPort);
if (s.match(/ex$/)) return that.numValue() * this.EM(viewPort) / 2.0;
if (s.match(/px$/)) return that.numValue();
if (s.match(/pt$/)) return that.numValue() * 1.25;
if (s.match(/pc$/)) return that.numValue() * 15;
if (s.match(/cm$/)) return that.numValue() * this.DPI(viewPort) / 2.54;
if (s.match(/mm$/)) return that.numValue() * this.DPI(viewPort) / 25.4;
if (s.match(/in$/)) return that.numValue() * this.DPI(viewPort);
if (s.match(/%$/)) return that.numValue() * svg.ViewPort.ComputeSize(viewPort);
return that.numValue();
} | [
"function",
"(",
"viewPort",
")",
"{",
"if",
"(",
"!",
"that",
".",
"hasValue",
"(",
")",
")",
"return",
"0",
";",
"var",
"s",
"=",
"that",
".",
"value",
"+",
"''",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"em$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"this",
".",
"EM",
"(",
"viewPort",
")",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"ex$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"this",
".",
"EM",
"(",
"viewPort",
")",
"/",
"2.0",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"px$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"pt$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"1.25",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"pc$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"15",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"cm$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"this",
".",
"DPI",
"(",
"viewPort",
")",
"/",
"2.54",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"mm$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"this",
".",
"DPI",
"(",
"viewPort",
")",
"/",
"25.4",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"in$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"this",
".",
"DPI",
"(",
"viewPort",
")",
";",
"if",
"(",
"s",
".",
"match",
"(",
"/",
"%$",
"/",
")",
")",
"return",
"that",
".",
"numValue",
"(",
")",
"*",
"svg",
".",
"ViewPort",
".",
"ComputeSize",
"(",
"viewPort",
")",
";",
"return",
"that",
".",
"numValue",
"(",
")",
";",
"}"
] | get the length as pixels | [
"get",
"the",
"length",
"as",
"pixels"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js#L549-L562 | |
23,547 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js | function (chart) {
var renderer = this,
options = chart.options.tooltip,
borderWidth = options.borderWidth,
tooltipDiv = renderer.ttDiv,
tooltipDivStyle = options.style,
tooltipLine = renderer.ttLine,
padding = parseInt(tooltipDivStyle.padding, 10);
// Add border styling from options to the style
tooltipDivStyle = merge(tooltipDivStyle, {
padding: padding + PX,
'background-color': options.backgroundColor,
'border-style': 'solid',
'border-width': borderWidth + PX,
'border-radius': options.borderRadius + PX
});
// Optionally add shadow
if (options.shadow) {
tooltipDivStyle = merge(tooltipDivStyle, {
'box-shadow': '1px 1px 3px gray', // w3c
'-webkit-box-shadow': '1px 1px 3px gray' // webkit
});
}
css(tooltipDiv, tooltipDivStyle);
// Set simple style on the line
css(tooltipLine, {
'border-left': '1px solid darkgray'
});
// This event is triggered when a new tooltip should be shown
addEvent(chart, 'tooltipRefresh', function (args) {
var chartContainer = chart.container,
offsetLeft = chartContainer.offsetLeft,
offsetTop = chartContainer.offsetTop,
position;
// Set the content of the tooltip
tooltipDiv.innerHTML = args.text;
// Compute the best position for the tooltip based on the divs size and container size.
position = chart.tooltip.getPosition(tooltipDiv.offsetWidth, tooltipDiv.offsetHeight, {plotX: args.x, plotY: args.y});
css(tooltipDiv, {
visibility: VISIBLE,
left: position.x + PX,
top: position.y + PX,
'border-color': args.borderColor
});
// Position the tooltip line
css(tooltipLine, {
visibility: VISIBLE,
left: offsetLeft + args.x + PX,
top: offsetTop + chart.plotTop + PX,
height: chart.plotHeight + PX
});
// This timeout hides the tooltip after 3 seconds
// First clear any existing timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Start a new timer that hides tooltip and line
renderer.ttTimer = setTimeout(function () {
css(tooltipDiv, { visibility: HIDDEN });
css(tooltipLine, { visibility: HIDDEN });
}, 3000);
});
} | javascript | function (chart) {
var renderer = this,
options = chart.options.tooltip,
borderWidth = options.borderWidth,
tooltipDiv = renderer.ttDiv,
tooltipDivStyle = options.style,
tooltipLine = renderer.ttLine,
padding = parseInt(tooltipDivStyle.padding, 10);
// Add border styling from options to the style
tooltipDivStyle = merge(tooltipDivStyle, {
padding: padding + PX,
'background-color': options.backgroundColor,
'border-style': 'solid',
'border-width': borderWidth + PX,
'border-radius': options.borderRadius + PX
});
// Optionally add shadow
if (options.shadow) {
tooltipDivStyle = merge(tooltipDivStyle, {
'box-shadow': '1px 1px 3px gray', // w3c
'-webkit-box-shadow': '1px 1px 3px gray' // webkit
});
}
css(tooltipDiv, tooltipDivStyle);
// Set simple style on the line
css(tooltipLine, {
'border-left': '1px solid darkgray'
});
// This event is triggered when a new tooltip should be shown
addEvent(chart, 'tooltipRefresh', function (args) {
var chartContainer = chart.container,
offsetLeft = chartContainer.offsetLeft,
offsetTop = chartContainer.offsetTop,
position;
// Set the content of the tooltip
tooltipDiv.innerHTML = args.text;
// Compute the best position for the tooltip based on the divs size and container size.
position = chart.tooltip.getPosition(tooltipDiv.offsetWidth, tooltipDiv.offsetHeight, {plotX: args.x, plotY: args.y});
css(tooltipDiv, {
visibility: VISIBLE,
left: position.x + PX,
top: position.y + PX,
'border-color': args.borderColor
});
// Position the tooltip line
css(tooltipLine, {
visibility: VISIBLE,
left: offsetLeft + args.x + PX,
top: offsetTop + chart.plotTop + PX,
height: chart.plotHeight + PX
});
// This timeout hides the tooltip after 3 seconds
// First clear any existing timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Start a new timer that hides tooltip and line
renderer.ttTimer = setTimeout(function () {
css(tooltipDiv, { visibility: HIDDEN });
css(tooltipLine, { visibility: HIDDEN });
}, 3000);
});
} | [
"function",
"(",
"chart",
")",
"{",
"var",
"renderer",
"=",
"this",
",",
"options",
"=",
"chart",
".",
"options",
".",
"tooltip",
",",
"borderWidth",
"=",
"options",
".",
"borderWidth",
",",
"tooltipDiv",
"=",
"renderer",
".",
"ttDiv",
",",
"tooltipDivStyle",
"=",
"options",
".",
"style",
",",
"tooltipLine",
"=",
"renderer",
".",
"ttLine",
",",
"padding",
"=",
"parseInt",
"(",
"tooltipDivStyle",
".",
"padding",
",",
"10",
")",
";",
"// Add border styling from options to the style",
"tooltipDivStyle",
"=",
"merge",
"(",
"tooltipDivStyle",
",",
"{",
"padding",
":",
"padding",
"+",
"PX",
",",
"'background-color'",
":",
"options",
".",
"backgroundColor",
",",
"'border-style'",
":",
"'solid'",
",",
"'border-width'",
":",
"borderWidth",
"+",
"PX",
",",
"'border-radius'",
":",
"options",
".",
"borderRadius",
"+",
"PX",
"}",
")",
";",
"// Optionally add shadow",
"if",
"(",
"options",
".",
"shadow",
")",
"{",
"tooltipDivStyle",
"=",
"merge",
"(",
"tooltipDivStyle",
",",
"{",
"'box-shadow'",
":",
"'1px 1px 3px gray'",
",",
"// w3c",
"'-webkit-box-shadow'",
":",
"'1px 1px 3px gray'",
"// webkit",
"}",
")",
";",
"}",
"css",
"(",
"tooltipDiv",
",",
"tooltipDivStyle",
")",
";",
"// Set simple style on the line",
"css",
"(",
"tooltipLine",
",",
"{",
"'border-left'",
":",
"'1px solid darkgray'",
"}",
")",
";",
"// This event is triggered when a new tooltip should be shown",
"addEvent",
"(",
"chart",
",",
"'tooltipRefresh'",
",",
"function",
"(",
"args",
")",
"{",
"var",
"chartContainer",
"=",
"chart",
".",
"container",
",",
"offsetLeft",
"=",
"chartContainer",
".",
"offsetLeft",
",",
"offsetTop",
"=",
"chartContainer",
".",
"offsetTop",
",",
"position",
";",
"// Set the content of the tooltip",
"tooltipDiv",
".",
"innerHTML",
"=",
"args",
".",
"text",
";",
"// Compute the best position for the tooltip based on the divs size and container size.",
"position",
"=",
"chart",
".",
"tooltip",
".",
"getPosition",
"(",
"tooltipDiv",
".",
"offsetWidth",
",",
"tooltipDiv",
".",
"offsetHeight",
",",
"{",
"plotX",
":",
"args",
".",
"x",
",",
"plotY",
":",
"args",
".",
"y",
"}",
")",
";",
"css",
"(",
"tooltipDiv",
",",
"{",
"visibility",
":",
"VISIBLE",
",",
"left",
":",
"position",
".",
"x",
"+",
"PX",
",",
"top",
":",
"position",
".",
"y",
"+",
"PX",
",",
"'border-color'",
":",
"args",
".",
"borderColor",
"}",
")",
";",
"// Position the tooltip line",
"css",
"(",
"tooltipLine",
",",
"{",
"visibility",
":",
"VISIBLE",
",",
"left",
":",
"offsetLeft",
"+",
"args",
".",
"x",
"+",
"PX",
",",
"top",
":",
"offsetTop",
"+",
"chart",
".",
"plotTop",
"+",
"PX",
",",
"height",
":",
"chart",
".",
"plotHeight",
"+",
"PX",
"}",
")",
";",
"// This timeout hides the tooltip after 3 seconds",
"// First clear any existing timer",
"if",
"(",
"renderer",
".",
"ttTimer",
"!==",
"UNDEFINED",
")",
"{",
"clearTimeout",
"(",
"renderer",
".",
"ttTimer",
")",
";",
"}",
"// Start a new timer that hides tooltip and line",
"renderer",
".",
"ttTimer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"css",
"(",
"tooltipDiv",
",",
"{",
"visibility",
":",
"HIDDEN",
"}",
")",
";",
"css",
"(",
"tooltipLine",
",",
"{",
"visibility",
":",
"HIDDEN",
"}",
")",
";",
"}",
",",
"3000",
")",
";",
"}",
")",
";",
"}"
] | Configures the renderer with the chart. Attach a listener to the event tooltipRefresh. | [
"Configures",
"the",
"renderer",
"with",
"the",
"chart",
".",
"Attach",
"a",
"listener",
"to",
"the",
"event",
"tooltipRefresh",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js#L2993-L3065 | |
23,548 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js | function () {
var renderer = this;
// Remove the canvas
discardElement(renderer.canvas);
// Kill the timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Remove the divs for tooltip and line
discardElement(renderer.ttLine);
discardElement(renderer.ttDiv);
discardElement(renderer.hiddenSvg);
// Continue with base class
return SVGRenderer.prototype.destroy.apply(renderer);
} | javascript | function () {
var renderer = this;
// Remove the canvas
discardElement(renderer.canvas);
// Kill the timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Remove the divs for tooltip and line
discardElement(renderer.ttLine);
discardElement(renderer.ttDiv);
discardElement(renderer.hiddenSvg);
// Continue with base class
return SVGRenderer.prototype.destroy.apply(renderer);
} | [
"function",
"(",
")",
"{",
"var",
"renderer",
"=",
"this",
";",
"// Remove the canvas",
"discardElement",
"(",
"renderer",
".",
"canvas",
")",
";",
"// Kill the timer",
"if",
"(",
"renderer",
".",
"ttTimer",
"!==",
"UNDEFINED",
")",
"{",
"clearTimeout",
"(",
"renderer",
".",
"ttTimer",
")",
";",
"}",
"// Remove the divs for tooltip and line",
"discardElement",
"(",
"renderer",
".",
"ttLine",
")",
";",
"discardElement",
"(",
"renderer",
".",
"ttDiv",
")",
";",
"discardElement",
"(",
"renderer",
".",
"hiddenSvg",
")",
";",
"// Continue with base class",
"return",
"SVGRenderer",
".",
"prototype",
".",
"destroy",
".",
"apply",
"(",
"renderer",
")",
";",
"}"
] | Extend SVGRenderer.destroy to also destroy the elements added by CanVGRenderer. | [
"Extend",
"SVGRenderer",
".",
"destroy",
"to",
"also",
"destroy",
"the",
"elements",
"added",
"by",
"CanVGRenderer",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/canvas-tools.src.js#L3070-L3088 | |
23,549 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js | function (pathAnim) {
var fxProto = Fx.prototype,
fxStart = fxProto.start,
morphProto = Fx.Morph.prototype,
morphCompute = morphProto.compute;
// override Fx.start to allow animation of SVG element wrappers
/*jslint unparam: true*//* allow unused parameters in fx functions */
fxProto.start = function (from, to) {
var fx = this,
elem = fx.element;
// special for animating paths
if (from.d) {
//this.fromD = this.element.d.split(' ');
fx.paths = pathAnim.init(
elem,
elem.d,
fx.toD
);
}
fxStart.apply(fx, arguments);
return this; // chainable
};
// override Fx.step to allow animation of SVG element wrappers
morphProto.compute = function (from, to, delta) {
var fx = this,
paths = fx.paths;
if (paths) {
fx.element.attr(
'd',
pathAnim.step(paths[0], paths[1], delta, fx.toD)
);
} else {
return morphCompute.apply(fx, arguments);
}
};
/*jslint unparam: false*/
} | javascript | function (pathAnim) {
var fxProto = Fx.prototype,
fxStart = fxProto.start,
morphProto = Fx.Morph.prototype,
morphCompute = morphProto.compute;
// override Fx.start to allow animation of SVG element wrappers
/*jslint unparam: true*//* allow unused parameters in fx functions */
fxProto.start = function (from, to) {
var fx = this,
elem = fx.element;
// special for animating paths
if (from.d) {
//this.fromD = this.element.d.split(' ');
fx.paths = pathAnim.init(
elem,
elem.d,
fx.toD
);
}
fxStart.apply(fx, arguments);
return this; // chainable
};
// override Fx.step to allow animation of SVG element wrappers
morphProto.compute = function (from, to, delta) {
var fx = this,
paths = fx.paths;
if (paths) {
fx.element.attr(
'd',
pathAnim.step(paths[0], paths[1], delta, fx.toD)
);
} else {
return morphCompute.apply(fx, arguments);
}
};
/*jslint unparam: false*/
} | [
"function",
"(",
"pathAnim",
")",
"{",
"var",
"fxProto",
"=",
"Fx",
".",
"prototype",
",",
"fxStart",
"=",
"fxProto",
".",
"start",
",",
"morphProto",
"=",
"Fx",
".",
"Morph",
".",
"prototype",
",",
"morphCompute",
"=",
"morphProto",
".",
"compute",
";",
"// override Fx.start to allow animation of SVG element wrappers",
"/*jslint unparam: true*/",
"/* allow unused parameters in fx functions */",
"fxProto",
".",
"start",
"=",
"function",
"(",
"from",
",",
"to",
")",
"{",
"var",
"fx",
"=",
"this",
",",
"elem",
"=",
"fx",
".",
"element",
";",
"// special for animating paths",
"if",
"(",
"from",
".",
"d",
")",
"{",
"//this.fromD = this.element.d.split(' ');",
"fx",
".",
"paths",
"=",
"pathAnim",
".",
"init",
"(",
"elem",
",",
"elem",
".",
"d",
",",
"fx",
".",
"toD",
")",
";",
"}",
"fxStart",
".",
"apply",
"(",
"fx",
",",
"arguments",
")",
";",
"return",
"this",
";",
"// chainable",
"}",
";",
"// override Fx.step to allow animation of SVG element wrappers",
"morphProto",
".",
"compute",
"=",
"function",
"(",
"from",
",",
"to",
",",
"delta",
")",
"{",
"var",
"fx",
"=",
"this",
",",
"paths",
"=",
"fx",
".",
"paths",
";",
"if",
"(",
"paths",
")",
"{",
"fx",
".",
"element",
".",
"attr",
"(",
"'d'",
",",
"pathAnim",
".",
"step",
"(",
"paths",
"[",
"0",
"]",
",",
"paths",
"[",
"1",
"]",
",",
"delta",
",",
"fx",
".",
"toD",
")",
")",
";",
"}",
"else",
"{",
"return",
"morphCompute",
".",
"apply",
"(",
"fx",
",",
"arguments",
")",
";",
"}",
"}",
";",
"/*jslint unparam: false*/",
"}"
] | Initialize the adapter. This is run once as Highcharts is first run.
@param {Object} pathAnim The helper object to do animations across adapters. | [
"Initialize",
"the",
"adapter",
".",
"This",
"is",
"run",
"once",
"as",
"Highcharts",
"is",
"first",
"run",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js#L29-L70 | |
23,550 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js | function (scriptLocation, callback) {
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
var head = doc.getElementsByTagName('head')[0];
var script = doc.createElement('script');
script.type = 'text/javascript';
script.src = scriptLocation;
script.onload = callback;
head.appendChild(script);
} | javascript | function (scriptLocation, callback) {
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
var head = doc.getElementsByTagName('head')[0];
var script = doc.createElement('script');
script.type = 'text/javascript';
script.src = scriptLocation;
script.onload = callback;
head.appendChild(script);
} | [
"function",
"(",
"scriptLocation",
",",
"callback",
")",
"{",
"// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.",
"var",
"head",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
";",
"var",
"script",
"=",
"doc",
".",
"createElement",
"(",
"'script'",
")",
";",
"script",
".",
"type",
"=",
"'text/javascript'",
";",
"script",
".",
"src",
"=",
"scriptLocation",
";",
"script",
".",
"onload",
"=",
"callback",
";",
"head",
".",
"appendChild",
"(",
"script",
")",
";",
"}"
] | Downloads a script and executes a callback when done.
@param {String} scriptLocation
@param {Function} callback | [
"Downloads",
"a",
"script",
"and",
"executes",
"a",
"callback",
"when",
"done",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js#L91-L101 | |
23,551 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js | function (el) {
var offsets = el.getPosition(); // #1496
return {
left: offsets.x,
top: offsets.y
};
} | javascript | function (el) {
var offsets = el.getPosition(); // #1496
return {
left: offsets.x,
top: offsets.y
};
} | [
"function",
"(",
"el",
")",
"{",
"var",
"offsets",
"=",
"el",
".",
"getPosition",
"(",
")",
";",
"// #1496",
"return",
"{",
"left",
":",
"offsets",
".",
"x",
",",
"top",
":",
"offsets",
".",
"y",
"}",
";",
"}"
] | Get the offset of an element relative to the top left corner of the web page | [
"Get",
"the",
"offset",
"of",
"an",
"element",
"relative",
"to",
"the",
"top",
"left",
"corner",
"of",
"the",
"web",
"page"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js#L196-L202 | |
23,552 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (e) {
var chart = this.chart;
e = this.normalize(e);
if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
chart.mapZoom(
0.5,
chart.xAxis[0].toValue(e.chartX),
chart.yAxis[0].toValue(e.chartY)
);
}
} | javascript | function (e) {
var chart = this.chart;
e = this.normalize(e);
if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
chart.mapZoom(
0.5,
chart.xAxis[0].toValue(e.chartX),
chart.yAxis[0].toValue(e.chartY)
);
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"chart",
"=",
"this",
".",
"chart",
";",
"e",
"=",
"this",
".",
"normalize",
"(",
"e",
")",
";",
"if",
"(",
"chart",
".",
"isInsidePlot",
"(",
"e",
".",
"chartX",
"-",
"chart",
".",
"plotLeft",
",",
"e",
".",
"chartY",
"-",
"chart",
".",
"plotTop",
")",
")",
"{",
"chart",
".",
"mapZoom",
"(",
"0.5",
",",
"chart",
".",
"xAxis",
"[",
"0",
"]",
".",
"toValue",
"(",
"e",
".",
"chartX",
")",
",",
"chart",
".",
"yAxis",
"[",
"0",
"]",
".",
"toValue",
"(",
"e",
".",
"chartY",
")",
")",
";",
"}",
"}"
] | The event handler for the doubleclick event | [
"The",
"event",
"handler",
"for",
"the",
"doubleclick",
"event"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L216-L228 | |
23,553 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (inner, outer) {
each([['x', 'width'], ['y', 'height']], function (dim) {
var pos = dim[0],
size = dim[1];
if (inner[pos] + inner[size] > outer[pos] + outer[size]) { // right overflow
if (inner[size] > outer[size]) { // the general size is greater, fit fully to outer
inner[size] = outer[size];
inner[pos] = outer[pos];
} else { // align right
inner[pos] = outer[pos] + outer[size] - inner[size];
}
}
if (inner[size] > outer[size]) {
inner[size] = outer[size];
}
if (inner[pos] < outer[pos]) {
inner[pos] = outer[pos];
}
});
return inner;
} | javascript | function (inner, outer) {
each([['x', 'width'], ['y', 'height']], function (dim) {
var pos = dim[0],
size = dim[1];
if (inner[pos] + inner[size] > outer[pos] + outer[size]) { // right overflow
if (inner[size] > outer[size]) { // the general size is greater, fit fully to outer
inner[size] = outer[size];
inner[pos] = outer[pos];
} else { // align right
inner[pos] = outer[pos] + outer[size] - inner[size];
}
}
if (inner[size] > outer[size]) {
inner[size] = outer[size];
}
if (inner[pos] < outer[pos]) {
inner[pos] = outer[pos];
}
});
return inner;
} | [
"function",
"(",
"inner",
",",
"outer",
")",
"{",
"each",
"(",
"[",
"[",
"'x'",
",",
"'width'",
"]",
",",
"[",
"'y'",
",",
"'height'",
"]",
"]",
",",
"function",
"(",
"dim",
")",
"{",
"var",
"pos",
"=",
"dim",
"[",
"0",
"]",
",",
"size",
"=",
"dim",
"[",
"1",
"]",
";",
"if",
"(",
"inner",
"[",
"pos",
"]",
"+",
"inner",
"[",
"size",
"]",
">",
"outer",
"[",
"pos",
"]",
"+",
"outer",
"[",
"size",
"]",
")",
"{",
"// right overflow",
"if",
"(",
"inner",
"[",
"size",
"]",
">",
"outer",
"[",
"size",
"]",
")",
"{",
"// the general size is greater, fit fully to outer",
"inner",
"[",
"size",
"]",
"=",
"outer",
"[",
"size",
"]",
";",
"inner",
"[",
"pos",
"]",
"=",
"outer",
"[",
"pos",
"]",
";",
"}",
"else",
"{",
"// align right",
"inner",
"[",
"pos",
"]",
"=",
"outer",
"[",
"pos",
"]",
"+",
"outer",
"[",
"size",
"]",
"-",
"inner",
"[",
"size",
"]",
";",
"}",
"}",
"if",
"(",
"inner",
"[",
"size",
"]",
">",
"outer",
"[",
"size",
"]",
")",
"{",
"inner",
"[",
"size",
"]",
"=",
"outer",
"[",
"size",
"]",
";",
"}",
"if",
"(",
"inner",
"[",
"pos",
"]",
"<",
"outer",
"[",
"pos",
"]",
")",
"{",
"inner",
"[",
"pos",
"]",
"=",
"outer",
"[",
"pos",
"]",
";",
"}",
"}",
")",
";",
"return",
"inner",
";",
"}"
] | Fit an inner box to an outer. If the inner box overflows left or right, align it to the sides of the
outer. If it overflows both sides, fit it within the outer. This is a pattern that occurs more places
in Highcharts, perhaps it should be elevated to a common utility function. | [
"Fit",
"an",
"inner",
"box",
"to",
"an",
"outer",
".",
"If",
"the",
"inner",
"box",
"overflows",
"left",
"or",
"right",
"align",
"it",
"to",
"the",
"sides",
"of",
"the",
"outer",
".",
"If",
"it",
"overflows",
"both",
"sides",
"fit",
"it",
"within",
"the",
"outer",
".",
"This",
"is",
"a",
"pattern",
"that",
"occurs",
"more",
"places",
"in",
"Highcharts",
"perhaps",
"it",
"should",
"be",
"elevated",
"to",
"a",
"common",
"utility",
"function",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L299-L321 | |
23,554 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (howMuch, centerXArg, centerYArg) {
if (this.isMapZooming) {
return;
}
var chart = this,
xAxis = chart.xAxis[0],
xRange = xAxis.max - xAxis.min,
centerX = pick(centerXArg, xAxis.min + xRange / 2),
newXRange = xRange * howMuch,
yAxis = chart.yAxis[0],
yRange = yAxis.max - yAxis.min,
centerY = pick(centerYArg, yAxis.min + yRange / 2),
newYRange = yRange * howMuch,
newXMin = centerX - newXRange / 2,
newYMin = centerY - newYRange / 2,
animation = pick(chart.options.chart.animation, true),
delay,
newExt = chart.fitToBox({
x: newXMin,
y: newYMin,
width: newXRange,
height: newYRange
}, {
x: xAxis.dataMin,
y: yAxis.dataMin,
width: xAxis.dataMax - xAxis.dataMin,
height: yAxis.dataMax - yAxis.dataMin
});
xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
// Prevent zooming until this one is finished animating
delay = animation ? animation.duration || 500 : 0;
if (delay) {
chart.isMapZooming = true;
setTimeout(function () {
chart.isMapZooming = false;
}, delay);
}
chart.redraw();
} | javascript | function (howMuch, centerXArg, centerYArg) {
if (this.isMapZooming) {
return;
}
var chart = this,
xAxis = chart.xAxis[0],
xRange = xAxis.max - xAxis.min,
centerX = pick(centerXArg, xAxis.min + xRange / 2),
newXRange = xRange * howMuch,
yAxis = chart.yAxis[0],
yRange = yAxis.max - yAxis.min,
centerY = pick(centerYArg, yAxis.min + yRange / 2),
newYRange = yRange * howMuch,
newXMin = centerX - newXRange / 2,
newYMin = centerY - newYRange / 2,
animation = pick(chart.options.chart.animation, true),
delay,
newExt = chart.fitToBox({
x: newXMin,
y: newYMin,
width: newXRange,
height: newYRange
}, {
x: xAxis.dataMin,
y: yAxis.dataMin,
width: xAxis.dataMax - xAxis.dataMin,
height: yAxis.dataMax - yAxis.dataMin
});
xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
// Prevent zooming until this one is finished animating
delay = animation ? animation.duration || 500 : 0;
if (delay) {
chart.isMapZooming = true;
setTimeout(function () {
chart.isMapZooming = false;
}, delay);
}
chart.redraw();
} | [
"function",
"(",
"howMuch",
",",
"centerXArg",
",",
"centerYArg",
")",
"{",
"if",
"(",
"this",
".",
"isMapZooming",
")",
"{",
"return",
";",
"}",
"var",
"chart",
"=",
"this",
",",
"xAxis",
"=",
"chart",
".",
"xAxis",
"[",
"0",
"]",
",",
"xRange",
"=",
"xAxis",
".",
"max",
"-",
"xAxis",
".",
"min",
",",
"centerX",
"=",
"pick",
"(",
"centerXArg",
",",
"xAxis",
".",
"min",
"+",
"xRange",
"/",
"2",
")",
",",
"newXRange",
"=",
"xRange",
"*",
"howMuch",
",",
"yAxis",
"=",
"chart",
".",
"yAxis",
"[",
"0",
"]",
",",
"yRange",
"=",
"yAxis",
".",
"max",
"-",
"yAxis",
".",
"min",
",",
"centerY",
"=",
"pick",
"(",
"centerYArg",
",",
"yAxis",
".",
"min",
"+",
"yRange",
"/",
"2",
")",
",",
"newYRange",
"=",
"yRange",
"*",
"howMuch",
",",
"newXMin",
"=",
"centerX",
"-",
"newXRange",
"/",
"2",
",",
"newYMin",
"=",
"centerY",
"-",
"newYRange",
"/",
"2",
",",
"animation",
"=",
"pick",
"(",
"chart",
".",
"options",
".",
"chart",
".",
"animation",
",",
"true",
")",
",",
"delay",
",",
"newExt",
"=",
"chart",
".",
"fitToBox",
"(",
"{",
"x",
":",
"newXMin",
",",
"y",
":",
"newYMin",
",",
"width",
":",
"newXRange",
",",
"height",
":",
"newYRange",
"}",
",",
"{",
"x",
":",
"xAxis",
".",
"dataMin",
",",
"y",
":",
"yAxis",
".",
"dataMin",
",",
"width",
":",
"xAxis",
".",
"dataMax",
"-",
"xAxis",
".",
"dataMin",
",",
"height",
":",
"yAxis",
".",
"dataMax",
"-",
"yAxis",
".",
"dataMin",
"}",
")",
";",
"xAxis",
".",
"setExtremes",
"(",
"newExt",
".",
"x",
",",
"newExt",
".",
"x",
"+",
"newExt",
".",
"width",
",",
"false",
")",
";",
"yAxis",
".",
"setExtremes",
"(",
"newExt",
".",
"y",
",",
"newExt",
".",
"y",
"+",
"newExt",
".",
"height",
",",
"false",
")",
";",
"// Prevent zooming until this one is finished animating",
"delay",
"=",
"animation",
"?",
"animation",
".",
"duration",
"||",
"500",
":",
"0",
";",
"if",
"(",
"delay",
")",
"{",
"chart",
".",
"isMapZooming",
"=",
"true",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"chart",
".",
"isMapZooming",
"=",
"false",
";",
"}",
",",
"delay",
")",
";",
"}",
"chart",
".",
"redraw",
"(",
")",
";",
"}"
] | Zoom the map in or out by a certain amount. Less than 1 zooms in, greater than 1 zooms out. | [
"Zoom",
"the",
"map",
"in",
"or",
"out",
"by",
"a",
"certain",
"amount",
".",
"Less",
"than",
"1",
"zooms",
"in",
"greater",
"than",
"1",
"zooms",
"out",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L326-L370 | |
23,555 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (options, x) {
var point = Point.prototype.applyOptions.call(this, options, x);
if (point.path && typeof point.path === 'string') {
point.path = point.options.path = Highcharts.splitPath(point.path);
}
return point;
} | javascript | function (options, x) {
var point = Point.prototype.applyOptions.call(this, options, x);
if (point.path && typeof point.path === 'string') {
point.path = point.options.path = Highcharts.splitPath(point.path);
}
return point;
} | [
"function",
"(",
"options",
",",
"x",
")",
"{",
"var",
"point",
"=",
"Point",
".",
"prototype",
".",
"applyOptions",
".",
"call",
"(",
"this",
",",
"options",
",",
"x",
")",
";",
"if",
"(",
"point",
".",
"path",
"&&",
"typeof",
"point",
".",
"path",
"===",
"'string'",
")",
"{",
"point",
".",
"path",
"=",
"point",
".",
"options",
".",
"path",
"=",
"Highcharts",
".",
"splitPath",
"(",
"point",
".",
"path",
")",
";",
"}",
"return",
"point",
";",
"}"
] | Extend the Point object to split paths | [
"Extend",
"the",
"Point",
"object",
"to",
"split",
"paths"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L402-L411 | |
23,556 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function () {
var point = this,
start = +new Date(),
normalColor = Color(point.options.color),
hoverColor = Color(point.pointAttr.hover.fill),
animation = point.series.options.states.normal.animation,
duration = animation && (animation.duration || 500);
if (duration && normalColor.rgba.length === 4 && hoverColor.rgba.length === 4) {
delete point.pointAttr[''].fill; // avoid resetting it in Point.setState
clearTimeout(point.colorInterval);
point.colorInterval = setInterval(function () {
var pos = (new Date() - start) / duration,
graphic = point.graphic;
if (pos > 1) {
pos = 1;
}
if (graphic) {
graphic.attr('fill', tweenColors(hoverColor, normalColor, pos));
}
if (pos >= 1) {
clearTimeout(point.colorInterval);
}
}, 13);
}
Point.prototype.onMouseOut.call(point);
} | javascript | function () {
var point = this,
start = +new Date(),
normalColor = Color(point.options.color),
hoverColor = Color(point.pointAttr.hover.fill),
animation = point.series.options.states.normal.animation,
duration = animation && (animation.duration || 500);
if (duration && normalColor.rgba.length === 4 && hoverColor.rgba.length === 4) {
delete point.pointAttr[''].fill; // avoid resetting it in Point.setState
clearTimeout(point.colorInterval);
point.colorInterval = setInterval(function () {
var pos = (new Date() - start) / duration,
graphic = point.graphic;
if (pos > 1) {
pos = 1;
}
if (graphic) {
graphic.attr('fill', tweenColors(hoverColor, normalColor, pos));
}
if (pos >= 1) {
clearTimeout(point.colorInterval);
}
}, 13);
}
Point.prototype.onMouseOut.call(point);
} | [
"function",
"(",
")",
"{",
"var",
"point",
"=",
"this",
",",
"start",
"=",
"+",
"new",
"Date",
"(",
")",
",",
"normalColor",
"=",
"Color",
"(",
"point",
".",
"options",
".",
"color",
")",
",",
"hoverColor",
"=",
"Color",
"(",
"point",
".",
"pointAttr",
".",
"hover",
".",
"fill",
")",
",",
"animation",
"=",
"point",
".",
"series",
".",
"options",
".",
"states",
".",
"normal",
".",
"animation",
",",
"duration",
"=",
"animation",
"&&",
"(",
"animation",
".",
"duration",
"||",
"500",
")",
";",
"if",
"(",
"duration",
"&&",
"normalColor",
".",
"rgba",
".",
"length",
"===",
"4",
"&&",
"hoverColor",
".",
"rgba",
".",
"length",
"===",
"4",
")",
"{",
"delete",
"point",
".",
"pointAttr",
"[",
"''",
"]",
".",
"fill",
";",
"// avoid resetting it in Point.setState",
"clearTimeout",
"(",
"point",
".",
"colorInterval",
")",
";",
"point",
".",
"colorInterval",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"var",
"pos",
"=",
"(",
"new",
"Date",
"(",
")",
"-",
"start",
")",
"/",
"duration",
",",
"graphic",
"=",
"point",
".",
"graphic",
";",
"if",
"(",
"pos",
">",
"1",
")",
"{",
"pos",
"=",
"1",
";",
"}",
"if",
"(",
"graphic",
")",
"{",
"graphic",
".",
"attr",
"(",
"'fill'",
",",
"tweenColors",
"(",
"hoverColor",
",",
"normalColor",
",",
"pos",
")",
")",
";",
"}",
"if",
"(",
"pos",
">=",
"1",
")",
"{",
"clearTimeout",
"(",
"point",
".",
"colorInterval",
")",
";",
"}",
"}",
",",
"13",
")",
";",
"}",
"Point",
".",
"prototype",
".",
"onMouseOut",
".",
"call",
"(",
"point",
")",
";",
"}"
] | Custom animation for tweening out the colors. Animation reduces blinking when hovering
over islands and coast lines. We run a custom implementation of animation becuase we
need to be able to run this independently from other animations like zoom redraw. Also,
adding color animation to the adapters would introduce almost the same amount of code. | [
"Custom",
"animation",
"for",
"tweening",
"out",
"the",
"colors",
".",
"Animation",
"reduces",
"blinking",
"when",
"hovering",
"over",
"islands",
"and",
"coast",
"lines",
".",
"We",
"run",
"a",
"custom",
"implementation",
"of",
"animation",
"becuase",
"we",
"need",
"to",
"be",
"able",
"to",
"run",
"this",
"independently",
"from",
"other",
"animations",
"like",
"zoom",
"redraw",
".",
"Also",
"adding",
"color",
"animation",
"to",
"the",
"adapters",
"would",
"introduce",
"almost",
"the",
"same",
"amount",
"of",
"code",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L425-L452 | |
23,557 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (chart) {
var series = this,
valueDecimals = chart.options.legend.valueDecimals,
legendItems = [],
name,
from,
to,
fromLabel,
toLabel,
colorRange,
valueRanges,
gradientColor,
grad,
tmpLabel,
horizontal = chart.options.legend.layout === 'horizontal';
Highcharts.Series.prototype.init.apply(this, arguments);
colorRange = series.options.colorRange;
valueRanges = series.options.valueRanges;
if (valueRanges) {
each(valueRanges, function (range) {
from = range.from;
to = range.to;
// Assemble the default name. This can be overridden by legend.options.labelFormatter
name = '';
if (from === UNDEFINED) {
name = '< ';
} else if (to === UNDEFINED) {
name = '> ';
}
if (from !== UNDEFINED) {
name += numberFormat(from, valueDecimals);
}
if (from !== UNDEFINED && to !== UNDEFINED) {
name += ' - ';
}
if (to !== UNDEFINED) {
name += numberFormat(to, valueDecimals);
}
// Add a mock object to the legend items
legendItems.push(Highcharts.extend({
chart: series.chart,
name: name,
options: {},
drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
visible: true,
setState: function () {},
setVisible: function () {}
}, range));
});
series.legendItems = legendItems;
} else if (colorRange) {
from = colorRange.from;
to = colorRange.to;
fromLabel = colorRange.fromLabel;
toLabel = colorRange.toLabel;
// Flips linearGradient variables and label text.
grad = horizontal ? [0, 0, 1, 0] : [0, 1, 0, 0];
if (!horizontal) {
tmpLabel = fromLabel;
fromLabel = toLabel;
toLabel = tmpLabel;
}
// Creates color gradient.
gradientColor = {
linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
stops:
[
[0, from],
[1, to]
]
};
// Add a mock object to the legend items.
legendItems = [{
chart: series.chart,
options: {},
fromLabel: fromLabel,
toLabel: toLabel,
color: gradientColor,
drawLegendSymbol: this.drawLegendSymbolGradient,
visible: true,
setState: function () {},
setVisible: function () {}
}];
series.legendItems = legendItems;
}
} | javascript | function (chart) {
var series = this,
valueDecimals = chart.options.legend.valueDecimals,
legendItems = [],
name,
from,
to,
fromLabel,
toLabel,
colorRange,
valueRanges,
gradientColor,
grad,
tmpLabel,
horizontal = chart.options.legend.layout === 'horizontal';
Highcharts.Series.prototype.init.apply(this, arguments);
colorRange = series.options.colorRange;
valueRanges = series.options.valueRanges;
if (valueRanges) {
each(valueRanges, function (range) {
from = range.from;
to = range.to;
// Assemble the default name. This can be overridden by legend.options.labelFormatter
name = '';
if (from === UNDEFINED) {
name = '< ';
} else if (to === UNDEFINED) {
name = '> ';
}
if (from !== UNDEFINED) {
name += numberFormat(from, valueDecimals);
}
if (from !== UNDEFINED && to !== UNDEFINED) {
name += ' - ';
}
if (to !== UNDEFINED) {
name += numberFormat(to, valueDecimals);
}
// Add a mock object to the legend items
legendItems.push(Highcharts.extend({
chart: series.chart,
name: name,
options: {},
drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
visible: true,
setState: function () {},
setVisible: function () {}
}, range));
});
series.legendItems = legendItems;
} else if (colorRange) {
from = colorRange.from;
to = colorRange.to;
fromLabel = colorRange.fromLabel;
toLabel = colorRange.toLabel;
// Flips linearGradient variables and label text.
grad = horizontal ? [0, 0, 1, 0] : [0, 1, 0, 0];
if (!horizontal) {
tmpLabel = fromLabel;
fromLabel = toLabel;
toLabel = tmpLabel;
}
// Creates color gradient.
gradientColor = {
linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
stops:
[
[0, from],
[1, to]
]
};
// Add a mock object to the legend items.
legendItems = [{
chart: series.chart,
options: {},
fromLabel: fromLabel,
toLabel: toLabel,
color: gradientColor,
drawLegendSymbol: this.drawLegendSymbolGradient,
visible: true,
setState: function () {},
setVisible: function () {}
}];
series.legendItems = legendItems;
}
} | [
"function",
"(",
"chart",
")",
"{",
"var",
"series",
"=",
"this",
",",
"valueDecimals",
"=",
"chart",
".",
"options",
".",
"legend",
".",
"valueDecimals",
",",
"legendItems",
"=",
"[",
"]",
",",
"name",
",",
"from",
",",
"to",
",",
"fromLabel",
",",
"toLabel",
",",
"colorRange",
",",
"valueRanges",
",",
"gradientColor",
",",
"grad",
",",
"tmpLabel",
",",
"horizontal",
"=",
"chart",
".",
"options",
".",
"legend",
".",
"layout",
"===",
"'horizontal'",
";",
"Highcharts",
".",
"Series",
".",
"prototype",
".",
"init",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"colorRange",
"=",
"series",
".",
"options",
".",
"colorRange",
";",
"valueRanges",
"=",
"series",
".",
"options",
".",
"valueRanges",
";",
"if",
"(",
"valueRanges",
")",
"{",
"each",
"(",
"valueRanges",
",",
"function",
"(",
"range",
")",
"{",
"from",
"=",
"range",
".",
"from",
";",
"to",
"=",
"range",
".",
"to",
";",
"// Assemble the default name. This can be overridden by legend.options.labelFormatter",
"name",
"=",
"''",
";",
"if",
"(",
"from",
"===",
"UNDEFINED",
")",
"{",
"name",
"=",
"'< '",
";",
"}",
"else",
"if",
"(",
"to",
"===",
"UNDEFINED",
")",
"{",
"name",
"=",
"'> '",
";",
"}",
"if",
"(",
"from",
"!==",
"UNDEFINED",
")",
"{",
"name",
"+=",
"numberFormat",
"(",
"from",
",",
"valueDecimals",
")",
";",
"}",
"if",
"(",
"from",
"!==",
"UNDEFINED",
"&&",
"to",
"!==",
"UNDEFINED",
")",
"{",
"name",
"+=",
"' - '",
";",
"}",
"if",
"(",
"to",
"!==",
"UNDEFINED",
")",
"{",
"name",
"+=",
"numberFormat",
"(",
"to",
",",
"valueDecimals",
")",
";",
"}",
"// Add a mock object to the legend items",
"legendItems",
".",
"push",
"(",
"Highcharts",
".",
"extend",
"(",
"{",
"chart",
":",
"series",
".",
"chart",
",",
"name",
":",
"name",
",",
"options",
":",
"{",
"}",
",",
"drawLegendSymbol",
":",
"seriesTypes",
".",
"area",
".",
"prototype",
".",
"drawLegendSymbol",
",",
"visible",
":",
"true",
",",
"setState",
":",
"function",
"(",
")",
"{",
"}",
",",
"setVisible",
":",
"function",
"(",
")",
"{",
"}",
"}",
",",
"range",
")",
")",
";",
"}",
")",
";",
"series",
".",
"legendItems",
"=",
"legendItems",
";",
"}",
"else",
"if",
"(",
"colorRange",
")",
"{",
"from",
"=",
"colorRange",
".",
"from",
";",
"to",
"=",
"colorRange",
".",
"to",
";",
"fromLabel",
"=",
"colorRange",
".",
"fromLabel",
";",
"toLabel",
"=",
"colorRange",
".",
"toLabel",
";",
"// Flips linearGradient variables and label text.",
"grad",
"=",
"horizontal",
"?",
"[",
"0",
",",
"0",
",",
"1",
",",
"0",
"]",
":",
"[",
"0",
",",
"1",
",",
"0",
",",
"0",
"]",
";",
"if",
"(",
"!",
"horizontal",
")",
"{",
"tmpLabel",
"=",
"fromLabel",
";",
"fromLabel",
"=",
"toLabel",
";",
"toLabel",
"=",
"tmpLabel",
";",
"}",
"// Creates color gradient.",
"gradientColor",
"=",
"{",
"linearGradient",
":",
"{",
"x1",
":",
"grad",
"[",
"0",
"]",
",",
"y1",
":",
"grad",
"[",
"1",
"]",
",",
"x2",
":",
"grad",
"[",
"2",
"]",
",",
"y2",
":",
"grad",
"[",
"3",
"]",
"}",
",",
"stops",
":",
"[",
"[",
"0",
",",
"from",
"]",
",",
"[",
"1",
",",
"to",
"]",
"]",
"}",
";",
"// Add a mock object to the legend items.",
"legendItems",
"=",
"[",
"{",
"chart",
":",
"series",
".",
"chart",
",",
"options",
":",
"{",
"}",
",",
"fromLabel",
":",
"fromLabel",
",",
"toLabel",
":",
"toLabel",
",",
"color",
":",
"gradientColor",
",",
"drawLegendSymbol",
":",
"this",
".",
"drawLegendSymbolGradient",
",",
"visible",
":",
"true",
",",
"setState",
":",
"function",
"(",
")",
"{",
"}",
",",
"setVisible",
":",
"function",
"(",
")",
"{",
"}",
"}",
"]",
";",
"series",
".",
"legendItems",
"=",
"legendItems",
";",
"}",
"}"
] | get axis extremes from paths, not values | [
"get",
"axis",
"extremes",
"from",
"paths",
"not",
"values"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L472-L568 | |
23,558 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (legend, item) {
var spacing = legend.options.symbolPadding,
padding = pick(legend.options.padding, 8),
positionY,
positionX,
gradientSize = this.chart.renderer.fontMetrics(legend.options.itemStyle.fontSize).h,
horizontal = legend.options.layout === 'horizontal',
box1,
box2,
box3,
rectangleLength = pick(legend.options.rectangleLength, 200);
// Set local variables based on option.
if (horizontal) {
positionY = -(spacing / 2);
positionX = 0;
} else {
positionY = -rectangleLength + legend.baseline - (spacing / 2);
positionX = padding + gradientSize;
}
// Creates the from text.
item.fromText = this.chart.renderer.text(
item.fromLabel, // Text.
positionX, // Lower left x.
positionY // Lower left y.
).attr({
zIndex: 2
}).add(item.legendGroup);
box1 = item.fromText.getBBox();
// Creates legend symbol.
// Ternary changes variables based on option.
item.legendSymbol = this.chart.renderer.rect(
horizontal ? box1.x + box1.width + spacing : box1.x - gradientSize - spacing, // Upper left x.
box1.y, // Upper left y.
horizontal ? rectangleLength : gradientSize, // Width.
horizontal ? gradientSize : rectangleLength, // Height.
2 // Corner radius.
).attr({
zIndex: 1
}).add(item.legendGroup);
box2 = item.legendSymbol.getBBox();
// Creates the to text.
// Vertical coordinate changed based on option.
item.toText = this.chart.renderer.text(
item.toLabel,
box2.x + box2.width + spacing,
horizontal ? positionY : box2.y + box2.height - spacing
).attr({
zIndex: 2
}).add(item.legendGroup);
box3 = item.toText.getBBox();
// Changes legend box settings based on option.
if (horizontal) {
legend.offsetWidth = box1.width + box2.width + box3.width + (spacing * 2) + padding;
legend.itemY = gradientSize + padding;
} else {
legend.offsetWidth = Math.max(box1.width, box3.width) + (spacing) + box2.width + padding;
legend.itemY = box2.height + padding;
legend.itemX = spacing;
}
} | javascript | function (legend, item) {
var spacing = legend.options.symbolPadding,
padding = pick(legend.options.padding, 8),
positionY,
positionX,
gradientSize = this.chart.renderer.fontMetrics(legend.options.itemStyle.fontSize).h,
horizontal = legend.options.layout === 'horizontal',
box1,
box2,
box3,
rectangleLength = pick(legend.options.rectangleLength, 200);
// Set local variables based on option.
if (horizontal) {
positionY = -(spacing / 2);
positionX = 0;
} else {
positionY = -rectangleLength + legend.baseline - (spacing / 2);
positionX = padding + gradientSize;
}
// Creates the from text.
item.fromText = this.chart.renderer.text(
item.fromLabel, // Text.
positionX, // Lower left x.
positionY // Lower left y.
).attr({
zIndex: 2
}).add(item.legendGroup);
box1 = item.fromText.getBBox();
// Creates legend symbol.
// Ternary changes variables based on option.
item.legendSymbol = this.chart.renderer.rect(
horizontal ? box1.x + box1.width + spacing : box1.x - gradientSize - spacing, // Upper left x.
box1.y, // Upper left y.
horizontal ? rectangleLength : gradientSize, // Width.
horizontal ? gradientSize : rectangleLength, // Height.
2 // Corner radius.
).attr({
zIndex: 1
}).add(item.legendGroup);
box2 = item.legendSymbol.getBBox();
// Creates the to text.
// Vertical coordinate changed based on option.
item.toText = this.chart.renderer.text(
item.toLabel,
box2.x + box2.width + spacing,
horizontal ? positionY : box2.y + box2.height - spacing
).attr({
zIndex: 2
}).add(item.legendGroup);
box3 = item.toText.getBBox();
// Changes legend box settings based on option.
if (horizontal) {
legend.offsetWidth = box1.width + box2.width + box3.width + (spacing * 2) + padding;
legend.itemY = gradientSize + padding;
} else {
legend.offsetWidth = Math.max(box1.width, box3.width) + (spacing) + box2.width + padding;
legend.itemY = box2.height + padding;
legend.itemX = spacing;
}
} | [
"function",
"(",
"legend",
",",
"item",
")",
"{",
"var",
"spacing",
"=",
"legend",
".",
"options",
".",
"symbolPadding",
",",
"padding",
"=",
"pick",
"(",
"legend",
".",
"options",
".",
"padding",
",",
"8",
")",
",",
"positionY",
",",
"positionX",
",",
"gradientSize",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"fontMetrics",
"(",
"legend",
".",
"options",
".",
"itemStyle",
".",
"fontSize",
")",
".",
"h",
",",
"horizontal",
"=",
"legend",
".",
"options",
".",
"layout",
"===",
"'horizontal'",
",",
"box1",
",",
"box2",
",",
"box3",
",",
"rectangleLength",
"=",
"pick",
"(",
"legend",
".",
"options",
".",
"rectangleLength",
",",
"200",
")",
";",
"// Set local variables based on option.",
"if",
"(",
"horizontal",
")",
"{",
"positionY",
"=",
"-",
"(",
"spacing",
"/",
"2",
")",
";",
"positionX",
"=",
"0",
";",
"}",
"else",
"{",
"positionY",
"=",
"-",
"rectangleLength",
"+",
"legend",
".",
"baseline",
"-",
"(",
"spacing",
"/",
"2",
")",
";",
"positionX",
"=",
"padding",
"+",
"gradientSize",
";",
"}",
"// Creates the from text.",
"item",
".",
"fromText",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"text",
"(",
"item",
".",
"fromLabel",
",",
"// Text.",
"positionX",
",",
"// Lower left x.",
"positionY",
"// Lower left y.",
")",
".",
"attr",
"(",
"{",
"zIndex",
":",
"2",
"}",
")",
".",
"add",
"(",
"item",
".",
"legendGroup",
")",
";",
"box1",
"=",
"item",
".",
"fromText",
".",
"getBBox",
"(",
")",
";",
"// Creates legend symbol.",
"// Ternary changes variables based on option.",
"item",
".",
"legendSymbol",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"rect",
"(",
"horizontal",
"?",
"box1",
".",
"x",
"+",
"box1",
".",
"width",
"+",
"spacing",
":",
"box1",
".",
"x",
"-",
"gradientSize",
"-",
"spacing",
",",
"// Upper left x.",
"box1",
".",
"y",
",",
"// Upper left y.",
"horizontal",
"?",
"rectangleLength",
":",
"gradientSize",
",",
"// Width.",
"horizontal",
"?",
"gradientSize",
":",
"rectangleLength",
",",
"// Height.",
"2",
"// Corner radius.",
")",
".",
"attr",
"(",
"{",
"zIndex",
":",
"1",
"}",
")",
".",
"add",
"(",
"item",
".",
"legendGroup",
")",
";",
"box2",
"=",
"item",
".",
"legendSymbol",
".",
"getBBox",
"(",
")",
";",
"// Creates the to text.",
"// Vertical coordinate changed based on option.",
"item",
".",
"toText",
"=",
"this",
".",
"chart",
".",
"renderer",
".",
"text",
"(",
"item",
".",
"toLabel",
",",
"box2",
".",
"x",
"+",
"box2",
".",
"width",
"+",
"spacing",
",",
"horizontal",
"?",
"positionY",
":",
"box2",
".",
"y",
"+",
"box2",
".",
"height",
"-",
"spacing",
")",
".",
"attr",
"(",
"{",
"zIndex",
":",
"2",
"}",
")",
".",
"add",
"(",
"item",
".",
"legendGroup",
")",
";",
"box3",
"=",
"item",
".",
"toText",
".",
"getBBox",
"(",
")",
";",
"// Changes legend box settings based on option.",
"if",
"(",
"horizontal",
")",
"{",
"legend",
".",
"offsetWidth",
"=",
"box1",
".",
"width",
"+",
"box2",
".",
"width",
"+",
"box3",
".",
"width",
"+",
"(",
"spacing",
"*",
"2",
")",
"+",
"padding",
";",
"legend",
".",
"itemY",
"=",
"gradientSize",
"+",
"padding",
";",
"}",
"else",
"{",
"legend",
".",
"offsetWidth",
"=",
"Math",
".",
"max",
"(",
"box1",
".",
"width",
",",
"box3",
".",
"width",
")",
"+",
"(",
"spacing",
")",
"+",
"box2",
".",
"width",
"+",
"padding",
";",
"legend",
".",
"itemY",
"=",
"box2",
".",
"height",
"+",
"padding",
";",
"legend",
".",
"itemX",
"=",
"spacing",
";",
"}",
"}"
] | Gets the series' symbol in the legend and extended legend with more information.
@param {Object} legend The legend object
@param {Object} item The series (this) or point | [
"Gets",
"the",
"series",
"symbol",
"in",
"the",
"legend",
"and",
"extended",
"legend",
"with",
"more",
"information",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L581-L645 | |
23,559 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (paths) {
var maxX = Number.MIN_VALUE,
minX = Number.MAX_VALUE,
maxY = Number.MIN_VALUE,
minY = Number.MAX_VALUE;
// Find the bounding box
each(paths || this.options.data, function (point) {
var path = point.path,
i = path.length,
even = false, // while loop reads from the end
pointMaxX = Number.MIN_VALUE,
pointMinX = Number.MAX_VALUE,
pointMaxY = Number.MIN_VALUE,
pointMinY = Number.MAX_VALUE;
while (i--) {
if (typeof path[i] === 'number' && !isNaN(path[i])) {
if (even) { // even = x
pointMaxX = Math.max(pointMaxX, path[i]);
pointMinX = Math.min(pointMinX, path[i]);
} else { // odd = Y
pointMaxY = Math.max(pointMaxY, path[i]);
pointMinY = Math.min(pointMinY, path[i]);
}
even = !even;
}
}
// Cache point bounding box for use to position data labels
point._maxX = pointMaxX;
point._minX = pointMinX;
point._maxY = pointMaxY;
point._minY = pointMinY;
maxX = Math.max(maxX, pointMaxX);
minX = Math.min(minX, pointMinX);
maxY = Math.max(maxY, pointMaxY);
minY = Math.min(minY, pointMinY);
});
this.minY = minY;
this.maxY = maxY;
this.minX = minX;
this.maxX = maxX;
} | javascript | function (paths) {
var maxX = Number.MIN_VALUE,
minX = Number.MAX_VALUE,
maxY = Number.MIN_VALUE,
minY = Number.MAX_VALUE;
// Find the bounding box
each(paths || this.options.data, function (point) {
var path = point.path,
i = path.length,
even = false, // while loop reads from the end
pointMaxX = Number.MIN_VALUE,
pointMinX = Number.MAX_VALUE,
pointMaxY = Number.MIN_VALUE,
pointMinY = Number.MAX_VALUE;
while (i--) {
if (typeof path[i] === 'number' && !isNaN(path[i])) {
if (even) { // even = x
pointMaxX = Math.max(pointMaxX, path[i]);
pointMinX = Math.min(pointMinX, path[i]);
} else { // odd = Y
pointMaxY = Math.max(pointMaxY, path[i]);
pointMinY = Math.min(pointMinY, path[i]);
}
even = !even;
}
}
// Cache point bounding box for use to position data labels
point._maxX = pointMaxX;
point._minX = pointMinX;
point._maxY = pointMaxY;
point._minY = pointMinY;
maxX = Math.max(maxX, pointMaxX);
minX = Math.min(minX, pointMinX);
maxY = Math.max(maxY, pointMaxY);
minY = Math.min(minY, pointMinY);
});
this.minY = minY;
this.maxY = maxY;
this.minX = minX;
this.maxX = maxX;
} | [
"function",
"(",
"paths",
")",
"{",
"var",
"maxX",
"=",
"Number",
".",
"MIN_VALUE",
",",
"minX",
"=",
"Number",
".",
"MAX_VALUE",
",",
"maxY",
"=",
"Number",
".",
"MIN_VALUE",
",",
"minY",
"=",
"Number",
".",
"MAX_VALUE",
";",
"// Find the bounding box",
"each",
"(",
"paths",
"||",
"this",
".",
"options",
".",
"data",
",",
"function",
"(",
"point",
")",
"{",
"var",
"path",
"=",
"point",
".",
"path",
",",
"i",
"=",
"path",
".",
"length",
",",
"even",
"=",
"false",
",",
"// while loop reads from the end",
"pointMaxX",
"=",
"Number",
".",
"MIN_VALUE",
",",
"pointMinX",
"=",
"Number",
".",
"MAX_VALUE",
",",
"pointMaxY",
"=",
"Number",
".",
"MIN_VALUE",
",",
"pointMinY",
"=",
"Number",
".",
"MAX_VALUE",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"typeof",
"path",
"[",
"i",
"]",
"===",
"'number'",
"&&",
"!",
"isNaN",
"(",
"path",
"[",
"i",
"]",
")",
")",
"{",
"if",
"(",
"even",
")",
"{",
"// even = x",
"pointMaxX",
"=",
"Math",
".",
"max",
"(",
"pointMaxX",
",",
"path",
"[",
"i",
"]",
")",
";",
"pointMinX",
"=",
"Math",
".",
"min",
"(",
"pointMinX",
",",
"path",
"[",
"i",
"]",
")",
";",
"}",
"else",
"{",
"// odd = Y",
"pointMaxY",
"=",
"Math",
".",
"max",
"(",
"pointMaxY",
",",
"path",
"[",
"i",
"]",
")",
";",
"pointMinY",
"=",
"Math",
".",
"min",
"(",
"pointMinY",
",",
"path",
"[",
"i",
"]",
")",
";",
"}",
"even",
"=",
"!",
"even",
";",
"}",
"}",
"// Cache point bounding box for use to position data labels",
"point",
".",
"_maxX",
"=",
"pointMaxX",
";",
"point",
".",
"_minX",
"=",
"pointMinX",
";",
"point",
".",
"_maxY",
"=",
"pointMaxY",
";",
"point",
".",
"_minY",
"=",
"pointMinY",
";",
"maxX",
"=",
"Math",
".",
"max",
"(",
"maxX",
",",
"pointMaxX",
")",
";",
"minX",
"=",
"Math",
".",
"min",
"(",
"minX",
",",
"pointMinX",
")",
";",
"maxY",
"=",
"Math",
".",
"max",
"(",
"maxY",
",",
"pointMaxY",
")",
";",
"minY",
"=",
"Math",
".",
"min",
"(",
"minY",
",",
"pointMinY",
")",
";",
"}",
")",
";",
"this",
".",
"minY",
"=",
"minY",
";",
"this",
".",
"maxY",
"=",
"maxY",
";",
"this",
".",
"minX",
"=",
"minX",
";",
"this",
".",
"maxX",
"=",
"maxX",
";",
"}"
] | Get the bounding box of all paths in the map combined. | [
"Get",
"the",
"bounding",
"box",
"of",
"all",
"paths",
"in",
"the",
"map",
"combined",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L650-L695 | |
23,560 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (path) {
var series = this,
even = false, // while loop reads from the end
xAxis = series.xAxis,
yAxis = series.yAxis,
i;
// Preserve the original
path = [].concat(path);
// Do the translation
i = path.length;
while (i--) {
if (typeof path[i] === 'number') {
if (even) { // even = x
path[i] = Math.round(xAxis.translate(path[i]));
} else { // odd = Y
path[i] = Math.round(yAxis.len - yAxis.translate(path[i]));
}
even = !even;
}
}
return path;
} | javascript | function (path) {
var series = this,
even = false, // while loop reads from the end
xAxis = series.xAxis,
yAxis = series.yAxis,
i;
// Preserve the original
path = [].concat(path);
// Do the translation
i = path.length;
while (i--) {
if (typeof path[i] === 'number') {
if (even) { // even = x
path[i] = Math.round(xAxis.translate(path[i]));
} else { // odd = Y
path[i] = Math.round(yAxis.len - yAxis.translate(path[i]));
}
even = !even;
}
}
return path;
} | [
"function",
"(",
"path",
")",
"{",
"var",
"series",
"=",
"this",
",",
"even",
"=",
"false",
",",
"// while loop reads from the end",
"xAxis",
"=",
"series",
".",
"xAxis",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"i",
";",
"// Preserve the original",
"path",
"=",
"[",
"]",
".",
"concat",
"(",
"path",
")",
";",
"// Do the translation",
"i",
"=",
"path",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"typeof",
"path",
"[",
"i",
"]",
"===",
"'number'",
")",
"{",
"if",
"(",
"even",
")",
"{",
"// even = x",
"path",
"[",
"i",
"]",
"=",
"Math",
".",
"round",
"(",
"xAxis",
".",
"translate",
"(",
"path",
"[",
"i",
"]",
")",
")",
";",
"}",
"else",
"{",
"// odd = Y",
"path",
"[",
"i",
"]",
"=",
"Math",
".",
"round",
"(",
"yAxis",
".",
"len",
"-",
"yAxis",
".",
"translate",
"(",
"path",
"[",
"i",
"]",
")",
")",
";",
"}",
"even",
"=",
"!",
"even",
";",
"}",
"}",
"return",
"path",
";",
"}"
] | Translate the path so that it automatically fits into the plot area box
@param {Object} path | [
"Translate",
"the",
"path",
"so",
"that",
"it",
"automatically",
"fits",
"into",
"the",
"plot",
"area",
"box"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L703-L727 | |
23,561 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function () {
var series = this,
dataMin = Number.MAX_VALUE,
dataMax = Number.MIN_VALUE;
series.generatePoints();
each(series.data, function (point) {
point.shapeType = 'path';
point.shapeArgs = {
d: series.translatePath(point.path)
};
// TODO: do point colors in drawPoints instead of point.init
if (typeof point.y === 'number') {
if (point.y > dataMax) {
dataMax = point.y;
} else if (point.y < dataMin) {
dataMin = point.y;
}
}
});
series.translateColors(dataMin, dataMax);
} | javascript | function () {
var series = this,
dataMin = Number.MAX_VALUE,
dataMax = Number.MIN_VALUE;
series.generatePoints();
each(series.data, function (point) {
point.shapeType = 'path';
point.shapeArgs = {
d: series.translatePath(point.path)
};
// TODO: do point colors in drawPoints instead of point.init
if (typeof point.y === 'number') {
if (point.y > dataMax) {
dataMax = point.y;
} else if (point.y < dataMin) {
dataMin = point.y;
}
}
});
series.translateColors(dataMin, dataMax);
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"dataMin",
"=",
"Number",
".",
"MAX_VALUE",
",",
"dataMax",
"=",
"Number",
".",
"MIN_VALUE",
";",
"series",
".",
"generatePoints",
"(",
")",
";",
"each",
"(",
"series",
".",
"data",
",",
"function",
"(",
"point",
")",
"{",
"point",
".",
"shapeType",
"=",
"'path'",
";",
"point",
".",
"shapeArgs",
"=",
"{",
"d",
":",
"series",
".",
"translatePath",
"(",
"point",
".",
"path",
")",
"}",
";",
"// TODO: do point colors in drawPoints instead of point.init",
"if",
"(",
"typeof",
"point",
".",
"y",
"===",
"'number'",
")",
"{",
"if",
"(",
"point",
".",
"y",
">",
"dataMax",
")",
"{",
"dataMax",
"=",
"point",
".",
"y",
";",
"}",
"else",
"if",
"(",
"point",
".",
"y",
"<",
"dataMin",
")",
"{",
"dataMin",
"=",
"point",
".",
"y",
";",
"}",
"}",
"}",
")",
";",
"series",
".",
"translateColors",
"(",
"dataMin",
",",
"dataMax",
")",
";",
"}"
] | Add the path option for data points. Find the max value for color calculation. | [
"Add",
"the",
"path",
"option",
"for",
"data",
"points",
".",
"Find",
"the",
"max",
"value",
"for",
"color",
"calculation",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L737-L762 | |
23,562 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (dataMin, dataMax) {
var seriesOptions = this.options,
valueRanges = seriesOptions.valueRanges,
colorRange = seriesOptions.colorRange,
colorKey = this.colorKey,
from,
to;
if (colorRange) {
from = Color(colorRange.from);
to = Color(colorRange.to);
}
each(this.data, function (point) {
var value = point[colorKey],
range,
color,
i,
pos;
if (valueRanges) {
i = valueRanges.length;
while (i--) {
range = valueRanges[i];
from = range.from;
to = range.to;
if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
color = range.color;
break;
}
}
} else if (colorRange && value !== undefined) {
pos = 1 - ((dataMax - value) / (dataMax - dataMin));
color = value === null ? seriesOptions.nullColor : tweenColors(from, to, pos);
}
if (color) {
point.color = null; // reset from previous drilldowns, use of the same data options
point.options.color = color;
}
});
} | javascript | function (dataMin, dataMax) {
var seriesOptions = this.options,
valueRanges = seriesOptions.valueRanges,
colorRange = seriesOptions.colorRange,
colorKey = this.colorKey,
from,
to;
if (colorRange) {
from = Color(colorRange.from);
to = Color(colorRange.to);
}
each(this.data, function (point) {
var value = point[colorKey],
range,
color,
i,
pos;
if (valueRanges) {
i = valueRanges.length;
while (i--) {
range = valueRanges[i];
from = range.from;
to = range.to;
if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
color = range.color;
break;
}
}
} else if (colorRange && value !== undefined) {
pos = 1 - ((dataMax - value) / (dataMax - dataMin));
color = value === null ? seriesOptions.nullColor : tweenColors(from, to, pos);
}
if (color) {
point.color = null; // reset from previous drilldowns, use of the same data options
point.options.color = color;
}
});
} | [
"function",
"(",
"dataMin",
",",
"dataMax",
")",
"{",
"var",
"seriesOptions",
"=",
"this",
".",
"options",
",",
"valueRanges",
"=",
"seriesOptions",
".",
"valueRanges",
",",
"colorRange",
"=",
"seriesOptions",
".",
"colorRange",
",",
"colorKey",
"=",
"this",
".",
"colorKey",
",",
"from",
",",
"to",
";",
"if",
"(",
"colorRange",
")",
"{",
"from",
"=",
"Color",
"(",
"colorRange",
".",
"from",
")",
";",
"to",
"=",
"Color",
"(",
"colorRange",
".",
"to",
")",
";",
"}",
"each",
"(",
"this",
".",
"data",
",",
"function",
"(",
"point",
")",
"{",
"var",
"value",
"=",
"point",
"[",
"colorKey",
"]",
",",
"range",
",",
"color",
",",
"i",
",",
"pos",
";",
"if",
"(",
"valueRanges",
")",
"{",
"i",
"=",
"valueRanges",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"range",
"=",
"valueRanges",
"[",
"i",
"]",
";",
"from",
"=",
"range",
".",
"from",
";",
"to",
"=",
"range",
".",
"to",
";",
"if",
"(",
"(",
"from",
"===",
"UNDEFINED",
"||",
"value",
">=",
"from",
")",
"&&",
"(",
"to",
"===",
"UNDEFINED",
"||",
"value",
"<=",
"to",
")",
")",
"{",
"color",
"=",
"range",
".",
"color",
";",
"break",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"colorRange",
"&&",
"value",
"!==",
"undefined",
")",
"{",
"pos",
"=",
"1",
"-",
"(",
"(",
"dataMax",
"-",
"value",
")",
"/",
"(",
"dataMax",
"-",
"dataMin",
")",
")",
";",
"color",
"=",
"value",
"===",
"null",
"?",
"seriesOptions",
".",
"nullColor",
":",
"tweenColors",
"(",
"from",
",",
"to",
",",
"pos",
")",
";",
"}",
"if",
"(",
"color",
")",
"{",
"point",
".",
"color",
"=",
"null",
";",
"// reset from previous drilldowns, use of the same data options",
"point",
".",
"options",
".",
"color",
"=",
"color",
";",
"}",
"}",
")",
";",
"}"
] | In choropleth maps, the color is a result of the value, so this needs translation too | [
"In",
"choropleth",
"maps",
"the",
"color",
"is",
"a",
"result",
"of",
"the",
"value",
"so",
"this",
"needs",
"translation",
"too"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L767-L811 | |
23,563 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function () {
var series = this,
xAxis = series.xAxis,
yAxis = series.yAxis,
colorKey = series.colorKey;
// Make points pass test in drawing
each(series.data, function (point) {
point.plotY = 1; // pass null test in column.drawPoints
if (point[colorKey] === null) {
point[colorKey] = 0;
point.isNull = true;
}
});
// Draw them
seriesTypes.column.prototype.drawPoints.apply(series);
each(series.data, function (point) {
var dataLabels = point.dataLabels,
minX = xAxis.toPixels(point._minX, true),
maxX = xAxis.toPixels(point._maxX, true),
minY = yAxis.toPixels(point._minY, true),
maxY = yAxis.toPixels(point._maxY, true);
point.plotX = Math.round(minX + (maxX - minX) * pick(dataLabels && dataLabels.anchorX, 0.5));
point.plotY = Math.round(minY + (maxY - minY) * pick(dataLabels && dataLabels.anchorY, 0.5));
// Reset escaped null points
if (point.isNull) {
point[colorKey] = null;
}
});
// Now draw the data labels
Highcharts.Series.prototype.drawDataLabels.call(series);
} | javascript | function () {
var series = this,
xAxis = series.xAxis,
yAxis = series.yAxis,
colorKey = series.colorKey;
// Make points pass test in drawing
each(series.data, function (point) {
point.plotY = 1; // pass null test in column.drawPoints
if (point[colorKey] === null) {
point[colorKey] = 0;
point.isNull = true;
}
});
// Draw them
seriesTypes.column.prototype.drawPoints.apply(series);
each(series.data, function (point) {
var dataLabels = point.dataLabels,
minX = xAxis.toPixels(point._minX, true),
maxX = xAxis.toPixels(point._maxX, true),
minY = yAxis.toPixels(point._minY, true),
maxY = yAxis.toPixels(point._maxY, true);
point.plotX = Math.round(minX + (maxX - minX) * pick(dataLabels && dataLabels.anchorX, 0.5));
point.plotY = Math.round(minY + (maxY - minY) * pick(dataLabels && dataLabels.anchorY, 0.5));
// Reset escaped null points
if (point.isNull) {
point[colorKey] = null;
}
});
// Now draw the data labels
Highcharts.Series.prototype.drawDataLabels.call(series);
} | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"xAxis",
"=",
"series",
".",
"xAxis",
",",
"yAxis",
"=",
"series",
".",
"yAxis",
",",
"colorKey",
"=",
"series",
".",
"colorKey",
";",
"// Make points pass test in drawing",
"each",
"(",
"series",
".",
"data",
",",
"function",
"(",
"point",
")",
"{",
"point",
".",
"plotY",
"=",
"1",
";",
"// pass null test in column.drawPoints",
"if",
"(",
"point",
"[",
"colorKey",
"]",
"===",
"null",
")",
"{",
"point",
"[",
"colorKey",
"]",
"=",
"0",
";",
"point",
".",
"isNull",
"=",
"true",
";",
"}",
"}",
")",
";",
"// Draw them",
"seriesTypes",
".",
"column",
".",
"prototype",
".",
"drawPoints",
".",
"apply",
"(",
"series",
")",
";",
"each",
"(",
"series",
".",
"data",
",",
"function",
"(",
"point",
")",
"{",
"var",
"dataLabels",
"=",
"point",
".",
"dataLabels",
",",
"minX",
"=",
"xAxis",
".",
"toPixels",
"(",
"point",
".",
"_minX",
",",
"true",
")",
",",
"maxX",
"=",
"xAxis",
".",
"toPixels",
"(",
"point",
".",
"_maxX",
",",
"true",
")",
",",
"minY",
"=",
"yAxis",
".",
"toPixels",
"(",
"point",
".",
"_minY",
",",
"true",
")",
",",
"maxY",
"=",
"yAxis",
".",
"toPixels",
"(",
"point",
".",
"_maxY",
",",
"true",
")",
";",
"point",
".",
"plotX",
"=",
"Math",
".",
"round",
"(",
"minX",
"+",
"(",
"maxX",
"-",
"minX",
")",
"*",
"pick",
"(",
"dataLabels",
"&&",
"dataLabels",
".",
"anchorX",
",",
"0.5",
")",
")",
";",
"point",
".",
"plotY",
"=",
"Math",
".",
"round",
"(",
"minY",
"+",
"(",
"maxY",
"-",
"minY",
")",
"*",
"pick",
"(",
"dataLabels",
"&&",
"dataLabels",
".",
"anchorY",
",",
"0.5",
")",
")",
";",
"// Reset escaped null points",
"if",
"(",
"point",
".",
"isNull",
")",
"{",
"point",
"[",
"colorKey",
"]",
"=",
"null",
";",
"}",
"}",
")",
";",
"// Now draw the data labels",
"Highcharts",
".",
"Series",
".",
"prototype",
".",
"drawDataLabels",
".",
"call",
"(",
"series",
")",
";",
"}"
] | Use the drawPoints method of column, that is able to handle simple shapeArgs.
Extend it by assigning the tooltip position. | [
"Use",
"the",
"drawPoints",
"method",
"of",
"column",
"that",
"is",
"able",
"to",
"handle",
"simple",
"shapeArgs",
".",
"Extend",
"it",
"by",
"assigning",
"the",
"tooltip",
"position",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L825-L864 | |
23,564 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/map.src.js | function (init) {
var toBox = this.chart.plotBox,
level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
fromBox = level.bBox,
animationOptions = this.chart.options.drilldown.animation,
scale;
if (!init) {
scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
level.shapeArgs = {
scaleX: scale,
scaleY: scale,
translateX: fromBox.x,
translateY: fromBox.y
};
// TODO: Animate this.group instead
each(this.points, function (point) {
point.graphic
.attr(level.shapeArgs)
.animate({
scaleX: 1,
scaleY: 1,
translateX: 0,
translateY: 0
}, animationOptions);
});
delete this.animate;
}
} | javascript | function (init) {
var toBox = this.chart.plotBox,
level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
fromBox = level.bBox,
animationOptions = this.chart.options.drilldown.animation,
scale;
if (!init) {
scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
level.shapeArgs = {
scaleX: scale,
scaleY: scale,
translateX: fromBox.x,
translateY: fromBox.y
};
// TODO: Animate this.group instead
each(this.points, function (point) {
point.graphic
.attr(level.shapeArgs)
.animate({
scaleX: 1,
scaleY: 1,
translateX: 0,
translateY: 0
}, animationOptions);
});
delete this.animate;
}
} | [
"function",
"(",
"init",
")",
"{",
"var",
"toBox",
"=",
"this",
".",
"chart",
".",
"plotBox",
",",
"level",
"=",
"this",
".",
"chart",
".",
"drilldownLevels",
"[",
"this",
".",
"chart",
".",
"drilldownLevels",
".",
"length",
"-",
"1",
"]",
",",
"fromBox",
"=",
"level",
".",
"bBox",
",",
"animationOptions",
"=",
"this",
".",
"chart",
".",
"options",
".",
"drilldown",
".",
"animation",
",",
"scale",
";",
"if",
"(",
"!",
"init",
")",
"{",
"scale",
"=",
"Math",
".",
"min",
"(",
"fromBox",
".",
"width",
"/",
"toBox",
".",
"width",
",",
"fromBox",
".",
"height",
"/",
"toBox",
".",
"height",
")",
";",
"level",
".",
"shapeArgs",
"=",
"{",
"scaleX",
":",
"scale",
",",
"scaleY",
":",
"scale",
",",
"translateX",
":",
"fromBox",
".",
"x",
",",
"translateY",
":",
"fromBox",
".",
"y",
"}",
";",
"// TODO: Animate this.group instead",
"each",
"(",
"this",
".",
"points",
",",
"function",
"(",
"point",
")",
"{",
"point",
".",
"graphic",
".",
"attr",
"(",
"level",
".",
"shapeArgs",
")",
".",
"animate",
"(",
"{",
"scaleX",
":",
"1",
",",
"scaleY",
":",
"1",
",",
"translateX",
":",
"0",
",",
"translateY",
":",
"0",
"}",
",",
"animationOptions",
")",
";",
"}",
")",
";",
"delete",
"this",
".",
"animate",
";",
"}",
"}"
] | Animate in the new series from the clicked point in the old series.
Depends on the drilldown.js module | [
"Animate",
"in",
"the",
"new",
"series",
"from",
"the",
"clicked",
"point",
"in",
"the",
"old",
"series",
".",
"Depends",
"on",
"the",
"drilldown",
".",
"js",
"module"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/map.src.js#L870-L904 | |
23,565 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(highlighter)
{
var html = '<div class="toolbar">',
items = sh.toolbar.items,
list = items.list
;
function defaultGetHtml(highlighter, name)
{
return sh.toolbar.getButtonHtml(highlighter, name, sh.config.strings[name]);
};
for (var i = 0; i < list.length; i++)
html += (items[list[i]].getHtml || defaultGetHtml)(highlighter, list[i]);
html += '</div>';
return html;
} | javascript | function(highlighter)
{
var html = '<div class="toolbar">',
items = sh.toolbar.items,
list = items.list
;
function defaultGetHtml(highlighter, name)
{
return sh.toolbar.getButtonHtml(highlighter, name, sh.config.strings[name]);
};
for (var i = 0; i < list.length; i++)
html += (items[list[i]].getHtml || defaultGetHtml)(highlighter, list[i]);
html += '</div>';
return html;
} | [
"function",
"(",
"highlighter",
")",
"{",
"var",
"html",
"=",
"'<div class=\"toolbar\">'",
",",
"items",
"=",
"sh",
".",
"toolbar",
".",
"items",
",",
"list",
"=",
"items",
".",
"list",
";",
"function",
"defaultGetHtml",
"(",
"highlighter",
",",
"name",
")",
"{",
"return",
"sh",
".",
"toolbar",
".",
"getButtonHtml",
"(",
"highlighter",
",",
"name",
",",
"sh",
".",
"config",
".",
"strings",
"[",
"name",
"]",
")",
";",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++",
")",
"html",
"+=",
"(",
"items",
"[",
"list",
"[",
"i",
"]",
"]",
".",
"getHtml",
"||",
"defaultGetHtml",
")",
"(",
"highlighter",
",",
"list",
"[",
"i",
"]",
")",
";",
"html",
"+=",
"'</div>'",
";",
"return",
"html",
";",
"}"
] | Generates HTML markup for the toolbar.
@param {Highlighter} highlighter Highlighter instance.
@return {String} Returns HTML markup. | [
"Generates",
"HTML",
"markup",
"for",
"the",
"toolbar",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L794-L812 | |
23,566 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(e)
{
var target = e.target,
className = target.className || ''
;
function getValue(name)
{
var r = new RegExp(name + '_(\\w+)'),
match = r.exec(className)
;
return match ? match[1] : null;
};
var highlighter = getHighlighterById(findParentElement(target, '.syntaxhighlighter').id),
commandName = getValue('command')
;
// execute the toolbar command
if (highlighter && commandName)
sh.toolbar.items[commandName].execute(highlighter);
// disable default A click behaviour
e.preventDefault();
} | javascript | function(e)
{
var target = e.target,
className = target.className || ''
;
function getValue(name)
{
var r = new RegExp(name + '_(\\w+)'),
match = r.exec(className)
;
return match ? match[1] : null;
};
var highlighter = getHighlighterById(findParentElement(target, '.syntaxhighlighter').id),
commandName = getValue('command')
;
// execute the toolbar command
if (highlighter && commandName)
sh.toolbar.items[commandName].execute(highlighter);
// disable default A click behaviour
e.preventDefault();
} | [
"function",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
",",
"className",
"=",
"target",
".",
"className",
"||",
"''",
";",
"function",
"getValue",
"(",
"name",
")",
"{",
"var",
"r",
"=",
"new",
"RegExp",
"(",
"name",
"+",
"'_(\\\\w+)'",
")",
",",
"match",
"=",
"r",
".",
"exec",
"(",
"className",
")",
";",
"return",
"match",
"?",
"match",
"[",
"1",
"]",
":",
"null",
";",
"}",
";",
"var",
"highlighter",
"=",
"getHighlighterById",
"(",
"findParentElement",
"(",
"target",
",",
"'.syntaxhighlighter'",
")",
".",
"id",
")",
",",
"commandName",
"=",
"getValue",
"(",
"'command'",
")",
";",
"// execute the toolbar command",
"if",
"(",
"highlighter",
"&&",
"commandName",
")",
"sh",
".",
"toolbar",
".",
"items",
"[",
"commandName",
"]",
".",
"execute",
"(",
"highlighter",
")",
";",
"// disable default A click behaviour",
"e",
".",
"preventDefault",
"(",
")",
";",
"}"
] | Event handler for a toolbar anchor. | [
"Event",
"handler",
"for",
"a",
"toolbar",
"anchor",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L833-L858 | |
23,567 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(globalParams, element)
{
var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)),
conf = sh.config,
result = []
;
// support for <SCRIPT TYPE="syntaxhighlighter" /> feature
if (conf.useScriptTags)
elements = elements.concat(getSyntaxHighlighterScriptTags());
if (elements.length === 0)
return result;
for (var i = 0; i < elements.length; i++)
{
var item = {
target: elements[i],
// local params take precedence over globals
params: merge(globalParams, parseParams(elements[i].className))
};
if (item.params['brush'] == null)
continue;
result.push(item);
}
return result;
} | javascript | function(globalParams, element)
{
var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)),
conf = sh.config,
result = []
;
// support for <SCRIPT TYPE="syntaxhighlighter" /> feature
if (conf.useScriptTags)
elements = elements.concat(getSyntaxHighlighterScriptTags());
if (elements.length === 0)
return result;
for (var i = 0; i < elements.length; i++)
{
var item = {
target: elements[i],
// local params take precedence over globals
params: merge(globalParams, parseParams(elements[i].className))
};
if (item.params['brush'] == null)
continue;
result.push(item);
}
return result;
} | [
"function",
"(",
"globalParams",
",",
"element",
")",
"{",
"var",
"elements",
"=",
"element",
"?",
"[",
"element",
"]",
":",
"toArray",
"(",
"document",
".",
"getElementsByTagName",
"(",
"sh",
".",
"config",
".",
"tagName",
")",
")",
",",
"conf",
"=",
"sh",
".",
"config",
",",
"result",
"=",
"[",
"]",
";",
"// support for <SCRIPT TYPE=\"syntaxhighlighter\" /> feature",
"if",
"(",
"conf",
".",
"useScriptTags",
")",
"elements",
"=",
"elements",
".",
"concat",
"(",
"getSyntaxHighlighterScriptTags",
"(",
")",
")",
";",
"if",
"(",
"elements",
".",
"length",
"===",
"0",
")",
"return",
"result",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"item",
"=",
"{",
"target",
":",
"elements",
"[",
"i",
"]",
",",
"// local params take precedence over globals",
"params",
":",
"merge",
"(",
"globalParams",
",",
"parseParams",
"(",
"elements",
"[",
"i",
"]",
".",
"className",
")",
")",
"}",
";",
"if",
"(",
"item",
".",
"params",
"[",
"'brush'",
"]",
"==",
"null",
")",
"continue",
";",
"result",
".",
"push",
"(",
"item",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Finds all elements on the page which should be processes by SyntaxHighlighter.
@param {Object} globalParams Optional parameters which override element's
parameters. Only used if element is specified.
@param {Object} element Optional element to highlight. If none is
provided, all elements in the current document
are returned which qualify.
@return {Array} Returns list of <code>{ target: DOMElement, params: Object }</code> objects. | [
"Finds",
"all",
"elements",
"on",
"the",
"page",
"which",
"should",
"be",
"processes",
"by",
"SyntaxHighlighter",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L910-L939 | |
23,568 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(globalParams, element)
{
var elements = this.findElements(globalParams, element),
propertyName = 'innerHTML',
highlighter = null,
conf = sh.config
;
if (elements.length === 0)
return;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i],
target = element.target,
params = element.params,
brushName = params.brush,
code
;
if (brushName == null)
continue;
// Instantiate a brush
if (params['html-script'] == 'true' || sh.defaults['html-script'] == true)
{
highlighter = new sh.HtmlScript(brushName);
brushName = 'htmlscript';
}
else
{
var brush = findBrush(brushName);
if (brush)
highlighter = new brush();
else
continue;
}
code = target[propertyName];
// remove CDATA from <SCRIPT/> tags if it's present
if (conf.useScriptTags)
code = stripCData(code);
// Inject title if the attribute is present
if ((target.title || '') != '')
params.title = target.title;
params['brush'] = brushName;
highlighter.init(params);
element = highlighter.getDiv(code);
// carry over ID
if ((target.id || '') != '')
element.id = target.id;
//by zhanyi 去掉多余的外围div
var tmp = element.firstChild.firstChild;
tmp.className = element.firstChild.className;
target.parentNode.replaceChild(tmp, target);
}
} | javascript | function(globalParams, element)
{
var elements = this.findElements(globalParams, element),
propertyName = 'innerHTML',
highlighter = null,
conf = sh.config
;
if (elements.length === 0)
return;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i],
target = element.target,
params = element.params,
brushName = params.brush,
code
;
if (brushName == null)
continue;
// Instantiate a brush
if (params['html-script'] == 'true' || sh.defaults['html-script'] == true)
{
highlighter = new sh.HtmlScript(brushName);
brushName = 'htmlscript';
}
else
{
var brush = findBrush(brushName);
if (brush)
highlighter = new brush();
else
continue;
}
code = target[propertyName];
// remove CDATA from <SCRIPT/> tags if it's present
if (conf.useScriptTags)
code = stripCData(code);
// Inject title if the attribute is present
if ((target.title || '') != '')
params.title = target.title;
params['brush'] = brushName;
highlighter.init(params);
element = highlighter.getDiv(code);
// carry over ID
if ((target.id || '') != '')
element.id = target.id;
//by zhanyi 去掉多余的外围div
var tmp = element.firstChild.firstChild;
tmp.className = element.firstChild.className;
target.parentNode.replaceChild(tmp, target);
}
} | [
"function",
"(",
"globalParams",
",",
"element",
")",
"{",
"var",
"elements",
"=",
"this",
".",
"findElements",
"(",
"globalParams",
",",
"element",
")",
",",
"propertyName",
"=",
"'innerHTML'",
",",
"highlighter",
"=",
"null",
",",
"conf",
"=",
"sh",
".",
"config",
";",
"if",
"(",
"elements",
".",
"length",
"===",
"0",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"element",
"=",
"elements",
"[",
"i",
"]",
",",
"target",
"=",
"element",
".",
"target",
",",
"params",
"=",
"element",
".",
"params",
",",
"brushName",
"=",
"params",
".",
"brush",
",",
"code",
";",
"if",
"(",
"brushName",
"==",
"null",
")",
"continue",
";",
"// Instantiate a brush",
"if",
"(",
"params",
"[",
"'html-script'",
"]",
"==",
"'true'",
"||",
"sh",
".",
"defaults",
"[",
"'html-script'",
"]",
"==",
"true",
")",
"{",
"highlighter",
"=",
"new",
"sh",
".",
"HtmlScript",
"(",
"brushName",
")",
";",
"brushName",
"=",
"'htmlscript'",
";",
"}",
"else",
"{",
"var",
"brush",
"=",
"findBrush",
"(",
"brushName",
")",
";",
"if",
"(",
"brush",
")",
"highlighter",
"=",
"new",
"brush",
"(",
")",
";",
"else",
"continue",
";",
"}",
"code",
"=",
"target",
"[",
"propertyName",
"]",
";",
"// remove CDATA from <SCRIPT/> tags if it's present",
"if",
"(",
"conf",
".",
"useScriptTags",
")",
"code",
"=",
"stripCData",
"(",
"code",
")",
";",
"// Inject title if the attribute is present",
"if",
"(",
"(",
"target",
".",
"title",
"||",
"''",
")",
"!=",
"''",
")",
"params",
".",
"title",
"=",
"target",
".",
"title",
";",
"params",
"[",
"'brush'",
"]",
"=",
"brushName",
";",
"highlighter",
".",
"init",
"(",
"params",
")",
";",
"element",
"=",
"highlighter",
".",
"getDiv",
"(",
"code",
")",
";",
"// carry over ID",
"if",
"(",
"(",
"target",
".",
"id",
"||",
"''",
")",
"!=",
"''",
")",
"element",
".",
"id",
"=",
"target",
".",
"id",
";",
"//by zhanyi 去掉多余的外围div",
"var",
"tmp",
"=",
"element",
".",
"firstChild",
".",
"firstChild",
";",
"tmp",
".",
"className",
"=",
"element",
".",
"firstChild",
".",
"className",
";",
"target",
".",
"parentNode",
".",
"replaceChild",
"(",
"tmp",
",",
"target",
")",
";",
"}",
"}"
] | Shorthand to highlight all elements on the page that are marked as
SyntaxHighlighter source code.
@param {Object} globalParams Optional parameters which override element's
parameters. Only used if element is specified.
@param {Object} element Optional element to highlight. If none is
provided, all elements in the current document
are highlighted. | [
"Shorthand",
"to",
"highlight",
"all",
"elements",
"on",
"the",
"page",
"that",
"are",
"marked",
"as",
"SyntaxHighlighter",
"source",
"code",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L952-L1014 | |
23,569 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | indexOf | function indexOf(array, searchElement, fromIndex)
{
fromIndex = Math.max(fromIndex || 0, 0);
for (var i = fromIndex; i < array.length; i++)
if(array[i] == searchElement)
return i;
return -1;
} | javascript | function indexOf(array, searchElement, fromIndex)
{
fromIndex = Math.max(fromIndex || 0, 0);
for (var i = fromIndex; i < array.length; i++)
if(array[i] == searchElement)
return i;
return -1;
} | [
"function",
"indexOf",
"(",
"array",
",",
"searchElement",
",",
"fromIndex",
")",
"{",
"fromIndex",
"=",
"Math",
".",
"max",
"(",
"fromIndex",
"||",
"0",
",",
"0",
")",
";",
"for",
"(",
"var",
"i",
"=",
"fromIndex",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"searchElement",
")",
"return",
"i",
";",
"return",
"-",
"1",
";",
"}"
] | Finds an index of element in the array.
@ignore
@param {Object} searchElement
@param {Number} fromIndex
@return {Number} Returns index of element if found; -1 otherwise. | [
"Finds",
"an",
"index",
"of",
"element",
"in",
"the",
"array",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1182-L1191 |
23,570 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | merge | function merge(obj1, obj2)
{
var result = {}, name;
for (name in obj1)
result[name] = obj1[name];
for (name in obj2)
result[name] = obj2[name];
return result;
} | javascript | function merge(obj1, obj2)
{
var result = {}, name;
for (name in obj1)
result[name] = obj1[name];
for (name in obj2)
result[name] = obj2[name];
return result;
} | [
"function",
"merge",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"result",
"=",
"{",
"}",
",",
"name",
";",
"for",
"(",
"name",
"in",
"obj1",
")",
"result",
"[",
"name",
"]",
"=",
"obj1",
"[",
"name",
"]",
";",
"for",
"(",
"name",
"in",
"obj2",
")",
"result",
"[",
"name",
"]",
"=",
"obj2",
"[",
"name",
"]",
";",
"return",
"result",
";",
"}"
] | Merges two objects. Values from obj2 override values in obj1.
Function is NOT recursive and works only for one dimensional objects.
@param {Object} obj1 First object.
@param {Object} obj2 Second object.
@return {Object} Returns combination of both objects. | [
"Merges",
"two",
"objects",
".",
"Values",
"from",
"obj2",
"override",
"values",
"in",
"obj1",
".",
"Function",
"is",
"NOT",
"recursive",
"and",
"works",
"only",
"for",
"one",
"dimensional",
"objects",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1208-L1219 |
23,571 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | toBoolean | function toBoolean(value)
{
var result = { "true" : true, "false" : false }[value];
return result == null ? value : result;
} | javascript | function toBoolean(value)
{
var result = { "true" : true, "false" : false }[value];
return result == null ? value : result;
} | [
"function",
"toBoolean",
"(",
"value",
")",
"{",
"var",
"result",
"=",
"{",
"\"true\"",
":",
"true",
",",
"\"false\"",
":",
"false",
"}",
"[",
"value",
"]",
";",
"return",
"result",
"==",
"null",
"?",
"value",
":",
"result",
";",
"}"
] | Attempts to convert string to boolean.
@param {String} value Input string.
@return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise. | [
"Attempts",
"to",
"convert",
"string",
"to",
"boolean",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1226-L1230 |
23,572 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | popup | function popup(url, name, width, height, options)
{
var x = (screen.width - width) / 2,
y = (screen.height - height) / 2
;
options += ', left=' + x +
', top=' + y +
', width=' + width +
', height=' + height
;
options = options.replace(/^,/, '');
var win = window.open(url, name, options);
win.focus();
return win;
} | javascript | function popup(url, name, width, height, options)
{
var x = (screen.width - width) / 2,
y = (screen.height - height) / 2
;
options += ', left=' + x +
', top=' + y +
', width=' + width +
', height=' + height
;
options = options.replace(/^,/, '');
var win = window.open(url, name, options);
win.focus();
return win;
} | [
"function",
"popup",
"(",
"url",
",",
"name",
",",
"width",
",",
"height",
",",
"options",
")",
"{",
"var",
"x",
"=",
"(",
"screen",
".",
"width",
"-",
"width",
")",
"/",
"2",
",",
"y",
"=",
"(",
"screen",
".",
"height",
"-",
"height",
")",
"/",
"2",
";",
"options",
"+=",
"', left='",
"+",
"x",
"+",
"', top='",
"+",
"y",
"+",
"', width='",
"+",
"width",
"+",
"', height='",
"+",
"height",
";",
"options",
"=",
"options",
".",
"replace",
"(",
"/",
"^,",
"/",
",",
"''",
")",
";",
"var",
"win",
"=",
"window",
".",
"open",
"(",
"url",
",",
"name",
",",
"options",
")",
";",
"win",
".",
"focus",
"(",
")",
";",
"return",
"win",
";",
"}"
] | Opens up a centered popup window.
@param {String} url URL to open in the window.
@param {String} name Popup name.
@param {int} width Popup width.
@param {int} height Popup height.
@param {String} options window.open() options.
@return {Window} Returns window instance. | [
"Opens",
"up",
"a",
"centered",
"popup",
"window",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1241-L1257 |
23,573 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | attachEvent | function attachEvent(obj, type, func, scope)
{
function handler(e)
{
e = e || window.event;
if (!e.target)
{
e.target = e.srcElement;
e.preventDefault = function()
{
this.returnValue = false;
};
}
func.call(scope || window, e);
};
if (obj.attachEvent)
{
obj.attachEvent('on' + type, handler);
}
else
{
obj.addEventListener(type, handler, false);
}
} | javascript | function attachEvent(obj, type, func, scope)
{
function handler(e)
{
e = e || window.event;
if (!e.target)
{
e.target = e.srcElement;
e.preventDefault = function()
{
this.returnValue = false;
};
}
func.call(scope || window, e);
};
if (obj.attachEvent)
{
obj.attachEvent('on' + type, handler);
}
else
{
obj.addEventListener(type, handler, false);
}
} | [
"function",
"attachEvent",
"(",
"obj",
",",
"type",
",",
"func",
",",
"scope",
")",
"{",
"function",
"handler",
"(",
"e",
")",
"{",
"e",
"=",
"e",
"||",
"window",
".",
"event",
";",
"if",
"(",
"!",
"e",
".",
"target",
")",
"{",
"e",
".",
"target",
"=",
"e",
".",
"srcElement",
";",
"e",
".",
"preventDefault",
"=",
"function",
"(",
")",
"{",
"this",
".",
"returnValue",
"=",
"false",
";",
"}",
";",
"}",
"func",
".",
"call",
"(",
"scope",
"||",
"window",
",",
"e",
")",
";",
"}",
";",
"if",
"(",
"obj",
".",
"attachEvent",
")",
"{",
"obj",
".",
"attachEvent",
"(",
"'on'",
"+",
"type",
",",
"handler",
")",
";",
"}",
"else",
"{",
"obj",
".",
"addEventListener",
"(",
"type",
",",
"handler",
",",
"false",
")",
";",
"}",
"}"
] | Adds event handler to the target object.
@param {Object} obj Target object.
@param {String} type Name of the event.
@param {Function} func Handling function. | [
"Adds",
"event",
"handler",
"to",
"the",
"target",
"object",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1265-L1291 |
23,574 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | findBrush | function findBrush(alias, showAlert)
{
var brushes = sh.vars.discoveredBrushes,
result = null
;
if (brushes == null)
{
brushes = {};
// Find all brushes
for (var brush in sh.brushes)
{
var info = sh.brushes[brush],
aliases = info.aliases
;
if (aliases == null)
continue;
// keep the brush name
info.brushName = brush.toLowerCase();
for (var i = 0; i < aliases.length; i++)
brushes[aliases[i]] = brush;
}
sh.vars.discoveredBrushes = brushes;
}
result = sh.brushes[brushes[alias]];
if (result == null && showAlert)
alert(sh.config.strings.noBrush + alias);
return result;
} | javascript | function findBrush(alias, showAlert)
{
var brushes = sh.vars.discoveredBrushes,
result = null
;
if (brushes == null)
{
brushes = {};
// Find all brushes
for (var brush in sh.brushes)
{
var info = sh.brushes[brush],
aliases = info.aliases
;
if (aliases == null)
continue;
// keep the brush name
info.brushName = brush.toLowerCase();
for (var i = 0; i < aliases.length; i++)
brushes[aliases[i]] = brush;
}
sh.vars.discoveredBrushes = brushes;
}
result = sh.brushes[brushes[alias]];
if (result == null && showAlert)
alert(sh.config.strings.noBrush + alias);
return result;
} | [
"function",
"findBrush",
"(",
"alias",
",",
"showAlert",
")",
"{",
"var",
"brushes",
"=",
"sh",
".",
"vars",
".",
"discoveredBrushes",
",",
"result",
"=",
"null",
";",
"if",
"(",
"brushes",
"==",
"null",
")",
"{",
"brushes",
"=",
"{",
"}",
";",
"// Find all brushes",
"for",
"(",
"var",
"brush",
"in",
"sh",
".",
"brushes",
")",
"{",
"var",
"info",
"=",
"sh",
".",
"brushes",
"[",
"brush",
"]",
",",
"aliases",
"=",
"info",
".",
"aliases",
";",
"if",
"(",
"aliases",
"==",
"null",
")",
"continue",
";",
"// keep the brush name",
"info",
".",
"brushName",
"=",
"brush",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aliases",
".",
"length",
";",
"i",
"++",
")",
"brushes",
"[",
"aliases",
"[",
"i",
"]",
"]",
"=",
"brush",
";",
"}",
"sh",
".",
"vars",
".",
"discoveredBrushes",
"=",
"brushes",
";",
"}",
"result",
"=",
"sh",
".",
"brushes",
"[",
"brushes",
"[",
"alias",
"]",
"]",
";",
"if",
"(",
"result",
"==",
"null",
"&&",
"showAlert",
")",
"alert",
"(",
"sh",
".",
"config",
".",
"strings",
".",
"noBrush",
"+",
"alias",
")",
";",
"return",
"result",
";",
"}"
] | Finds a brush by its alias.
@param {String} alias Brush alias.
@param {Boolean} showAlert Suppresses the alert if false.
@return {Brush} Returns bursh constructor if found, null otherwise. | [
"Finds",
"a",
"brush",
"by",
"its",
"alias",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1309-L1345 |
23,575 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | eachLine | function eachLine(str, callback)
{
var lines = splitLines(str);
for (var i = 0; i < lines.length; i++)
lines[i] = callback(lines[i], i);
// include \r to enable copy-paste on windows (ie8) without getting everything on one line
return lines.join('\r\n');
} | javascript | function eachLine(str, callback)
{
var lines = splitLines(str);
for (var i = 0; i < lines.length; i++)
lines[i] = callback(lines[i], i);
// include \r to enable copy-paste on windows (ie8) without getting everything on one line
return lines.join('\r\n');
} | [
"function",
"eachLine",
"(",
"str",
",",
"callback",
")",
"{",
"var",
"lines",
"=",
"splitLines",
"(",
"str",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"lines",
"[",
"i",
"]",
"=",
"callback",
"(",
"lines",
"[",
"i",
"]",
",",
"i",
")",
";",
"// include \\r to enable copy-paste on windows (ie8) without getting everything on one line",
"return",
"lines",
".",
"join",
"(",
"'\\r\\n'",
")",
";",
"}"
] | Executes a callback on each line and replaces each line with result from the callback.
@param {Object} str Input string.
@param {Object} callback Callback function taking one string argument and returning a string. | [
"Executes",
"a",
"callback",
"on",
"each",
"line",
"and",
"replaces",
"each",
"line",
"with",
"result",
"from",
"the",
"callback",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1352-L1361 |
23,576 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | padNumber | function padNumber(number, length)
{
var result = number.toString();
while (result.length < length)
result = '0' + result;
return result;
} | javascript | function padNumber(number, length)
{
var result = number.toString();
while (result.length < length)
result = '0' + result;
return result;
} | [
"function",
"padNumber",
"(",
"number",
",",
"length",
")",
"{",
"var",
"result",
"=",
"number",
".",
"toString",
"(",
")",
";",
"while",
"(",
"result",
".",
"length",
"<",
"length",
")",
"result",
"=",
"'0'",
"+",
"result",
";",
"return",
"result",
";",
"}"
] | Pads number with zeros until it's length is the same as given length.
@param {Number} number Number to pad.
@param {Number} length Max string length with.
@return {String} Returns a string padded with proper amount of '0'. | [
"Pads",
"number",
"with",
"zeros",
"until",
"it",
"s",
"length",
"is",
"the",
"same",
"as",
"given",
"length",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1484-L1492 |
23,577 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | processTabs | function processTabs(code, tabSize)
{
var tab = '';
for (var i = 0; i < tabSize; i++)
tab += ' ';
return code.replace(/\t/g, tab);
} | javascript | function processTabs(code, tabSize)
{
var tab = '';
for (var i = 0; i < tabSize; i++)
tab += ' ';
return code.replace(/\t/g, tab);
} | [
"function",
"processTabs",
"(",
"code",
",",
"tabSize",
")",
"{",
"var",
"tab",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"tabSize",
";",
"i",
"++",
")",
"tab",
"+=",
"' '",
";",
"return",
"code",
".",
"replace",
"(",
"/",
"\\t",
"/",
"g",
",",
"tab",
")",
";",
"}"
] | Replaces tabs with spaces.
@param {String} code Source code.
@param {Number} tabSize Size of the tab.
@return {String} Returns code with all tabs replaces by spaces. | [
"Replaces",
"tabs",
"with",
"spaces",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1501-L1509 |
23,578 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | processSmartTabs | function processSmartTabs(code, tabSize)
{
var lines = splitLines(code),
tab = '\t',
spaces = ''
;
// Create a string with 1000 spaces to copy spaces from...
// It's assumed that there would be no indentation longer than that.
for (var i = 0; i < 50; i++)
spaces += ' '; // 20 spaces * 50
// This function inserts specified amount of spaces in the string
// where a tab is while removing that given tab.
function insertSpaces(line, pos, count)
{
return line.substr(0, pos)
+ spaces.substr(0, count)
+ line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
;
};
// Go through all the lines and do the 'smart tabs' magic.
code = eachLine(code, function(line)
{
if (line.indexOf(tab) == -1)
return line;
var pos = 0;
while ((pos = line.indexOf(tab)) != -1)
{
// This is pretty much all there is to the 'smart tabs' logic.
// Based on the position within the line and size of a tab,
// calculate the amount of spaces we need to insert.
var spaces = tabSize - pos % tabSize;
line = insertSpaces(line, pos, spaces);
}
return line;
});
return code;
} | javascript | function processSmartTabs(code, tabSize)
{
var lines = splitLines(code),
tab = '\t',
spaces = ''
;
// Create a string with 1000 spaces to copy spaces from...
// It's assumed that there would be no indentation longer than that.
for (var i = 0; i < 50; i++)
spaces += ' '; // 20 spaces * 50
// This function inserts specified amount of spaces in the string
// where a tab is while removing that given tab.
function insertSpaces(line, pos, count)
{
return line.substr(0, pos)
+ spaces.substr(0, count)
+ line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
;
};
// Go through all the lines and do the 'smart tabs' magic.
code = eachLine(code, function(line)
{
if (line.indexOf(tab) == -1)
return line;
var pos = 0;
while ((pos = line.indexOf(tab)) != -1)
{
// This is pretty much all there is to the 'smart tabs' logic.
// Based on the position within the line and size of a tab,
// calculate the amount of spaces we need to insert.
var spaces = tabSize - pos % tabSize;
line = insertSpaces(line, pos, spaces);
}
return line;
});
return code;
} | [
"function",
"processSmartTabs",
"(",
"code",
",",
"tabSize",
")",
"{",
"var",
"lines",
"=",
"splitLines",
"(",
"code",
")",
",",
"tab",
"=",
"'\\t'",
",",
"spaces",
"=",
"''",
";",
"// Create a string with 1000 spaces to copy spaces from...",
"// It's assumed that there would be no indentation longer than that.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"50",
";",
"i",
"++",
")",
"spaces",
"+=",
"' '",
";",
"// 20 spaces * 50",
"// This function inserts specified amount of spaces in the string",
"// where a tab is while removing that given tab.",
"function",
"insertSpaces",
"(",
"line",
",",
"pos",
",",
"count",
")",
"{",
"return",
"line",
".",
"substr",
"(",
"0",
",",
"pos",
")",
"+",
"spaces",
".",
"substr",
"(",
"0",
",",
"count",
")",
"+",
"line",
".",
"substr",
"(",
"pos",
"+",
"1",
",",
"line",
".",
"length",
")",
"// pos + 1 will get rid of the tab",
";",
"}",
";",
"// Go through all the lines and do the 'smart tabs' magic.",
"code",
"=",
"eachLine",
"(",
"code",
",",
"function",
"(",
"line",
")",
"{",
"if",
"(",
"line",
".",
"indexOf",
"(",
"tab",
")",
"==",
"-",
"1",
")",
"return",
"line",
";",
"var",
"pos",
"=",
"0",
";",
"while",
"(",
"(",
"pos",
"=",
"line",
".",
"indexOf",
"(",
"tab",
")",
")",
"!=",
"-",
"1",
")",
"{",
"// This is pretty much all there is to the 'smart tabs' logic.",
"// Based on the position within the line and size of a tab,",
"// calculate the amount of spaces we need to insert.",
"var",
"spaces",
"=",
"tabSize",
"-",
"pos",
"%",
"tabSize",
";",
"line",
"=",
"insertSpaces",
"(",
"line",
",",
"pos",
",",
"spaces",
")",
";",
"}",
"return",
"line",
";",
"}",
")",
";",
"return",
"code",
";",
"}"
] | Replaces tabs with smart spaces.
@param {String} code Code to fix the tabs in.
@param {Number} tabSize Number of spaces in a column.
@return {String} Returns code with all tabs replaces with roper amount of spaces. | [
"Replaces",
"tabs",
"with",
"smart",
"spaces",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1518-L1561 |
23,579 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | insertSpaces | function insertSpaces(line, pos, count)
{
return line.substr(0, pos)
+ spaces.substr(0, count)
+ line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
;
} | javascript | function insertSpaces(line, pos, count)
{
return line.substr(0, pos)
+ spaces.substr(0, count)
+ line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
;
} | [
"function",
"insertSpaces",
"(",
"line",
",",
"pos",
",",
"count",
")",
"{",
"return",
"line",
".",
"substr",
"(",
"0",
",",
"pos",
")",
"+",
"spaces",
".",
"substr",
"(",
"0",
",",
"count",
")",
"+",
"line",
".",
"substr",
"(",
"pos",
"+",
"1",
",",
"line",
".",
"length",
")",
"// pos + 1 will get rid of the tab",
";",
"}"
] | This function inserts specified amount of spaces in the string where a tab is while removing that given tab. | [
"This",
"function",
"inserts",
"specified",
"amount",
"of",
"spaces",
"in",
"the",
"string",
"where",
"a",
"tab",
"is",
"while",
"removing",
"that",
"given",
"tab",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1532-L1538 |
23,580 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | fixInputString | function fixInputString(str)
{
var br = /<br\s*\/?>|<br\s*\/?>/gi;
if (sh.config.bloggerMode == true)
str = str.replace(br, '\n');
if (sh.config.stripBrs == true)
str = str.replace(br, '');
return str;
} | javascript | function fixInputString(str)
{
var br = /<br\s*\/?>|<br\s*\/?>/gi;
if (sh.config.bloggerMode == true)
str = str.replace(br, '\n');
if (sh.config.stripBrs == true)
str = str.replace(br, '');
return str;
} | [
"function",
"fixInputString",
"(",
"str",
")",
"{",
"var",
"br",
"=",
"/",
"<br\\s*\\/?>|<br\\s*\\/?>",
"/",
"gi",
";",
"if",
"(",
"sh",
".",
"config",
".",
"bloggerMode",
"==",
"true",
")",
"str",
"=",
"str",
".",
"replace",
"(",
"br",
",",
"'\\n'",
")",
";",
"if",
"(",
"sh",
".",
"config",
".",
"stripBrs",
"==",
"true",
")",
"str",
"=",
"str",
".",
"replace",
"(",
"br",
",",
"''",
")",
";",
"return",
"str",
";",
"}"
] | Performs various string fixes based on configuration. | [
"Performs",
"various",
"string",
"fixes",
"based",
"on",
"configuration",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1566-L1577 |
23,581 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | unindent | function unindent(str)
{
var lines = splitLines(fixInputString(str)),
indents = new Array(),
regex = /^\s*/,
min = 1000
;
// go through every line and check for common number of indents
for (var i = 0; i < lines.length && min > 0; i++)
{
var line = lines[i];
if (trim(line).length == 0)
continue;
var matches = regex.exec(line);
// In the event that just one line doesn't have leading white space
// we can't unindent anything, so bail completely.
if (matches == null)
return str;
min = Math.min(matches[0].length, min);
}
// trim minimum common number of white space from the begining of every line
if (min > 0)
for (var i = 0; i < lines.length; i++)
lines[i] = lines[i].substr(min);
return lines.join('\n');
} | javascript | function unindent(str)
{
var lines = splitLines(fixInputString(str)),
indents = new Array(),
regex = /^\s*/,
min = 1000
;
// go through every line and check for common number of indents
for (var i = 0; i < lines.length && min > 0; i++)
{
var line = lines[i];
if (trim(line).length == 0)
continue;
var matches = regex.exec(line);
// In the event that just one line doesn't have leading white space
// we can't unindent anything, so bail completely.
if (matches == null)
return str;
min = Math.min(matches[0].length, min);
}
// trim minimum common number of white space from the begining of every line
if (min > 0)
for (var i = 0; i < lines.length; i++)
lines[i] = lines[i].substr(min);
return lines.join('\n');
} | [
"function",
"unindent",
"(",
"str",
")",
"{",
"var",
"lines",
"=",
"splitLines",
"(",
"fixInputString",
"(",
"str",
")",
")",
",",
"indents",
"=",
"new",
"Array",
"(",
")",
",",
"regex",
"=",
"/",
"^\\s*",
"/",
",",
"min",
"=",
"1000",
";",
"// go through every line and check for common number of indents",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
"&&",
"min",
">",
"0",
";",
"i",
"++",
")",
"{",
"var",
"line",
"=",
"lines",
"[",
"i",
"]",
";",
"if",
"(",
"trim",
"(",
"line",
")",
".",
"length",
"==",
"0",
")",
"continue",
";",
"var",
"matches",
"=",
"regex",
".",
"exec",
"(",
"line",
")",
";",
"// In the event that just one line doesn't have leading white space",
"// we can't unindent anything, so bail completely.",
"if",
"(",
"matches",
"==",
"null",
")",
"return",
"str",
";",
"min",
"=",
"Math",
".",
"min",
"(",
"matches",
"[",
"0",
"]",
".",
"length",
",",
"min",
")",
";",
"}",
"// trim minimum common number of white space from the begining of every line",
"if",
"(",
"min",
">",
"0",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"lines",
"[",
"i",
"]",
"=",
"lines",
"[",
"i",
"]",
".",
"substr",
"(",
"min",
")",
";",
"return",
"lines",
".",
"join",
"(",
"'\\n'",
")",
";",
"}"
] | Unindents a block of text by the lowest common indent amount.
@param {String} str Text to unindent.
@return {String} Returns unindented text block. | [
"Unindents",
"a",
"block",
"of",
"text",
"by",
"the",
"lowest",
"common",
"indent",
"amount",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1595-L1627 |
23,582 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | getMatches | function getMatches(code, regexInfo)
{
function defaultAdd(match, regexInfo)
{
return match[0];
};
var index = 0,
match = null,
matches = [],
func = regexInfo.func ? regexInfo.func : defaultAdd
;
while((match = regexInfo.regex.exec(code)) != null)
{
var resultMatch = func(match, regexInfo);
if (typeof(resultMatch) == 'string')
resultMatch = [new sh.Match(resultMatch, match.index, regexInfo.css)];
matches = matches.concat(resultMatch);
}
return matches;
} | javascript | function getMatches(code, regexInfo)
{
function defaultAdd(match, regexInfo)
{
return match[0];
};
var index = 0,
match = null,
matches = [],
func = regexInfo.func ? regexInfo.func : defaultAdd
;
while((match = regexInfo.regex.exec(code)) != null)
{
var resultMatch = func(match, regexInfo);
if (typeof(resultMatch) == 'string')
resultMatch = [new sh.Match(resultMatch, match.index, regexInfo.css)];
matches = matches.concat(resultMatch);
}
return matches;
} | [
"function",
"getMatches",
"(",
"code",
",",
"regexInfo",
")",
"{",
"function",
"defaultAdd",
"(",
"match",
",",
"regexInfo",
")",
"{",
"return",
"match",
"[",
"0",
"]",
";",
"}",
";",
"var",
"index",
"=",
"0",
",",
"match",
"=",
"null",
",",
"matches",
"=",
"[",
"]",
",",
"func",
"=",
"regexInfo",
".",
"func",
"?",
"regexInfo",
".",
"func",
":",
"defaultAdd",
";",
"while",
"(",
"(",
"match",
"=",
"regexInfo",
".",
"regex",
".",
"exec",
"(",
"code",
")",
")",
"!=",
"null",
")",
"{",
"var",
"resultMatch",
"=",
"func",
"(",
"match",
",",
"regexInfo",
")",
";",
"if",
"(",
"typeof",
"(",
"resultMatch",
")",
"==",
"'string'",
")",
"resultMatch",
"=",
"[",
"new",
"sh",
".",
"Match",
"(",
"resultMatch",
",",
"match",
".",
"index",
",",
"regexInfo",
".",
"css",
")",
"]",
";",
"matches",
"=",
"matches",
".",
"concat",
"(",
"resultMatch",
")",
";",
"}",
"return",
"matches",
";",
"}"
] | Executes given regular expression on provided code and returns all
matches that are found.
@param {String} code Code to execute regular expression on.
@param {Object} regex Regular expression item info from <code>regexList</code> collection.
@return {Array} Returns a list of Match objects. | [
"Executes",
"given",
"regular",
"expression",
"on",
"provided",
"code",
"and",
"returns",
"all",
"matches",
"that",
"are",
"found",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1664-L1688 |
23,583 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | quickCodeHandler | function quickCodeHandler(e)
{
var target = e.target,
highlighterDiv = findParentElement(target, '.syntaxhighlighter'),
container = findParentElement(target, '.container'),
textarea = document.createElement('textarea'),
highlighter
;
if (!container || !highlighterDiv || findElement(container, 'textarea'))
return;
highlighter = getHighlighterById(highlighterDiv.id);
// add source class name
addClass(highlighterDiv, 'source');
// Have to go over each line and grab it's text, can't just do it on the
// container because Firefox loses all \n where as Webkit doesn't.
var lines = container.childNodes,
code = []
;
for (var i = 0; i < lines.length; i++)
code.push(lines[i].innerText || lines[i].textContent);
// using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit
code = code.join('\r');
// For Webkit browsers, replace nbsp with a breaking space
code = code.replace(/\u00a0/g, " ");
// inject <textarea/> tag
textarea.appendChild(document.createTextNode(code));
container.appendChild(textarea);
// preselect all text
textarea.focus();
textarea.select();
// set up handler for lost focus
attachEvent(textarea, 'blur', function(e)
{
textarea.parentNode.removeChild(textarea);
removeClass(highlighterDiv, 'source');
});
} | javascript | function quickCodeHandler(e)
{
var target = e.target,
highlighterDiv = findParentElement(target, '.syntaxhighlighter'),
container = findParentElement(target, '.container'),
textarea = document.createElement('textarea'),
highlighter
;
if (!container || !highlighterDiv || findElement(container, 'textarea'))
return;
highlighter = getHighlighterById(highlighterDiv.id);
// add source class name
addClass(highlighterDiv, 'source');
// Have to go over each line and grab it's text, can't just do it on the
// container because Firefox loses all \n where as Webkit doesn't.
var lines = container.childNodes,
code = []
;
for (var i = 0; i < lines.length; i++)
code.push(lines[i].innerText || lines[i].textContent);
// using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit
code = code.join('\r');
// For Webkit browsers, replace nbsp with a breaking space
code = code.replace(/\u00a0/g, " ");
// inject <textarea/> tag
textarea.appendChild(document.createTextNode(code));
container.appendChild(textarea);
// preselect all text
textarea.focus();
textarea.select();
// set up handler for lost focus
attachEvent(textarea, 'blur', function(e)
{
textarea.parentNode.removeChild(textarea);
removeClass(highlighterDiv, 'source');
});
} | [
"function",
"quickCodeHandler",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
",",
"highlighterDiv",
"=",
"findParentElement",
"(",
"target",
",",
"'.syntaxhighlighter'",
")",
",",
"container",
"=",
"findParentElement",
"(",
"target",
",",
"'.container'",
")",
",",
"textarea",
"=",
"document",
".",
"createElement",
"(",
"'textarea'",
")",
",",
"highlighter",
";",
"if",
"(",
"!",
"container",
"||",
"!",
"highlighterDiv",
"||",
"findElement",
"(",
"container",
",",
"'textarea'",
")",
")",
"return",
";",
"highlighter",
"=",
"getHighlighterById",
"(",
"highlighterDiv",
".",
"id",
")",
";",
"// add source class name",
"addClass",
"(",
"highlighterDiv",
",",
"'source'",
")",
";",
"// Have to go over each line and grab it's text, can't just do it on the",
"// container because Firefox loses all \\n where as Webkit doesn't.",
"var",
"lines",
"=",
"container",
".",
"childNodes",
",",
"code",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"code",
".",
"push",
"(",
"lines",
"[",
"i",
"]",
".",
"innerText",
"||",
"lines",
"[",
"i",
"]",
".",
"textContent",
")",
";",
"// using \\r instead of \\r or \\r\\n makes this work equally well on IE, FF and Webkit",
"code",
"=",
"code",
".",
"join",
"(",
"'\\r'",
")",
";",
"// For Webkit browsers, replace nbsp with a breaking space",
"code",
"=",
"code",
".",
"replace",
"(",
"/",
"\\u00a0",
"/",
"g",
",",
"\" \"",
")",
";",
"// inject <textarea/> tag",
"textarea",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"code",
")",
")",
";",
"container",
".",
"appendChild",
"(",
"textarea",
")",
";",
"// preselect all text",
"textarea",
".",
"focus",
"(",
")",
";",
"textarea",
".",
"select",
"(",
")",
";",
"// set up handler for lost focus",
"attachEvent",
"(",
"textarea",
",",
"'blur'",
",",
"function",
"(",
"e",
")",
"{",
"textarea",
".",
"parentNode",
".",
"removeChild",
"(",
"textarea",
")",
";",
"removeClass",
"(",
"highlighterDiv",
",",
"'source'",
")",
";",
"}",
")",
";",
"}"
] | Quick code mouse double click handler. | [
"Quick",
"code",
"mouse",
"double",
"click",
"handler",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1774-L1820 |
23,584 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(name, defaultValue)
{
var result = this.params[name];
return toBoolean(result == null ? defaultValue : result);
} | javascript | function(name, defaultValue)
{
var result = this.params[name];
return toBoolean(result == null ? defaultValue : result);
} | [
"function",
"(",
"name",
",",
"defaultValue",
")",
"{",
"var",
"result",
"=",
"this",
".",
"params",
"[",
"name",
"]",
";",
"return",
"toBoolean",
"(",
"result",
"==",
"null",
"?",
"defaultValue",
":",
"result",
")",
";",
"}"
] | Returns value of the parameter passed to the highlighter.
@param {String} name Name of the parameter.
@param {Object} defaultValue Default value.
@return {Object} Returns found value or default value otherwise. | [
"Returns",
"value",
"of",
"the",
"parameter",
"passed",
"to",
"the",
"highlighter",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1943-L1947 | |
23,585 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(regexList, code)
{
var result = [];
if (regexList != null)
for (var i = 0; i < regexList.length; i++)
// BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
if (typeof (regexList[i]) == "object")
result = result.concat(getMatches(code, regexList[i]));
// sort and remove nested the matches
return this.removeNestedMatches(result.sort(matchesSortCallback));
} | javascript | function(regexList, code)
{
var result = [];
if (regexList != null)
for (var i = 0; i < regexList.length; i++)
// BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
if (typeof (regexList[i]) == "object")
result = result.concat(getMatches(code, regexList[i]));
// sort and remove nested the matches
return this.removeNestedMatches(result.sort(matchesSortCallback));
} | [
"function",
"(",
"regexList",
",",
"code",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"regexList",
"!=",
"null",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"regexList",
".",
"length",
";",
"i",
"++",
")",
"// BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)",
"if",
"(",
"typeof",
"(",
"regexList",
"[",
"i",
"]",
")",
"==",
"\"object\"",
")",
"result",
"=",
"result",
".",
"concat",
"(",
"getMatches",
"(",
"code",
",",
"regexList",
"[",
"i",
"]",
")",
")",
";",
"// sort and remove nested the matches",
"return",
"this",
".",
"removeNestedMatches",
"(",
"result",
".",
"sort",
"(",
"matchesSortCallback",
")",
")",
";",
"}"
] | Applies all regular expression to the code and stores all found
matches in the `this.matches` array.
@param {Array} regexList List of regular expressions.
@param {String} code Source code.
@return {Array} Returns list of matches. | [
"Applies",
"all",
"regular",
"expression",
"to",
"the",
"code",
"and",
"stores",
"all",
"found",
"matches",
"in",
"the",
"this",
".",
"matches",
"array",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1966-L1978 | |
23,586 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(matches)
{
// Optimized by Jose Prado (http://joseprado.com)
for (var i = 0; i < matches.length; i++)
{
if (matches[i] === null)
continue;
var itemI = matches[i],
itemIEndPos = itemI.index + itemI.length
;
for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
{
var itemJ = matches[j];
if (itemJ === null)
continue;
else if (itemJ.index > itemIEndPos)
break;
else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
matches[i] = null;
else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
matches[j] = null;
}
}
return matches;
} | javascript | function(matches)
{
// Optimized by Jose Prado (http://joseprado.com)
for (var i = 0; i < matches.length; i++)
{
if (matches[i] === null)
continue;
var itemI = matches[i],
itemIEndPos = itemI.index + itemI.length
;
for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
{
var itemJ = matches[j];
if (itemJ === null)
continue;
else if (itemJ.index > itemIEndPos)
break;
else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
matches[i] = null;
else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
matches[j] = null;
}
}
return matches;
} | [
"function",
"(",
"matches",
")",
"{",
"// Optimized by Jose Prado (http://joseprado.com)",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"matches",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"matches",
"[",
"i",
"]",
"===",
"null",
")",
"continue",
";",
"var",
"itemI",
"=",
"matches",
"[",
"i",
"]",
",",
"itemIEndPos",
"=",
"itemI",
".",
"index",
"+",
"itemI",
".",
"length",
";",
"for",
"(",
"var",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"matches",
".",
"length",
"&&",
"matches",
"[",
"i",
"]",
"!==",
"null",
";",
"j",
"++",
")",
"{",
"var",
"itemJ",
"=",
"matches",
"[",
"j",
"]",
";",
"if",
"(",
"itemJ",
"===",
"null",
")",
"continue",
";",
"else",
"if",
"(",
"itemJ",
".",
"index",
">",
"itemIEndPos",
")",
"break",
";",
"else",
"if",
"(",
"itemJ",
".",
"index",
"==",
"itemI",
".",
"index",
"&&",
"itemJ",
".",
"length",
">",
"itemI",
".",
"length",
")",
"matches",
"[",
"i",
"]",
"=",
"null",
";",
"else",
"if",
"(",
"itemJ",
".",
"index",
">=",
"itemI",
".",
"index",
"&&",
"itemJ",
".",
"index",
"<",
"itemIEndPos",
")",
"matches",
"[",
"j",
"]",
"=",
"null",
";",
"}",
"}",
"return",
"matches",
";",
"}"
] | Checks to see if any of the matches are inside of other matches.
This process would get rid of highligted strings inside comments,
keywords inside strings and so on. | [
"Checks",
"to",
"see",
"if",
"any",
"of",
"the",
"matches",
"are",
"inside",
"of",
"other",
"matches",
".",
"This",
"process",
"would",
"get",
"rid",
"of",
"highligted",
"strings",
"inside",
"comments",
"keywords",
"inside",
"strings",
"and",
"so",
"on",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L1985-L2013 | |
23,587 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(lineNumber)
{
var list = this.getParam('highlight', []);
if (typeof(list) != 'object' && list.push == null)
list = [ list ];
return indexOf(list, lineNumber.toString()) != -1;
} | javascript | function(lineNumber)
{
var list = this.getParam('highlight', []);
if (typeof(list) != 'object' && list.push == null)
list = [ list ];
return indexOf(list, lineNumber.toString()) != -1;
} | [
"function",
"(",
"lineNumber",
")",
"{",
"var",
"list",
"=",
"this",
".",
"getParam",
"(",
"'highlight'",
",",
"[",
"]",
")",
";",
"if",
"(",
"typeof",
"(",
"list",
")",
"!=",
"'object'",
"&&",
"list",
".",
"push",
"==",
"null",
")",
"list",
"=",
"[",
"list",
"]",
";",
"return",
"indexOf",
"(",
"list",
",",
"lineNumber",
".",
"toString",
"(",
")",
")",
"!=",
"-",
"1",
";",
"}"
] | Determines if specified line number is in the highlighted list. | [
"Determines",
"if",
"specified",
"line",
"number",
"is",
"in",
"the",
"highlighted",
"list",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L2036-L2044 | |
23,588 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(code)
{
if (code === null)
code = '';
this.code = code;
var div = this.create('div');
// create main HTML
div.innerHTML = this.getHtml(code);
// set up click handlers
if (this.getParam('toolbar'))
attachEvent(findElement(div, '.toolbar'), 'click', sh.toolbar.handler);
if (this.getParam('quick-code'))
attachEvent(findElement(div, '.code'), 'dblclick', quickCodeHandler);
return div;
} | javascript | function(code)
{
if (code === null)
code = '';
this.code = code;
var div = this.create('div');
// create main HTML
div.innerHTML = this.getHtml(code);
// set up click handlers
if (this.getParam('toolbar'))
attachEvent(findElement(div, '.toolbar'), 'click', sh.toolbar.handler);
if (this.getParam('quick-code'))
attachEvent(findElement(div, '.code'), 'dblclick', quickCodeHandler);
return div;
} | [
"function",
"(",
"code",
")",
"{",
"if",
"(",
"code",
"===",
"null",
")",
"code",
"=",
"''",
";",
"this",
".",
"code",
"=",
"code",
";",
"var",
"div",
"=",
"this",
".",
"create",
"(",
"'div'",
")",
";",
"// create main HTML",
"div",
".",
"innerHTML",
"=",
"this",
".",
"getHtml",
"(",
"code",
")",
";",
"// set up click handlers",
"if",
"(",
"this",
".",
"getParam",
"(",
"'toolbar'",
")",
")",
"attachEvent",
"(",
"findElement",
"(",
"div",
",",
"'.toolbar'",
")",
",",
"'click'",
",",
"sh",
".",
"toolbar",
".",
"handler",
")",
";",
"if",
"(",
"this",
".",
"getParam",
"(",
"'quick-code'",
")",
")",
"attachEvent",
"(",
"findElement",
"(",
"div",
",",
"'.code'",
")",
",",
"'dblclick'",
",",
"quickCodeHandler",
")",
";",
"return",
"div",
";",
"}"
] | Highlights the code and returns complete HTML.
@param {String} code Code to highlight.
@return {Element} Returns container DIV element with all markup. | [
"Highlights",
"the",
"code",
"and",
"returns",
"complete",
"HTML",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L2293-L2313 | |
23,589 | sealice/koa2-ueditor | example/public/ueditor/third-party/SyntaxHighlighter/shCore.js | function(regexGroup)
{
var regex = { 'end' : regexGroup.right.source };
if(regexGroup.eof)
regex.end = "(?:(?:" + regex.end + ")|$)";
this.htmlScript = {
left : { regex: regexGroup.left, css: 'script' },
right : { regex: regexGroup.right, css: 'script' },
code : new XRegExp(
"(?<left>" + regexGroup.left.source + ")" +
"(?<code>.*?)" +
"(?<right>" + regex.end + ")",
"sgi"
)
};
} | javascript | function(regexGroup)
{
var regex = { 'end' : regexGroup.right.source };
if(regexGroup.eof)
regex.end = "(?:(?:" + regex.end + ")|$)";
this.htmlScript = {
left : { regex: regexGroup.left, css: 'script' },
right : { regex: regexGroup.right, css: 'script' },
code : new XRegExp(
"(?<left>" + regexGroup.left.source + ")" +
"(?<code>.*?)" +
"(?<right>" + regex.end + ")",
"sgi"
)
};
} | [
"function",
"(",
"regexGroup",
")",
"{",
"var",
"regex",
"=",
"{",
"'end'",
":",
"regexGroup",
".",
"right",
".",
"source",
"}",
";",
"if",
"(",
"regexGroup",
".",
"eof",
")",
"regex",
".",
"end",
"=",
"\"(?:(?:\"",
"+",
"regex",
".",
"end",
"+",
"\")|$)\"",
";",
"this",
".",
"htmlScript",
"=",
"{",
"left",
":",
"{",
"regex",
":",
"regexGroup",
".",
"left",
",",
"css",
":",
"'script'",
"}",
",",
"right",
":",
"{",
"regex",
":",
"regexGroup",
".",
"right",
",",
"css",
":",
"'script'",
"}",
",",
"code",
":",
"new",
"XRegExp",
"(",
"\"(?<left>\"",
"+",
"regexGroup",
".",
"left",
".",
"source",
"+",
"\")\"",
"+",
"\"(?<code>.*?)\"",
"+",
"\"(?<right>\"",
"+",
"regex",
".",
"end",
"+",
"\")\"",
",",
"\"sgi\"",
")",
"}",
";",
"}"
] | Makes a brush compatible with the `html-script` functionality.
@param {Object} regexGroup Object containing `left` and `right` regular expressions. | [
"Makes",
"a",
"brush",
"compatible",
"with",
"the",
"html",
"-",
"script",
"functionality",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/SyntaxHighlighter/shCore.js#L2357-L2374 | |
23,590 | sealice/koa2-ueditor | example/public/ueditor/third-party/video-js/video.dev.js | function(id, options, ready){
var tag; // Element of ID
// Allow for element or ID to be passed in
// String ID
if (typeof id === 'string') {
// Adjust for jQuery ID syntax
if (id.indexOf('#') === 0) {
id = id.slice(1);
}
// If a player instance has already been created for this ID return it.
if (vjs.players[id]) {
return vjs.players[id];
// Otherwise get element for ID
} else {
tag = vjs.el(id);
}
// ID is a media element
} else {
tag = id;
}
// Check for a useable element
if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
throw new TypeError('The element or ID supplied is not valid. (videojs)'); // Returns
}
// Element may have a player attr referring to an already created player instance.
// If not, set up a new player and return the instance.
return tag['player'] || new vjs.Player(tag, options, ready);
} | javascript | function(id, options, ready){
var tag; // Element of ID
// Allow for element or ID to be passed in
// String ID
if (typeof id === 'string') {
// Adjust for jQuery ID syntax
if (id.indexOf('#') === 0) {
id = id.slice(1);
}
// If a player instance has already been created for this ID return it.
if (vjs.players[id]) {
return vjs.players[id];
// Otherwise get element for ID
} else {
tag = vjs.el(id);
}
// ID is a media element
} else {
tag = id;
}
// Check for a useable element
if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
throw new TypeError('The element or ID supplied is not valid. (videojs)'); // Returns
}
// Element may have a player attr referring to an already created player instance.
// If not, set up a new player and return the instance.
return tag['player'] || new vjs.Player(tag, options, ready);
} | [
"function",
"(",
"id",
",",
"options",
",",
"ready",
")",
"{",
"var",
"tag",
";",
"// Element of ID",
"// Allow for element or ID to be passed in",
"// String ID",
"if",
"(",
"typeof",
"id",
"===",
"'string'",
")",
"{",
"// Adjust for jQuery ID syntax",
"if",
"(",
"id",
".",
"indexOf",
"(",
"'#'",
")",
"===",
"0",
")",
"{",
"id",
"=",
"id",
".",
"slice",
"(",
"1",
")",
";",
"}",
"// If a player instance has already been created for this ID return it.",
"if",
"(",
"vjs",
".",
"players",
"[",
"id",
"]",
")",
"{",
"return",
"vjs",
".",
"players",
"[",
"id",
"]",
";",
"// Otherwise get element for ID",
"}",
"else",
"{",
"tag",
"=",
"vjs",
".",
"el",
"(",
"id",
")",
";",
"}",
"// ID is a media element",
"}",
"else",
"{",
"tag",
"=",
"id",
";",
"}",
"// Check for a useable element",
"if",
"(",
"!",
"tag",
"||",
"!",
"tag",
".",
"nodeName",
")",
"{",
"// re: nodeName, could be a box div also",
"throw",
"new",
"TypeError",
"(",
"'The element or ID supplied is not valid. (videojs)'",
")",
";",
"// Returns",
"}",
"// Element may have a player attr referring to an already created player instance.",
"// If not, set up a new player and return the instance.",
"return",
"tag",
"[",
"'player'",
"]",
"||",
"new",
"vjs",
".",
"Player",
"(",
"tag",
",",
"options",
",",
"ready",
")",
";",
"}"
] | Doubles as the main function for users to create a player instance and also
the main library object.
**ALIASES** videojs, _V_ (deprecated)
The `vjs` function can be used to initialize or retrieve a player.
var myPlayer = vjs('my_video_id');
@param {String|Element} id Video element or video element ID
@param {Object=} options Optional options object for config/settings
@param {Function=} ready Optional ready callback
@return {vjs.Player} A player instance
@namespace | [
"Doubles",
"as",
"the",
"main",
"function",
"for",
"users",
"to",
"create",
"a",
"player",
"instance",
"and",
"also",
"the",
"main",
"library",
"object",
"."
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/video-js/video.dev.js#L26-L60 | |
23,591 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/data.src.js | function () {
var self = this,
options = this.options,
csv = options.csv,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
lines,
activeRowNo = 0;
if (csv) {
lines = csv
.replace(/\r\n/g, "\n") // Unix
.replace(/\r/g, "\n") // Mac
.split(options.lineDelimiter || "\n");
each(lines, function (line, rowNo) {
var trimmed = self.trim(line),
isComment = trimmed.indexOf('#') === 0,
isBlank = trimmed === '',
items;
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) {
items = line.split(options.itemDelimiter || ',');
each(items, function (item, colNo) {
if (colNo >= startColumn && colNo <= endColumn) {
if (!columns[colNo - startColumn]) {
columns[colNo - startColumn] = [];
}
columns[colNo - startColumn][activeRowNo] = item;
}
});
activeRowNo += 1;
}
});
this.dataFound();
}
} | javascript | function () {
var self = this,
options = this.options,
csv = options.csv,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
lines,
activeRowNo = 0;
if (csv) {
lines = csv
.replace(/\r\n/g, "\n") // Unix
.replace(/\r/g, "\n") // Mac
.split(options.lineDelimiter || "\n");
each(lines, function (line, rowNo) {
var trimmed = self.trim(line),
isComment = trimmed.indexOf('#') === 0,
isBlank = trimmed === '',
items;
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) {
items = line.split(options.itemDelimiter || ',');
each(items, function (item, colNo) {
if (colNo >= startColumn && colNo <= endColumn) {
if (!columns[colNo - startColumn]) {
columns[colNo - startColumn] = [];
}
columns[colNo - startColumn][activeRowNo] = item;
}
});
activeRowNo += 1;
}
});
this.dataFound();
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"options",
"=",
"this",
".",
"options",
",",
"csv",
"=",
"options",
".",
"csv",
",",
"columns",
"=",
"this",
".",
"columns",
",",
"startRow",
"=",
"options",
".",
"startRow",
"||",
"0",
",",
"endRow",
"=",
"options",
".",
"endRow",
"||",
"Number",
".",
"MAX_VALUE",
",",
"startColumn",
"=",
"options",
".",
"startColumn",
"||",
"0",
",",
"endColumn",
"=",
"options",
".",
"endColumn",
"||",
"Number",
".",
"MAX_VALUE",
",",
"lines",
",",
"activeRowNo",
"=",
"0",
";",
"if",
"(",
"csv",
")",
"{",
"lines",
"=",
"csv",
".",
"replace",
"(",
"/",
"\\r\\n",
"/",
"g",
",",
"\"\\n\"",
")",
"// Unix",
".",
"replace",
"(",
"/",
"\\r",
"/",
"g",
",",
"\"\\n\"",
")",
"// Mac",
".",
"split",
"(",
"options",
".",
"lineDelimiter",
"||",
"\"\\n\"",
")",
";",
"each",
"(",
"lines",
",",
"function",
"(",
"line",
",",
"rowNo",
")",
"{",
"var",
"trimmed",
"=",
"self",
".",
"trim",
"(",
"line",
")",
",",
"isComment",
"=",
"trimmed",
".",
"indexOf",
"(",
"'#'",
")",
"===",
"0",
",",
"isBlank",
"=",
"trimmed",
"===",
"''",
",",
"items",
";",
"if",
"(",
"rowNo",
">=",
"startRow",
"&&",
"rowNo",
"<=",
"endRow",
"&&",
"!",
"isComment",
"&&",
"!",
"isBlank",
")",
"{",
"items",
"=",
"line",
".",
"split",
"(",
"options",
".",
"itemDelimiter",
"||",
"','",
")",
";",
"each",
"(",
"items",
",",
"function",
"(",
"item",
",",
"colNo",
")",
"{",
"if",
"(",
"colNo",
">=",
"startColumn",
"&&",
"colNo",
"<=",
"endColumn",
")",
"{",
"if",
"(",
"!",
"columns",
"[",
"colNo",
"-",
"startColumn",
"]",
")",
"{",
"columns",
"[",
"colNo",
"-",
"startColumn",
"]",
"=",
"[",
"]",
";",
"}",
"columns",
"[",
"colNo",
"-",
"startColumn",
"]",
"[",
"activeRowNo",
"]",
"=",
"item",
";",
"}",
"}",
")",
";",
"activeRowNo",
"+=",
"1",
";",
"}",
"}",
")",
";",
"this",
".",
"dataFound",
"(",
")",
";",
"}",
"}"
] | Parse a CSV input string | [
"Parse",
"a",
"CSV",
"input",
"string"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L166-L208 | |
23,592 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/data.src.js | function () {
var options = this.options,
table = options.table,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
colNo;
if (table) {
if (typeof table === 'string') {
table = document.getElementById(table);
}
each(table.getElementsByTagName('tr'), function (tr, rowNo) {
colNo = 0;
if (rowNo >= startRow && rowNo <= endRow) {
each(tr.childNodes, function (item) {
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) {
if (!columns[colNo]) {
columns[colNo] = [];
}
columns[colNo][rowNo - startRow] = item.innerHTML;
colNo += 1;
}
});
}
});
this.dataFound(); // continue
}
} | javascript | function () {
var options = this.options,
table = options.table,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
colNo;
if (table) {
if (typeof table === 'string') {
table = document.getElementById(table);
}
each(table.getElementsByTagName('tr'), function (tr, rowNo) {
colNo = 0;
if (rowNo >= startRow && rowNo <= endRow) {
each(tr.childNodes, function (item) {
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) {
if (!columns[colNo]) {
columns[colNo] = [];
}
columns[colNo][rowNo - startRow] = item.innerHTML;
colNo += 1;
}
});
}
});
this.dataFound(); // continue
}
} | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"table",
"=",
"options",
".",
"table",
",",
"columns",
"=",
"this",
".",
"columns",
",",
"startRow",
"=",
"options",
".",
"startRow",
"||",
"0",
",",
"endRow",
"=",
"options",
".",
"endRow",
"||",
"Number",
".",
"MAX_VALUE",
",",
"startColumn",
"=",
"options",
".",
"startColumn",
"||",
"0",
",",
"endColumn",
"=",
"options",
".",
"endColumn",
"||",
"Number",
".",
"MAX_VALUE",
",",
"colNo",
";",
"if",
"(",
"table",
")",
"{",
"if",
"(",
"typeof",
"table",
"===",
"'string'",
")",
"{",
"table",
"=",
"document",
".",
"getElementById",
"(",
"table",
")",
";",
"}",
"each",
"(",
"table",
".",
"getElementsByTagName",
"(",
"'tr'",
")",
",",
"function",
"(",
"tr",
",",
"rowNo",
")",
"{",
"colNo",
"=",
"0",
";",
"if",
"(",
"rowNo",
">=",
"startRow",
"&&",
"rowNo",
"<=",
"endRow",
")",
"{",
"each",
"(",
"tr",
".",
"childNodes",
",",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"(",
"item",
".",
"tagName",
"===",
"'TD'",
"||",
"item",
".",
"tagName",
"===",
"'TH'",
")",
"&&",
"colNo",
">=",
"startColumn",
"&&",
"colNo",
"<=",
"endColumn",
")",
"{",
"if",
"(",
"!",
"columns",
"[",
"colNo",
"]",
")",
"{",
"columns",
"[",
"colNo",
"]",
"=",
"[",
"]",
";",
"}",
"columns",
"[",
"colNo",
"]",
"[",
"rowNo",
"-",
"startRow",
"]",
"=",
"item",
".",
"innerHTML",
";",
"colNo",
"+=",
"1",
";",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"this",
".",
"dataFound",
"(",
")",
";",
"// continue",
"}",
"}"
] | Parse a HTML table | [
"Parse",
"a",
"HTML",
"table"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L213-L247 | |
23,593 | sealice/koa2-ueditor | example/public/ueditor/third-party/highcharts/modules/data.src.js | function (rows) {
var row,
rowsLength,
col,
colsLength,
columns;
if (rows) {
columns = [];
rowsLength = rows.length;
for (row = 0; row < rowsLength; row++) {
colsLength = rows[row].length;
for (col = 0; col < colsLength; col++) {
if (!columns[col]) {
columns[col] = [];
}
columns[col][row] = rows[row][col];
}
}
}
return columns;
} | javascript | function (rows) {
var row,
rowsLength,
col,
colsLength,
columns;
if (rows) {
columns = [];
rowsLength = rows.length;
for (row = 0; row < rowsLength; row++) {
colsLength = rows[row].length;
for (col = 0; col < colsLength; col++) {
if (!columns[col]) {
columns[col] = [];
}
columns[col][row] = rows[row][col];
}
}
}
return columns;
} | [
"function",
"(",
"rows",
")",
"{",
"var",
"row",
",",
"rowsLength",
",",
"col",
",",
"colsLength",
",",
"columns",
";",
"if",
"(",
"rows",
")",
"{",
"columns",
"=",
"[",
"]",
";",
"rowsLength",
"=",
"rows",
".",
"length",
";",
"for",
"(",
"row",
"=",
"0",
";",
"row",
"<",
"rowsLength",
";",
"row",
"++",
")",
"{",
"colsLength",
"=",
"rows",
"[",
"row",
"]",
".",
"length",
";",
"for",
"(",
"col",
"=",
"0",
";",
"col",
"<",
"colsLength",
";",
"col",
"++",
")",
"{",
"if",
"(",
"!",
"columns",
"[",
"col",
"]",
")",
"{",
"columns",
"[",
"col",
"]",
"=",
"[",
"]",
";",
"}",
"columns",
"[",
"col",
"]",
"[",
"row",
"]",
"=",
"rows",
"[",
"row",
"]",
"[",
"col",
"]",
";",
"}",
"}",
"}",
"return",
"columns",
";",
"}"
] | Reorganize rows into columns | [
"Reorganize",
"rows",
"into",
"columns"
] | 89fa1cc70f0375fafe023c88692fc27c83f2cd98 | https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L425-L446 | |
23,594 | anvaka/ngraph.centrality | src/closeness.js | closeness | function closeness(graph, oriented) {
var Q = [];
// list of predecessors on shortest paths from source
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality);
return centrality;
function setCentralityToZero(node) {
centrality[node.id] = 0;
}
function calculateCentrality(node) {
currentNode = node.id;
singleSourceShortestPath(currentNode);
accumulate();
}
function accumulate() {
// Add all distances for node to array, excluding -1s
var distances = Object.keys(dist).map(function(key) {return dist[key]}).filter(function(val){return val !== -1});
// Set number of reachable nodes
var reachableNodesTotal = distances.length;
// Compute sum of all distances for node
var totalDistance = distances.reduce(function(a,b) { return a + b });
if (totalDistance > 0) {
centrality[currentNode] = ((reachableNodesTotal - 1) / totalDistance);
} else {
centrality[currentNode] = 0;
}
}
function singleSourceShortestPath(source) {
graph.forEachNode(initNode);
dist[source] = 0;
Q.push(source);
while (Q.length) {
var v = Q.shift();
graph.forEachLinkedNode(v, processNode, oriented);
}
function initNode(node) {
var nodeId = node.id;
dist[nodeId] = -1;
}
function processNode(otherNode) {
var w = otherNode.id
if (dist[w] === -1) {
// Node w is found for the first time
dist[w] = dist[v] + 1;
Q.push(w);
}
}
}
} | javascript | function closeness(graph, oriented) {
var Q = [];
// list of predecessors on shortest paths from source
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality);
return centrality;
function setCentralityToZero(node) {
centrality[node.id] = 0;
}
function calculateCentrality(node) {
currentNode = node.id;
singleSourceShortestPath(currentNode);
accumulate();
}
function accumulate() {
// Add all distances for node to array, excluding -1s
var distances = Object.keys(dist).map(function(key) {return dist[key]}).filter(function(val){return val !== -1});
// Set number of reachable nodes
var reachableNodesTotal = distances.length;
// Compute sum of all distances for node
var totalDistance = distances.reduce(function(a,b) { return a + b });
if (totalDistance > 0) {
centrality[currentNode] = ((reachableNodesTotal - 1) / totalDistance);
} else {
centrality[currentNode] = 0;
}
}
function singleSourceShortestPath(source) {
graph.forEachNode(initNode);
dist[source] = 0;
Q.push(source);
while (Q.length) {
var v = Q.shift();
graph.forEachLinkedNode(v, processNode, oriented);
}
function initNode(node) {
var nodeId = node.id;
dist[nodeId] = -1;
}
function processNode(otherNode) {
var w = otherNode.id
if (dist[w] === -1) {
// Node w is found for the first time
dist[w] = dist[v] + 1;
Q.push(w);
}
}
}
} | [
"function",
"closeness",
"(",
"graph",
",",
"oriented",
")",
"{",
"var",
"Q",
"=",
"[",
"]",
";",
"// list of predecessors on shortest paths from source\r",
"// distance from source\r",
"var",
"dist",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"var",
"currentNode",
";",
"var",
"centrality",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"graph",
".",
"forEachNode",
"(",
"setCentralityToZero",
")",
";",
"graph",
".",
"forEachNode",
"(",
"calculateCentrality",
")",
";",
"return",
"centrality",
";",
"function",
"setCentralityToZero",
"(",
"node",
")",
"{",
"centrality",
"[",
"node",
".",
"id",
"]",
"=",
"0",
";",
"}",
"function",
"calculateCentrality",
"(",
"node",
")",
"{",
"currentNode",
"=",
"node",
".",
"id",
";",
"singleSourceShortestPath",
"(",
"currentNode",
")",
";",
"accumulate",
"(",
")",
";",
"}",
"function",
"accumulate",
"(",
")",
"{",
"// Add all distances for node to array, excluding -1s\r",
"var",
"distances",
"=",
"Object",
".",
"keys",
"(",
"dist",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"dist",
"[",
"key",
"]",
"}",
")",
".",
"filter",
"(",
"function",
"(",
"val",
")",
"{",
"return",
"val",
"!==",
"-",
"1",
"}",
")",
";",
"// Set number of reachable nodes\r",
"var",
"reachableNodesTotal",
"=",
"distances",
".",
"length",
";",
"// Compute sum of all distances for node\r",
"var",
"totalDistance",
"=",
"distances",
".",
"reduce",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
"+",
"b",
"}",
")",
";",
"if",
"(",
"totalDistance",
">",
"0",
")",
"{",
"centrality",
"[",
"currentNode",
"]",
"=",
"(",
"(",
"reachableNodesTotal",
"-",
"1",
")",
"/",
"totalDistance",
")",
";",
"}",
"else",
"{",
"centrality",
"[",
"currentNode",
"]",
"=",
"0",
";",
"}",
"}",
"function",
"singleSourceShortestPath",
"(",
"source",
")",
"{",
"graph",
".",
"forEachNode",
"(",
"initNode",
")",
";",
"dist",
"[",
"source",
"]",
"=",
"0",
";",
"Q",
".",
"push",
"(",
"source",
")",
";",
"while",
"(",
"Q",
".",
"length",
")",
"{",
"var",
"v",
"=",
"Q",
".",
"shift",
"(",
")",
";",
"graph",
".",
"forEachLinkedNode",
"(",
"v",
",",
"processNode",
",",
"oriented",
")",
";",
"}",
"function",
"initNode",
"(",
"node",
")",
"{",
"var",
"nodeId",
"=",
"node",
".",
"id",
";",
"dist",
"[",
"nodeId",
"]",
"=",
"-",
"1",
";",
"}",
"function",
"processNode",
"(",
"otherNode",
")",
"{",
"var",
"w",
"=",
"otherNode",
".",
"id",
"if",
"(",
"dist",
"[",
"w",
"]",
"===",
"-",
"1",
")",
"{",
"// Node w is found for the first time\r",
"dist",
"[",
"w",
"]",
"=",
"dist",
"[",
"v",
"]",
"+",
"1",
";",
"Q",
".",
"push",
"(",
"w",
")",
";",
"}",
"}",
"}",
"}"
] | In a connected graph, the normalized closeness centrality of a node is the average
length of the shortest path between the node and all other nodes in the
graph. Thus the more central a node is, the closer it is to all other nodes. | [
"In",
"a",
"connected",
"graph",
"the",
"normalized",
"closeness",
"centrality",
"of",
"a",
"node",
"is",
"the",
"average",
"length",
"of",
"the",
"shortest",
"path",
"between",
"the",
"node",
"and",
"all",
"other",
"nodes",
"in",
"the",
"graph",
".",
"Thus",
"the",
"more",
"central",
"a",
"node",
"is",
"the",
"closer",
"it",
"is",
"to",
"all",
"other",
"nodes",
"."
] | bfec9eb729e5f819490a4421486f6e1ae2232ba0 | https://github.com/anvaka/ngraph.centrality/blob/bfec9eb729e5f819490a4421486f6e1ae2232ba0/src/closeness.js#L8-L70 |
23,595 | anvaka/ngraph.centrality | src/eccentricity.js | eccentricity | function eccentricity(graph, oriented) {
var Q = [];
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality);
return centrality;
function setCentralityToZero(node) {
centrality[node.id] = 0;
}
function calculateCentrality(node) {
currentNode = node.id;
singleSourceShortestPath(currentNode);
accumulate();
}
function accumulate() {
var maxDist = 0;
Object.keys(dist).forEach(function (key) {
var val = dist[key];
if (maxDist < val) maxDist = val;
});
centrality[currentNode] = maxDist;
}
function singleSourceShortestPath(source) {
graph.forEachNode(initNode);
dist[source] = 0;
Q.push(source);
while (Q.length) {
var v = Q.shift();
graph.forEachLinkedNode(v, processNode, oriented);
}
function initNode(node) {
var nodeId = node.id;
dist[nodeId] = -1;
}
function processNode(otherNode) {
var w = otherNode.id
if (dist[w] === -1) {
// Node w is found for the first time
dist[w] = dist[v] + 1;
Q.push(w);
}
}
}
} | javascript | function eccentricity(graph, oriented) {
var Q = [];
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality);
return centrality;
function setCentralityToZero(node) {
centrality[node.id] = 0;
}
function calculateCentrality(node) {
currentNode = node.id;
singleSourceShortestPath(currentNode);
accumulate();
}
function accumulate() {
var maxDist = 0;
Object.keys(dist).forEach(function (key) {
var val = dist[key];
if (maxDist < val) maxDist = val;
});
centrality[currentNode] = maxDist;
}
function singleSourceShortestPath(source) {
graph.forEachNode(initNode);
dist[source] = 0;
Q.push(source);
while (Q.length) {
var v = Q.shift();
graph.forEachLinkedNode(v, processNode, oriented);
}
function initNode(node) {
var nodeId = node.id;
dist[nodeId] = -1;
}
function processNode(otherNode) {
var w = otherNode.id
if (dist[w] === -1) {
// Node w is found for the first time
dist[w] = dist[v] + 1;
Q.push(w);
}
}
}
} | [
"function",
"eccentricity",
"(",
"graph",
",",
"oriented",
")",
"{",
"var",
"Q",
"=",
"[",
"]",
";",
"// distance from source\r",
"var",
"dist",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"var",
"currentNode",
";",
"var",
"centrality",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"graph",
".",
"forEachNode",
"(",
"setCentralityToZero",
")",
";",
"graph",
".",
"forEachNode",
"(",
"calculateCentrality",
")",
";",
"return",
"centrality",
";",
"function",
"setCentralityToZero",
"(",
"node",
")",
"{",
"centrality",
"[",
"node",
".",
"id",
"]",
"=",
"0",
";",
"}",
"function",
"calculateCentrality",
"(",
"node",
")",
"{",
"currentNode",
"=",
"node",
".",
"id",
";",
"singleSourceShortestPath",
"(",
"currentNode",
")",
";",
"accumulate",
"(",
")",
";",
"}",
"function",
"accumulate",
"(",
")",
"{",
"var",
"maxDist",
"=",
"0",
";",
"Object",
".",
"keys",
"(",
"dist",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"val",
"=",
"dist",
"[",
"key",
"]",
";",
"if",
"(",
"maxDist",
"<",
"val",
")",
"maxDist",
"=",
"val",
";",
"}",
")",
";",
"centrality",
"[",
"currentNode",
"]",
"=",
"maxDist",
";",
"}",
"function",
"singleSourceShortestPath",
"(",
"source",
")",
"{",
"graph",
".",
"forEachNode",
"(",
"initNode",
")",
";",
"dist",
"[",
"source",
"]",
"=",
"0",
";",
"Q",
".",
"push",
"(",
"source",
")",
";",
"while",
"(",
"Q",
".",
"length",
")",
"{",
"var",
"v",
"=",
"Q",
".",
"shift",
"(",
")",
";",
"graph",
".",
"forEachLinkedNode",
"(",
"v",
",",
"processNode",
",",
"oriented",
")",
";",
"}",
"function",
"initNode",
"(",
"node",
")",
"{",
"var",
"nodeId",
"=",
"node",
".",
"id",
";",
"dist",
"[",
"nodeId",
"]",
"=",
"-",
"1",
";",
"}",
"function",
"processNode",
"(",
"otherNode",
")",
"{",
"var",
"w",
"=",
"otherNode",
".",
"id",
"if",
"(",
"dist",
"[",
"w",
"]",
"===",
"-",
"1",
")",
"{",
"// Node w is found for the first time\r",
"dist",
"[",
"w",
"]",
"=",
"dist",
"[",
"v",
"]",
"+",
"1",
";",
"Q",
".",
"push",
"(",
"w",
")",
";",
"}",
"}",
"}",
"}"
] | The eccentricity centrality of a node is the greatest distance between that node and
any other node in the network. | [
"The",
"eccentricity",
"centrality",
"of",
"a",
"node",
"is",
"the",
"greatest",
"distance",
"between",
"that",
"node",
"and",
"any",
"other",
"node",
"in",
"the",
"network",
"."
] | bfec9eb729e5f819490a4421486f6e1ae2232ba0 | https://github.com/anvaka/ngraph.centrality/blob/bfec9eb729e5f819490a4421486f6e1ae2232ba0/src/eccentricity.js#L7-L64 |
23,596 | anywhichway/tlx | benchmarks/dbmon/lib/monitor.js | initPerfMonitor | function initPerfMonitor(options) {
if (!initialized) {
if (options.container) {
container = options.container;
}
initialized = true;
}
} | javascript | function initPerfMonitor(options) {
if (!initialized) {
if (options.container) {
container = options.container;
}
initialized = true;
}
} | [
"function",
"initPerfMonitor",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"if",
"(",
"options",
".",
"container",
")",
"{",
"container",
"=",
"options",
".",
"container",
";",
"}",
"initialized",
"=",
"true",
";",
"}",
"}"
] | Initialize Performance Monitor | [
"Initialize",
"Performance",
"Monitor"
] | 732bc3828d2333ea757b8772e8e6b7a6b4070637 | https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L41-L48 |
23,597 | anywhichway/tlx | benchmarks/dbmon/lib/monitor.js | checkInit | function checkInit() {
if (!container) {
container = document.createElement("div");
container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0";
document.body.appendChild(container);
}
initialized = true;
} | javascript | function checkInit() {
if (!container) {
container = document.createElement("div");
container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0";
document.body.appendChild(container);
}
initialized = true;
} | [
"function",
"checkInit",
"(",
")",
"{",
"if",
"(",
"!",
"container",
")",
"{",
"container",
"=",
"document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"container",
".",
"style",
".",
"cssText",
"=",
"\"position: fixed;\"",
"+",
"\"opacity: 0.9;\"",
"+",
"\"right: 0;\"",
"+",
"\"bottom: 0\"",
";",
"document",
".",
"body",
".",
"appendChild",
"(",
"container",
")",
";",
"}",
"initialized",
"=",
"true",
";",
"}"
] | Check that everything is properly initialized | [
"Check",
"that",
"everything",
"is",
"properly",
"initialized"
] | 732bc3828d2333ea757b8772e8e6b7a6b4070637 | https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L52-L59 |
23,598 | anywhichway/tlx | benchmarks/dbmon/lib/monitor.js | scheduleTask | function scheduleTask(task) {
frameTasks.push(task);
if (rafId === -1) {
requestAnimationFrame(function (t) {
rafId = -1;
var tasks = frameTasks;
frameTasks = [];
for (var i = 0; i < tasks.length; i++) {
tasks[i]();
}
});
}
} | javascript | function scheduleTask(task) {
frameTasks.push(task);
if (rafId === -1) {
requestAnimationFrame(function (t) {
rafId = -1;
var tasks = frameTasks;
frameTasks = [];
for (var i = 0; i < tasks.length; i++) {
tasks[i]();
}
});
}
} | [
"function",
"scheduleTask",
"(",
"task",
")",
"{",
"frameTasks",
".",
"push",
"(",
"task",
")",
";",
"if",
"(",
"rafId",
"===",
"-",
"1",
")",
"{",
"requestAnimationFrame",
"(",
"function",
"(",
"t",
")",
"{",
"rafId",
"=",
"-",
"1",
";",
"var",
"tasks",
"=",
"frameTasks",
";",
"frameTasks",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"tasks",
".",
"length",
";",
"i",
"++",
")",
"{",
"tasks",
"[",
"i",
"]",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | Schedule new task that will be executed on the next frame | [
"Schedule",
"new",
"task",
"that",
"will",
"be",
"executed",
"on",
"the",
"next",
"frame"
] | 732bc3828d2333ea757b8772e8e6b7a6b4070637 | https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L63-L75 |
23,599 | anywhichway/tlx | benchmarks/dbmon/lib/monitor.js | startFPSMonitor | function startFPSMonitor() {
checkInit();
var data = new Data();
var w = new MonitorWidget("FPS", "", 2 /* HideMax */ | 1 /* HideMin */ | 4 /* HideMean */ | 32 /* RoundValues */);
container.appendChild(w.element);
var samples = [];
var last = 0;
function update(now) {
var elapsed = (now - (last === 0 ? now : last)) / 1000;
var fps = 1 / elapsed;
if (fps !== Infinity) {
if (samples.length === 64) {
samples.shift();
}
samples.push(fps);
var sum = 0;
for (var i = 0; i < samples.length; i++) {
sum += samples[i];
}
var mean = sum / samples.length;
data.addSample(mean);
w.addResult(data.calc());
}
last = now;
requestAnimationFrame(update);
}
requestAnimationFrame(update);
} | javascript | function startFPSMonitor() {
checkInit();
var data = new Data();
var w = new MonitorWidget("FPS", "", 2 /* HideMax */ | 1 /* HideMin */ | 4 /* HideMean */ | 32 /* RoundValues */);
container.appendChild(w.element);
var samples = [];
var last = 0;
function update(now) {
var elapsed = (now - (last === 0 ? now : last)) / 1000;
var fps = 1 / elapsed;
if (fps !== Infinity) {
if (samples.length === 64) {
samples.shift();
}
samples.push(fps);
var sum = 0;
for (var i = 0; i < samples.length; i++) {
sum += samples[i];
}
var mean = sum / samples.length;
data.addSample(mean);
w.addResult(data.calc());
}
last = now;
requestAnimationFrame(update);
}
requestAnimationFrame(update);
} | [
"function",
"startFPSMonitor",
"(",
")",
"{",
"checkInit",
"(",
")",
";",
"var",
"data",
"=",
"new",
"Data",
"(",
")",
";",
"var",
"w",
"=",
"new",
"MonitorWidget",
"(",
"\"FPS\"",
",",
"\"\"",
",",
"2",
"/* HideMax */",
"|",
"1",
"/* HideMin */",
"|",
"4",
"/* HideMean */",
"|",
"32",
"/* RoundValues */",
")",
";",
"container",
".",
"appendChild",
"(",
"w",
".",
"element",
")",
";",
"var",
"samples",
"=",
"[",
"]",
";",
"var",
"last",
"=",
"0",
";",
"function",
"update",
"(",
"now",
")",
"{",
"var",
"elapsed",
"=",
"(",
"now",
"-",
"(",
"last",
"===",
"0",
"?",
"now",
":",
"last",
")",
")",
"/",
"1000",
";",
"var",
"fps",
"=",
"1",
"/",
"elapsed",
";",
"if",
"(",
"fps",
"!==",
"Infinity",
")",
"{",
"if",
"(",
"samples",
".",
"length",
"===",
"64",
")",
"{",
"samples",
".",
"shift",
"(",
")",
";",
"}",
"samples",
".",
"push",
"(",
"fps",
")",
";",
"var",
"sum",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"samples",
".",
"length",
";",
"i",
"++",
")",
"{",
"sum",
"+=",
"samples",
"[",
"i",
"]",
";",
"}",
"var",
"mean",
"=",
"sum",
"/",
"samples",
".",
"length",
";",
"data",
".",
"addSample",
"(",
"mean",
")",
";",
"w",
".",
"addResult",
"(",
"data",
".",
"calc",
"(",
")",
")",
";",
"}",
"last",
"=",
"now",
";",
"requestAnimationFrame",
"(",
"update",
")",
";",
"}",
"requestAnimationFrame",
"(",
"update",
")",
";",
"}"
] | Start FPS monitor | [
"Start",
"FPS",
"monitor"
] | 732bc3828d2333ea757b8772e8e6b7a6b4070637 | https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L206-L233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.