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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8,400 | node-inspector/node-inspector | front-end/ui/SplitView.js | function()
{
if (!this._totalSize) {
this._totalSize = this._isVertical ? this.contentElement.offsetWidth : this.contentElement.offsetHeight;
this._totalSizeOtherDimension = this._isVertical ? this.contentElement.offsetHeight : this.contentElement.offsetWidth;
}
retur... | javascript | function()
{
if (!this._totalSize) {
this._totalSize = this._isVertical ? this.contentElement.offsetWidth : this.contentElement.offsetHeight;
this._totalSizeOtherDimension = this._isVertical ? this.contentElement.offsetHeight : this.contentElement.offsetWidth;
}
retur... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_totalSize",
")",
"{",
"this",
".",
"_totalSize",
"=",
"this",
".",
"_isVertical",
"?",
"this",
".",
"contentElement",
".",
"offsetWidth",
":",
"this",
".",
"contentElement",
".",
"offsetHeight",
"... | Returns total size in DIP.
@return {number} | [
"Returns",
"total",
"size",
"in",
"DIP",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/ui/SplitView.js#L423-L430 | |
8,401 | node-inspector/node-inspector | front-end/toolbox/ResponsiveDesignView.js | function(dipWidth, dipHeight, scale)
{
this._scale = scale;
this._dipWidth = dipWidth ? Math.max(dipWidth, 1) : 0;
this._dipHeight = dipHeight ? Math.max(dipHeight, 1) : 0;
this._updateUI();
} | javascript | function(dipWidth, dipHeight, scale)
{
this._scale = scale;
this._dipWidth = dipWidth ? Math.max(dipWidth, 1) : 0;
this._dipHeight = dipHeight ? Math.max(dipHeight, 1) : 0;
this._updateUI();
} | [
"function",
"(",
"dipWidth",
",",
"dipHeight",
",",
"scale",
")",
"{",
"this",
".",
"_scale",
"=",
"scale",
";",
"this",
".",
"_dipWidth",
"=",
"dipWidth",
"?",
"Math",
".",
"max",
"(",
"dipWidth",
",",
"1",
")",
":",
"0",
";",
"this",
".",
"_dipHe... | WebInspector.OverridesSupport.PageResizer override.
@param {number} dipWidth
@param {number} dipHeight
@param {number} scale | [
"WebInspector",
".",
"OverridesSupport",
".",
"PageResizer",
"override",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/toolbox/ResponsiveDesignView.js#L167-L173 | |
8,402 | node-inspector/node-inspector | front-end/sources/NavigatorView.js | typeWeight | function typeWeight(treeElement)
{
var type = treeElement.type();
if (type === WebInspector.NavigatorTreeOutline.Types.Domain) {
if (treeElement.titleText === WebInspector.targetManager.inspectedPageDomain())
return 1;
return 2;
}
if (type === ... | javascript | function typeWeight(treeElement)
{
var type = treeElement.type();
if (type === WebInspector.NavigatorTreeOutline.Types.Domain) {
if (treeElement.titleText === WebInspector.targetManager.inspectedPageDomain())
return 1;
return 2;
}
if (type === ... | [
"function",
"typeWeight",
"(",
"treeElement",
")",
"{",
"var",
"type",
"=",
"treeElement",
".",
"type",
"(",
")",
";",
"if",
"(",
"type",
"===",
"WebInspector",
".",
"NavigatorTreeOutline",
".",
"Types",
".",
"Domain",
")",
"{",
"if",
"(",
"treeElement",
... | Insert in the alphabetical order, first domains, then folders, then scripts. | [
"Insert",
"in",
"the",
"alphabetical",
"order",
"first",
"domains",
"then",
"folders",
"then",
"scripts",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/sources/NavigatorView.js#L625-L638 |
8,403 | node-inspector/node-inspector | index.js | buildInspectorUrl | function buildInspectorUrl(inspectorHost, inspectorPort, debugPort, isHttps) {
var host = inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost;
var port = inspectorPort;
var protocol = isHttps ? 'https' : 'http';
var isUnixSocket = !/^\d+$/.test(port);
if (isUnixSocket) {
host = path.resolve(__dirnam... | javascript | function buildInspectorUrl(inspectorHost, inspectorPort, debugPort, isHttps) {
var host = inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost;
var port = inspectorPort;
var protocol = isHttps ? 'https' : 'http';
var isUnixSocket = !/^\d+$/.test(port);
if (isUnixSocket) {
host = path.resolve(__dirnam... | [
"function",
"buildInspectorUrl",
"(",
"inspectorHost",
",",
"inspectorPort",
",",
"debugPort",
",",
"isHttps",
")",
"{",
"var",
"host",
"=",
"inspectorHost",
"==",
"'0.0.0.0'",
"?",
"'127.0.0.1'",
":",
"inspectorHost",
";",
"var",
"port",
"=",
"inspectorPort",
"... | Build a URL for loading inspector UI in the browser.
@param {string|undefined} inspectorHost as configured via --web-host
@param {number} inspectorPort as configured via --web-port
@param {number} debugPort as configured via --debug in the debugged app
@param {number} isHttps as configured via --ssl-cert and --ssl-key ... | [
"Build",
"a",
"URL",
"for",
"loading",
"inspector",
"UI",
"in",
"the",
"browser",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/index.js#L15-L36 |
8,404 | node-inspector/node-inspector | index.js | buildWebSocketUrl | function buildWebSocketUrl(inspectorHost, inspectorPort, debugPort, isSecure) {
var parts = {
protocol: isSecure ? 'wss:' : 'ws:',
hostname: inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost,
port: inspectorPort,
pathname: '/',
search: '?port=' + debugPort,
slashes: true
};
return ... | javascript | function buildWebSocketUrl(inspectorHost, inspectorPort, debugPort, isSecure) {
var parts = {
protocol: isSecure ? 'wss:' : 'ws:',
hostname: inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost,
port: inspectorPort,
pathname: '/',
search: '?port=' + debugPort,
slashes: true
};
return ... | [
"function",
"buildWebSocketUrl",
"(",
"inspectorHost",
",",
"inspectorPort",
",",
"debugPort",
",",
"isSecure",
")",
"{",
"var",
"parts",
"=",
"{",
"protocol",
":",
"isSecure",
"?",
"'wss:'",
":",
"'ws:'",
",",
"hostname",
":",
"inspectorHost",
"==",
"'0.0.0.0... | Build a URL for the WebSocket endpoint.
@param {string|undefined} inspectorHost as configured via --web-host
@param {number} inspectorPort as configured via --web-port
@param {number} debugPort as configured via --debug in the debugged app
@param {number} isHttps as configured via --ssl-cert and --ssl-key in the debugg... | [
"Build",
"a",
"URL",
"for",
"the",
"WebSocket",
"endpoint",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/index.js#L45-L56 |
8,405 | node-inspector/node-inspector | front-end/timeline/TimelinePanel.js | function()
{
if (!this._searchResults || !this._searchResults.length)
return;
var index = this._selectedSearchResult ? this._searchResults.indexOf(this._selectedSearchResult) : -1;
this._jumpToSearchResult(index + 1);
} | javascript | function()
{
if (!this._searchResults || !this._searchResults.length)
return;
var index = this._selectedSearchResult ? this._searchResults.indexOf(this._selectedSearchResult) : -1;
this._jumpToSearchResult(index + 1);
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_searchResults",
"||",
"!",
"this",
".",
"_searchResults",
".",
"length",
")",
"return",
";",
"var",
"index",
"=",
"this",
".",
"_selectedSearchResult",
"?",
"this",
".",
"_searchResults",
".",
"in... | WebInspector.Searchable implementation | [
"WebInspector",
".",
"Searchable",
"implementation"
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/timeline/TimelinePanel.js#L829-L835 | |
8,406 | tempusdominus/bootstrap-4 | build/js/tempusdominus-bootstrap-4.js | getSelectorFromElement | function getSelectorFromElement($element) {
var selector = $element.data('target'),
$selector = void 0;
if (!selector) {
selector = $element.attr('href') || '';
selector = /^#[a-z]/i.test(selector) ? selector : null;
}
$selector = $(selector);
... | javascript | function getSelectorFromElement($element) {
var selector = $element.data('target'),
$selector = void 0;
if (!selector) {
selector = $element.attr('href') || '';
selector = /^#[a-z]/i.test(selector) ? selector : null;
}
$selector = $(selector);
... | [
"function",
"getSelectorFromElement",
"(",
"$element",
")",
"{",
"var",
"selector",
"=",
"$element",
".",
"data",
"(",
"'target'",
")",
",",
"$selector",
"=",
"void",
"0",
";",
"if",
"(",
"!",
"selector",
")",
"{",
"selector",
"=",
"$element",
".",
"attr... | eslint-disable-line no-unused-vars ReSharper disable once InconsistentNaming | [
"eslint",
"-",
"disable",
"-",
"line",
"no",
"-",
"unused",
"-",
"vars",
"ReSharper",
"disable",
"once",
"InconsistentNaming"
] | 540bfae18ca662bacfbea610e0ab8dcce6dd699e | https://github.com/tempusdominus/bootstrap-4/blob/540bfae18ca662bacfbea610e0ab8dcce6dd699e/build/js/tempusdominus-bootstrap-4.js#L1588-L1606 |
8,407 | dagrejs/dagre | lib/position/bk.js | pass1 | function pass1(elem) {
xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) {
return Math.max(acc, xs[e.v] + blockG.edge(e));
}, 0);
} | javascript | function pass1(elem) {
xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) {
return Math.max(acc, xs[e.v] + blockG.edge(e));
}, 0);
} | [
"function",
"pass1",
"(",
"elem",
")",
"{",
"xs",
"[",
"elem",
"]",
"=",
"blockG",
".",
"inEdges",
"(",
"elem",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"e",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"acc",
",",
"xs",
"[",
"e",
... | First pass, assign smallest coordinates | [
"First",
"pass",
"assign",
"smallest",
"coordinates"
] | ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e | https://github.com/dagrejs/dagre/blob/ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e/lib/position/bk.js#L235-L239 |
8,408 | dagrejs/dagre | lib/position/bk.js | pass2 | function pass2(elem) {
var min = blockG.outEdges(elem).reduce(function(acc, e) {
return Math.min(acc, xs[e.w] - blockG.edge(e));
}, Number.POSITIVE_INFINITY);
var node = g.node(elem);
if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
xs[elem] = Math.max(xs[elem], min... | javascript | function pass2(elem) {
var min = blockG.outEdges(elem).reduce(function(acc, e) {
return Math.min(acc, xs[e.w] - blockG.edge(e));
}, Number.POSITIVE_INFINITY);
var node = g.node(elem);
if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
xs[elem] = Math.max(xs[elem], min... | [
"function",
"pass2",
"(",
"elem",
")",
"{",
"var",
"min",
"=",
"blockG",
".",
"outEdges",
"(",
"elem",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"e",
")",
"{",
"return",
"Math",
".",
"min",
"(",
"acc",
",",
"xs",
"[",
"e",
".",
"w",... | Second pass, assign greatest coordinates | [
"Second",
"pass",
"assign",
"greatest",
"coordinates"
] | ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e | https://github.com/dagrejs/dagre/blob/ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e/lib/position/bk.js#L242-L251 |
8,409 | jakubpawlowicz/clean-css | docs/js/optimizer.js | function () {
this.worker = new Worker('./js/optimizer-worker.js')
this.worker.onmessage = function (event) {
switch (event.data.command) {
case 'optimized':
Optimizer.oncomplete(event.data.id, event.data.output, event.data.saved)
}
}
this.worker.onerror = function (event) ... | javascript | function () {
this.worker = new Worker('./js/optimizer-worker.js')
this.worker.onmessage = function (event) {
switch (event.data.command) {
case 'optimized':
Optimizer.oncomplete(event.data.id, event.data.output, event.data.saved)
}
}
this.worker.onerror = function (event) ... | [
"function",
"(",
")",
"{",
"this",
".",
"worker",
"=",
"new",
"Worker",
"(",
"'./js/optimizer-worker.js'",
")",
"this",
".",
"worker",
".",
"onmessage",
"=",
"function",
"(",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"data",
".",
"command",
")",
... | see setOptionsFrom in settings.js | [
"see",
"setOptionsFrom",
"in",
"settings",
".",
"js"
] | dc728a8167b7b6f62906115c560be2f5b530f9f6 | https://github.com/jakubpawlowicz/clean-css/blob/dc728a8167b7b6f62906115c560be2f5b530f9f6/docs/js/optimizer.js#L4-L15 | |
8,410 | spite/ccapture.js | src/Whammy.js | checkFrames | function checkFrames(frames){
var width = frames[0].width,
height = frames[0].height,
duration = frames[0].duration;
for(var i = 1; i < frames.length; i++){
if(frames[i].width != width) throw "Frame " + (i + 1) + " has a different width";
if(frames[i].height != height) throw "Frame " + (i + 1) + "... | javascript | function checkFrames(frames){
var width = frames[0].width,
height = frames[0].height,
duration = frames[0].duration;
for(var i = 1; i < frames.length; i++){
if(frames[i].width != width) throw "Frame " + (i + 1) + " has a different width";
if(frames[i].height != height) throw "Frame " + (i + 1) + "... | [
"function",
"checkFrames",
"(",
"frames",
")",
"{",
"var",
"width",
"=",
"frames",
"[",
"0",
"]",
".",
"width",
",",
"height",
"=",
"frames",
"[",
"0",
"]",
".",
"height",
",",
"duration",
"=",
"frames",
"[",
"0",
"]",
".",
"duration",
";",
"for",
... | sums the lengths of all the frames and gets the duration, woo | [
"sums",
"the",
"lengths",
"of",
"all",
"the",
"frames",
"and",
"gets",
"the",
"duration",
"woo"
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/Whammy.js#L231-L246 |
8,411 | spite/ccapture.js | src/Whammy.js | parseWebP | function parseWebP(riff){
var VP8 = riff.RIFF[0].WEBP[0];
var frame_start = VP8.indexOf('\x9d\x01\x2a'); //A VP8 keyframe starts with the 0x9d012a header
for(var i = 0, c = []; i < 4; i++) c[i] = VP8.charCodeAt(frame_start + 3 + i);
var width, horizontal_scale, height, vertical_scale, tmp;
//the co... | javascript | function parseWebP(riff){
var VP8 = riff.RIFF[0].WEBP[0];
var frame_start = VP8.indexOf('\x9d\x01\x2a'); //A VP8 keyframe starts with the 0x9d012a header
for(var i = 0, c = []; i < 4; i++) c[i] = VP8.charCodeAt(frame_start + 3 + i);
var width, horizontal_scale, height, vertical_scale, tmp;
//the co... | [
"function",
"parseWebP",
"(",
"riff",
")",
"{",
"var",
"VP8",
"=",
"riff",
".",
"RIFF",
"[",
"0",
"]",
".",
"WEBP",
"[",
"0",
"]",
";",
"var",
"frame_start",
"=",
"VP8",
".",
"indexOf",
"(",
"'\\x9d\\x01\\x2a'",
")",
";",
"//A VP8 keyframe starts with th... | here's something else taken verbatim from weppy, awesome rite? | [
"here",
"s",
"something",
"else",
"taken",
"verbatim",
"from",
"weppy",
"awesome",
"rite?"
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/Whammy.js#L428-L449 |
8,412 | spite/ccapture.js | src/webm-writer-0.2.0.js | decodeBase64WebPDataURL | function decodeBase64WebPDataURL(url) {
if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) {
return false;
}
return window.atob(url.substring("data:image\/webp;base64,".length));
} | javascript | function decodeBase64WebPDataURL(url) {
if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) {
return false;
}
return window.atob(url.substring("data:image\/webp;base64,".length));
} | [
"function",
"decodeBase64WebPDataURL",
"(",
"url",
")",
"{",
"if",
"(",
"typeof",
"url",
"!==",
"\"string\"",
"||",
"!",
"url",
".",
"match",
"(",
"/",
"^data:image\\/webp;base64,",
"/",
"i",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"window",
... | Decode a Base64 data URL into a binary string.
Returns the binary string, or false if the URL could not be decoded. | [
"Decode",
"a",
"Base64",
"data",
"URL",
"into",
"a",
"binary",
"string",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L473-L479 |
8,413 | spite/ccapture.js | src/webm-writer-0.2.0.js | renderAsWebP | function renderAsWebP(canvas, quality) {
var
frame = canvas.toDataURL('image/webp', {quality: quality});
return decodeBase64WebPDataURL(frame);
} | javascript | function renderAsWebP(canvas, quality) {
var
frame = canvas.toDataURL('image/webp', {quality: quality});
return decodeBase64WebPDataURL(frame);
} | [
"function",
"renderAsWebP",
"(",
"canvas",
",",
"quality",
")",
"{",
"var",
"frame",
"=",
"canvas",
".",
"toDataURL",
"(",
"'image/webp'",
",",
"{",
"quality",
":",
"quality",
"}",
")",
";",
"return",
"decodeBase64WebPDataURL",
"(",
"frame",
")",
";",
"}"
... | Convert the given canvas to a WebP encoded image and return the image data as a string. | [
"Convert",
"the",
"given",
"canvas",
"to",
"a",
"WebP",
"encoded",
"image",
"and",
"return",
"the",
"image",
"data",
"as",
"a",
"string",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L499-L504 |
8,414 | spite/ccapture.js | src/webm-writer-0.2.0.js | writeEBML | function writeEBML(buffer, bufferFileOffset, ebml) {
// Is the ebml an array of sibling elements?
if (Array.isArray(ebml)) {
for (var i = 0; i < ebml.length; i++) {
writeEBML(buffer, bufferFileOffset, ebml[i]);
}
// Is this some sor... | javascript | function writeEBML(buffer, bufferFileOffset, ebml) {
// Is the ebml an array of sibling elements?
if (Array.isArray(ebml)) {
for (var i = 0; i < ebml.length; i++) {
writeEBML(buffer, bufferFileOffset, ebml[i]);
}
// Is this some sor... | [
"function",
"writeEBML",
"(",
"buffer",
",",
"bufferFileOffset",
",",
"ebml",
")",
"{",
"// Is the ebml an array of sibling elements?",
"if",
"(",
"Array",
".",
"isArray",
"(",
"ebml",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ebml",... | Write the given EBML object to the provided ArrayBufferStream.
The buffer's first byte is at bufferFileOffset inside the video file. This is used to complete offset and
dataOffset fields in each EBML structure, indicating the file offset of the first byte of the EBML element and
its data payload. | [
"Write",
"the",
"given",
"EBML",
"object",
"to",
"the",
"provided",
"ArrayBufferStream",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L537-L621 |
8,415 | spite/ccapture.js | src/webm-writer-0.2.0.js | createSeekHead | function createSeekHead() {
var
seekPositionEBMLTemplate = {
"id": 0x53AC, // SeekPosition
"size": 5, // Allows for 32GB video files
"data": 0 // We'll overwrite this when the file is complete
... | javascript | function createSeekHead() {
var
seekPositionEBMLTemplate = {
"id": 0x53AC, // SeekPosition
"size": 5, // Allows for 32GB video files
"data": 0 // We'll overwrite this when the file is complete
... | [
"function",
"createSeekHead",
"(",
")",
"{",
"var",
"seekPositionEBMLTemplate",
"=",
"{",
"\"id\"",
":",
"0x53AC",
",",
"// SeekPosition",
"\"size\"",
":",
"5",
",",
"// Allows for 32GB video files",
"\"data\"",
":",
"0",
"// We'll overwrite this when the file is complete... | Create a SeekHead element with descriptors for the points in the global seekPoints array.
5 bytes of position values are reserved for each node, which lie at the offset point.positionEBML.dataOffset,
to be overwritten later. | [
"Create",
"a",
"SeekHead",
"element",
"with",
"descriptors",
"for",
"the",
"points",
"in",
"the",
"global",
"seekPoints",
"array",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L673-L705 |
8,416 | spite/ccapture.js | src/webm-writer-0.2.0.js | writeHeader | function writeHeader() {
seekHead = createSeekHead();
var
ebmlHeader = {
"id": 0x1a45dfa3, // EBML
"data": [
{
"id": 0x4286, // EBMLVersion
... | javascript | function writeHeader() {
seekHead = createSeekHead();
var
ebmlHeader = {
"id": 0x1a45dfa3, // EBML
"data": [
{
"id": 0x4286, // EBMLVersion
... | [
"function",
"writeHeader",
"(",
")",
"{",
"seekHead",
"=",
"createSeekHead",
"(",
")",
";",
"var",
"ebmlHeader",
"=",
"{",
"\"id\"",
":",
"0x1a45dfa3",
",",
"// EBML",
"\"data\"",
":",
"[",
"{",
"\"id\"",
":",
"0x4286",
",",
"// EBMLVersion",
"\"data\"",
"... | Write the WebM file header to the stream. | [
"Write",
"the",
"WebM",
"file",
"header",
"to",
"the",
"stream",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L710-L838 |
8,417 | spite/ccapture.js | src/webm-writer-0.2.0.js | flushClusterFrameBuffer | function flushClusterFrameBuffer() {
if (clusterFrameBuffer.length == 0) {
return;
}
// First work out how large of a buffer we need to hold the cluster data
var
rawImageSize = 0;
... | javascript | function flushClusterFrameBuffer() {
if (clusterFrameBuffer.length == 0) {
return;
}
// First work out how large of a buffer we need to hold the cluster data
var
rawImageSize = 0;
... | [
"function",
"flushClusterFrameBuffer",
"(",
")",
"{",
"if",
"(",
"clusterFrameBuffer",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"// First work out how large of a buffer we need to hold the cluster data",
"var",
"rawImageSize",
"=",
"0",
";",
"for",
"(",... | Flush the frames in the current clusterFrameBuffer out to the stream as a Cluster. | [
"Flush",
"the",
"frames",
"in",
"the",
"current",
"clusterFrameBuffer",
"out",
"to",
"the",
"stream",
"as",
"a",
"Cluster",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L940-L972 |
8,418 | spite/ccapture.js | src/webm-writer-0.2.0.js | rewriteSeekHead | function rewriteSeekHead() {
var
seekHeadBuffer = new ArrayBufferDataStream(seekHead.size),
oldPos = blobBuffer.pos;
// Write the rewritten SeekHead element's data payload to the stream (don't need to update the id or size)
... | javascript | function rewriteSeekHead() {
var
seekHeadBuffer = new ArrayBufferDataStream(seekHead.size),
oldPos = blobBuffer.pos;
// Write the rewritten SeekHead element's data payload to the stream (don't need to update the id or size)
... | [
"function",
"rewriteSeekHead",
"(",
")",
"{",
"var",
"seekHeadBuffer",
"=",
"new",
"ArrayBufferDataStream",
"(",
"seekHead",
".",
"size",
")",
",",
"oldPos",
"=",
"blobBuffer",
".",
"pos",
";",
"// Write the rewritten SeekHead element's data payload to the stream (don't n... | Rewrites the SeekHead element that was initially written to the stream with the offsets of top level elements.
Call once writing is complete (so the offset of all top level elements is known). | [
"Rewrites",
"the",
"SeekHead",
"element",
"that",
"was",
"initially",
"written",
"to",
"the",
"stream",
"with",
"the",
"offsets",
"of",
"top",
"level",
"elements",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L1005-L1018 |
8,419 | spite/ccapture.js | src/webm-writer-0.2.0.js | rewriteDuration | function rewriteDuration() {
var
buffer = new ArrayBufferDataStream(8),
oldPos = blobBuffer.pos;
// Rewrite the data payload (don't need to update the id or size)
buffer.writeDoubleBE(clusterStartTime);
... | javascript | function rewriteDuration() {
var
buffer = new ArrayBufferDataStream(8),
oldPos = blobBuffer.pos;
// Rewrite the data payload (don't need to update the id or size)
buffer.writeDoubleBE(clusterStartTime);
... | [
"function",
"rewriteDuration",
"(",
")",
"{",
"var",
"buffer",
"=",
"new",
"ArrayBufferDataStream",
"(",
"8",
")",
",",
"oldPos",
"=",
"blobBuffer",
".",
"pos",
";",
"// Rewrite the data payload (don't need to update the id or size)",
"buffer",
".",
"writeDoubleBE",
"... | Rewrite the Duration field of the Segment with the newly-discovered video duration. | [
"Rewrite",
"the",
"Duration",
"field",
"of",
"the",
"Segment",
"with",
"the",
"newly",
"-",
"discovered",
"video",
"duration",
"."
] | e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41 | https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L1023-L1036 |
8,420 | apache/cordova-plugin-file-transfer | src/windows/FileTransferProxy.js | cordovaPathToNative | function cordovaPathToNative(path) {
var cleanPath = String(path);
// turn / into \\
cleanPath = cleanPath.replace(/\//g, '\\');
// turn \\ into \
cleanPath = cleanPath.replace(/\\\\/g, '\\');
// strip end \\ characters
cleanPath = cleanPath.replace(/\\+$/g, '');
return cleanPath;
} | javascript | function cordovaPathToNative(path) {
var cleanPath = String(path);
// turn / into \\
cleanPath = cleanPath.replace(/\//g, '\\');
// turn \\ into \
cleanPath = cleanPath.replace(/\\\\/g, '\\');
// strip end \\ characters
cleanPath = cleanPath.replace(/\\+$/g, '');
return cleanPath;
} | [
"function",
"cordovaPathToNative",
"(",
"path",
")",
"{",
"var",
"cleanPath",
"=",
"String",
"(",
"path",
")",
";",
"// turn / into \\\\",
"cleanPath",
"=",
"cleanPath",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
",",
"'\\\\'",
")",
";",
"// turn \\\\ into ... | Some private helper functions, hidden by the module | [
"Some",
"private",
"helper",
"functions",
"hidden",
"by",
"the",
"module"
] | dc8fbd78a234bd88450ebe01835c60371bc2cf8e | https://github.com/apache/cordova-plugin-file-transfer/blob/dc8fbd78a234bd88450ebe01835c60371bc2cf8e/src/windows/FileTransferProxy.js#L40-L50 |
8,421 | eventbrite/britecharts | src/charts/mini-tooltip.js | getMaxLengthLine | function getMaxLengthLine(...texts) {
let textSizes = texts.filter(x => !!x)
.map(x => x.node().getBBox().width);
return d3Array.max(textSizes);
} | javascript | function getMaxLengthLine(...texts) {
let textSizes = texts.filter(x => !!x)
.map(x => x.node().getBBox().width);
return d3Array.max(textSizes);
} | [
"function",
"getMaxLengthLine",
"(",
"...",
"texts",
")",
"{",
"let",
"textSizes",
"=",
"texts",
".",
"filter",
"(",
"x",
"=>",
"!",
"!",
"x",
")",
".",
"map",
"(",
"x",
"=>",
"x",
".",
"node",
"(",
")",
".",
"getBBox",
"(",
")",
".",
"width",
... | Figures out the max length of the tooltip lines
@param {D3Selection[]} texts List of svg elements of each line
@return {Number} Max size of the lines | [
"Figures",
"out",
"the",
"max",
"length",
"of",
"the",
"tooltip",
"lines"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/mini-tooltip.js#L176-L181 |
8,422 | eventbrite/britecharts | src/charts/mini-tooltip.js | updatePositionAndSize | function updatePositionAndSize(mousePosition, parentChartSize) {
let [tooltipX, tooltipY] = getTooltipPosition(mousePosition, parentChartSize);
svg.transition()
.duration(mouseChaseDuration)
.ease(ease)
.attr('height', chartHeight + margin.top + m... | javascript | function updatePositionAndSize(mousePosition, parentChartSize) {
let [tooltipX, tooltipY] = getTooltipPosition(mousePosition, parentChartSize);
svg.transition()
.duration(mouseChaseDuration)
.ease(ease)
.attr('height', chartHeight + margin.top + m... | [
"function",
"updatePositionAndSize",
"(",
"mousePosition",
",",
"parentChartSize",
")",
"{",
"let",
"[",
"tooltipX",
",",
"tooltipY",
"]",
"=",
"getTooltipPosition",
"(",
"mousePosition",
",",
"parentChartSize",
")",
";",
"svg",
".",
"transition",
"(",
")",
".",... | Updates size and position of tooltip depending on the side of the chart we are in
@param {Object} dataPoint DataPoint of the tooltip
@return void | [
"Updates",
"size",
"and",
"position",
"of",
"tooltip",
"depending",
"on",
"the",
"side",
"of",
"the",
"chart",
"we",
"are",
"in"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/mini-tooltip.js#L316-L329 |
8,423 | eventbrite/britecharts | src/charts/step.js | cleanData | function cleanData(originalData) {
return originalData.reduce((acc, d) => {
d.value = +d[valueLabel];
d.key = String(d[nameLabel]);
return [...acc, d];
}, []);
} | javascript | function cleanData(originalData) {
return originalData.reduce((acc, d) => {
d.value = +d[valueLabel];
d.key = String(d[nameLabel]);
return [...acc, d];
}, []);
} | [
"function",
"cleanData",
"(",
"originalData",
")",
"{",
"return",
"originalData",
".",
"reduce",
"(",
"(",
"acc",
",",
"d",
")",
"=>",
"{",
"d",
".",
"value",
"=",
"+",
"d",
"[",
"valueLabel",
"]",
";",
"d",
".",
"key",
"=",
"String",
"(",
"d",
"... | Cleaning data casting the values and keys to the proper type while keeping
the rest of properties on the data
@param {StepChartData} originalData Data as provided on the container
@private | [
"Cleaning",
"data",
"casting",
"the",
"values",
"and",
"keys",
"to",
"the",
"proper",
"type",
"while",
"keeping",
"the",
"rest",
"of",
"properties",
"on",
"the",
"data"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/step.js#L215-L222 |
8,424 | eventbrite/britecharts | src/charts/step.js | drawSteps | function drawSteps(){
let steps = svg.select('.chart-group').selectAll('.step').data(data);
// Enter
steps.enter()
.append('rect')
.classed('step', true)
.attr('x', chartWidth) // Initially drawing the steps at the end of Y axis
... | javascript | function drawSteps(){
let steps = svg.select('.chart-group').selectAll('.step').data(data);
// Enter
steps.enter()
.append('rect')
.classed('step', true)
.attr('x', chartWidth) // Initially drawing the steps at the end of Y axis
... | [
"function",
"drawSteps",
"(",
")",
"{",
"let",
"steps",
"=",
"svg",
".",
"select",
"(",
"'.chart-group'",
")",
".",
"selectAll",
"(",
"'.step'",
")",
".",
"data",
"(",
"data",
")",
";",
"// Enter",
"steps",
".",
"enter",
"(",
")",
".",
"append",
"(",... | Draws the step elements within the chart group
@private | [
"Draws",
"the",
"step",
"elements",
"within",
"the",
"chart",
"group"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/step.js#L273-L310 |
8,425 | eventbrite/britecharts | src/charts/brush.js | buildAxis | function buildAxis(){
let minor, major;
if (xAxisFormat === 'custom' && typeof xAxisCustomFormat === 'string') {
minor = {
tick: xTicks,
format: d3TimeFormat.timeFormat(xAxisCustomFormat)
};
} else {
... | javascript | function buildAxis(){
let minor, major;
if (xAxisFormat === 'custom' && typeof xAxisCustomFormat === 'string') {
minor = {
tick: xTicks,
format: d3TimeFormat.timeFormat(xAxisCustomFormat)
};
} else {
... | [
"function",
"buildAxis",
"(",
")",
"{",
"let",
"minor",
",",
"major",
";",
"if",
"(",
"xAxisFormat",
"===",
"'custom'",
"&&",
"typeof",
"xAxisCustomFormat",
"===",
"'string'",
")",
"{",
"minor",
"=",
"{",
"tick",
":",
"xTicks",
",",
"format",
":",
"d3Tim... | Creates the d3 x axis, setting orientation
@private | [
"Creates",
"the",
"d3",
"x",
"axis",
"setting",
"orientation"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L154-L171 |
8,426 | eventbrite/britecharts | src/charts/brush.js | buildBrush | function buildBrush() {
brush = d3Brush.brushX()
.extent([[0, 0], [chartWidth, chartHeight]])
.on('brush', handleBrushStart)
.on('end', handleBrushEnd);
} | javascript | function buildBrush() {
brush = d3Brush.brushX()
.extent([[0, 0], [chartWidth, chartHeight]])
.on('brush', handleBrushStart)
.on('end', handleBrushEnd);
} | [
"function",
"buildBrush",
"(",
")",
"{",
"brush",
"=",
"d3Brush",
".",
"brushX",
"(",
")",
".",
"extent",
"(",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"chartWidth",
",",
"chartHeight",
"]",
"]",
")",
".",
"on",
"(",
"'brush'",
",",
"handleBrushStar... | Creates the brush element and attaches a listener
@return {void} | [
"Creates",
"the",
"brush",
"element",
"and",
"attaches",
"a",
"listener"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L177-L182 |
8,427 | eventbrite/britecharts | src/charts/brush.js | buildGradient | function buildGradient() {
if (!chartGradientEl) {
chartGradientEl = svg.select('.metadata-group')
.append('linearGradient')
.attr('id', gradientId)
.attr('gradientUnits', 'userSpaceOnUse')
.attr('x1', 0)
... | javascript | function buildGradient() {
if (!chartGradientEl) {
chartGradientEl = svg.select('.metadata-group')
.append('linearGradient')
.attr('id', gradientId)
.attr('gradientUnits', 'userSpaceOnUse')
.attr('x1', 0)
... | [
"function",
"buildGradient",
"(",
")",
"{",
"if",
"(",
"!",
"chartGradientEl",
")",
"{",
"chartGradientEl",
"=",
"svg",
".",
"select",
"(",
"'.metadata-group'",
")",
".",
"append",
"(",
"'linearGradient'",
")",
".",
"attr",
"(",
"'id'",
",",
"gradientId",
... | Creates the gradient on the area
@return {void} | [
"Creates",
"the",
"gradient",
"on",
"the",
"area"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L215-L234 |
8,428 | eventbrite/britecharts | src/charts/brush.js | drawArea | function drawArea() {
if (brushArea) {
svg.selectAll('.brush-area').remove();
}
// Create and configure the area generator
brushArea = d3Shape.area()
.x(({date}) => xScale(date))
.y0(chartHeight)
.y1(({value... | javascript | function drawArea() {
if (brushArea) {
svg.selectAll('.brush-area').remove();
}
// Create and configure the area generator
brushArea = d3Shape.area()
.x(({date}) => xScale(date))
.y0(chartHeight)
.y1(({value... | [
"function",
"drawArea",
"(",
")",
"{",
"if",
"(",
"brushArea",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.brush-area'",
")",
".",
"remove",
"(",
")",
";",
"}",
"// Create and configure the area generator",
"brushArea",
"=",
"d3Shape",
".",
"area",
"(",
")",
... | Draws the area that is going to represent the data
@return {void} | [
"Draws",
"the",
"area",
"that",
"is",
"going",
"to",
"represent",
"the",
"data"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L310-L328 |
8,429 | eventbrite/britecharts | src/charts/brush.js | drawBrush | function drawBrush() {
chartBrush = svg.select('.brush-group')
.call(brush);
// Update the height of the brushing rectangle
chartBrush.selectAll('rect')
.classed('brush-rect', true)
.attr('height', chartHeight);
... | javascript | function drawBrush() {
chartBrush = svg.select('.brush-group')
.call(brush);
// Update the height of the brushing rectangle
chartBrush.selectAll('rect')
.classed('brush-rect', true)
.attr('height', chartHeight);
... | [
"function",
"drawBrush",
"(",
")",
"{",
"chartBrush",
"=",
"svg",
".",
"select",
"(",
"'.brush-group'",
")",
".",
"call",
"(",
"brush",
")",
";",
"// Update the height of the brushing rectangle",
"chartBrush",
".",
"selectAll",
"(",
"'rect'",
")",
".",
"classed"... | Draws the Brush components on its group
@return {void} | [
"Draws",
"the",
"Brush",
"components",
"on",
"its",
"group"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L334-L345 |
8,430 | eventbrite/britecharts | src/charts/brush.js | drawHandles | function drawHandles() {
let handleFillColor = colorHelper.colorSchemasHuman.grey[1];
// Styling
handle = chartBrush
.selectAll('.handle.brush-rect')
.style('fill', handleFillColor);
} | javascript | function drawHandles() {
let handleFillColor = colorHelper.colorSchemasHuman.grey[1];
// Styling
handle = chartBrush
.selectAll('.handle.brush-rect')
.style('fill', handleFillColor);
} | [
"function",
"drawHandles",
"(",
")",
"{",
"let",
"handleFillColor",
"=",
"colorHelper",
".",
"colorSchemasHuman",
".",
"grey",
"[",
"1",
"]",
";",
"// Styling",
"handle",
"=",
"chartBrush",
".",
"selectAll",
"(",
"'.handle.brush-rect'",
")",
".",
"style",
"(",... | Draws a handle for the Brush section
@return {void} | [
"Draws",
"a",
"handle",
"for",
"the",
"Brush",
"section"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L351-L358 |
8,431 | eventbrite/britecharts | src/charts/brush.js | handleBrushStart | function handleBrushStart() {
const selection = d3Selection.event.selection;
if (!selection) {
return;
}
dispatcher.call('customBrushStart', this, selection.map(xScale.invert));
} | javascript | function handleBrushStart() {
const selection = d3Selection.event.selection;
if (!selection) {
return;
}
dispatcher.call('customBrushStart', this, selection.map(xScale.invert));
} | [
"function",
"handleBrushStart",
"(",
")",
"{",
"const",
"selection",
"=",
"d3Selection",
".",
"event",
".",
"selection",
";",
"if",
"(",
"!",
"selection",
")",
"{",
"return",
";",
"}",
"dispatcher",
".",
"call",
"(",
"'customBrushStart'",
",",
"this",
",",... | When a brush event starts, we can extract info from the extension
of the brush.
@return {void} | [
"When",
"a",
"brush",
"event",
"starts",
"we",
"can",
"extract",
"info",
"from",
"the",
"extension",
"of",
"the",
"brush",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L366-L374 |
8,432 | eventbrite/britecharts | src/charts/brush.js | setBrushByDates | function setBrushByDates(dateA, dateB) {
let selection = null;
if (dateA !== null) {
selection = [
xScale(new Date(dateA)),
xScale(new Date(dateB))
];
}
brush.move(chartBrush, selection);
} | javascript | function setBrushByDates(dateA, dateB) {
let selection = null;
if (dateA !== null) {
selection = [
xScale(new Date(dateA)),
xScale(new Date(dateB))
];
}
brush.move(chartBrush, selection);
} | [
"function",
"setBrushByDates",
"(",
"dateA",
",",
"dateB",
")",
"{",
"let",
"selection",
"=",
"null",
";",
"if",
"(",
"dateA",
"!==",
"null",
")",
"{",
"selection",
"=",
"[",
"xScale",
"(",
"new",
"Date",
"(",
"dateA",
")",
")",
",",
"xScale",
"(",
... | Sets a new brush extent within the passed dates
@param {String | Date} dateA Initial Date
@param {String | Date} dateB End Date | [
"Sets",
"a",
"new",
"brush",
"extent",
"within",
"the",
"passed",
"dates"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/brush.js#L414-L425 |
8,433 | eventbrite/britecharts | src/charts/sparkline.js | createGradients | function createGradients() {
let metadataGroup = svg.select('.metadata-group');
if (areaGradientEl || lineGradientEl) {
svg.selectAll(`#${areaGradientId}`).remove();
svg.selectAll(`#${lineGradientId}`).remove();
}
areaGradientEl = metadat... | javascript | function createGradients() {
let metadataGroup = svg.select('.metadata-group');
if (areaGradientEl || lineGradientEl) {
svg.selectAll(`#${areaGradientId}`).remove();
svg.selectAll(`#${lineGradientId}`).remove();
}
areaGradientEl = metadat... | [
"function",
"createGradients",
"(",
")",
"{",
"let",
"metadataGroup",
"=",
"svg",
".",
"select",
"(",
"'.metadata-group'",
")",
";",
"if",
"(",
"areaGradientEl",
"||",
"lineGradientEl",
")",
"{",
"svg",
".",
"selectAll",
"(",
"`",
"${",
"areaGradientId",
"}"... | Creates the gradient on the area below the line
@return {void} | [
"Creates",
"the",
"gradient",
"on",
"the",
"area",
"below",
"the",
"line"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/sparkline.js#L215-L256 |
8,434 | eventbrite/britecharts | src/charts/sparkline.js | drawArea | function drawArea(){
if (area) {
svg.selectAll('.sparkline-area').remove();
}
area = d3Shape.area()
.x(({date}) => xScale(date))
.y0(() => yScale(0) + lineStrokeWidth / 2)
.y1(({value}) => yScale(value))
... | javascript | function drawArea(){
if (area) {
svg.selectAll('.sparkline-area').remove();
}
area = d3Shape.area()
.x(({date}) => xScale(date))
.y0(() => yScale(0) + lineStrokeWidth / 2)
.y1(({value}) => yScale(value))
... | [
"function",
"drawArea",
"(",
")",
"{",
"if",
"(",
"area",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.sparkline-area'",
")",
".",
"remove",
"(",
")",
";",
"}",
"area",
"=",
"d3Shape",
".",
"area",
"(",
")",
".",
"x",
"(",
"(",
"{",
"date",
"}",
... | Draws the area that will be placed below the line
@private | [
"Draws",
"the",
"area",
"that",
"will",
"be",
"placed",
"below",
"the",
"line"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/sparkline.js#L290-L308 |
8,435 | eventbrite/britecharts | src/charts/sparkline.js | drawLine | function drawLine(){
if (topLine) {
svg.selectAll('.line').remove();
}
topLine = d3Shape.line()
.curve(d3Shape.curveBasis)
.x(({date}) => xScale(date))
.y(({value}) => yScale(value));
svg.select('.chart-gro... | javascript | function drawLine(){
if (topLine) {
svg.selectAll('.line').remove();
}
topLine = d3Shape.line()
.curve(d3Shape.curveBasis)
.x(({date}) => xScale(date))
.y(({value}) => yScale(value));
svg.select('.chart-gro... | [
"function",
"drawLine",
"(",
")",
"{",
"if",
"(",
"topLine",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.line'",
")",
".",
"remove",
"(",
")",
";",
"}",
"topLine",
"=",
"d3Shape",
".",
"line",
"(",
")",
".",
"curve",
"(",
"d3Shape",
".",
"curveBasis... | Draws the line element within the chart group
@private | [
"Draws",
"the",
"line",
"element",
"within",
"the",
"chart",
"group"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/sparkline.js#L314-L331 |
8,436 | eventbrite/britecharts | src/charts/sparkline.js | drawSparklineTitle | function drawSparklineTitle() {
if (titleEl) {
svg.selectAll('.sparkline-text').remove();
}
titleEl = svg.selectAll('.text-group')
.append('text')
.attr('x', chartWidth / 2)
.attr('y', chartHeight / 6)
.at... | javascript | function drawSparklineTitle() {
if (titleEl) {
svg.selectAll('.sparkline-text').remove();
}
titleEl = svg.selectAll('.text-group')
.append('text')
.attr('x', chartWidth / 2)
.attr('y', chartHeight / 6)
.at... | [
"function",
"drawSparklineTitle",
"(",
")",
"{",
"if",
"(",
"titleEl",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.sparkline-text'",
")",
".",
"remove",
"(",
")",
";",
"}",
"titleEl",
"=",
"svg",
".",
"selectAll",
"(",
"'.text-group'",
")",
".",
"append",... | Draws the text element within the text group
Is displayed at the top of sparked area
@private | [
"Draws",
"the",
"text",
"element",
"within",
"the",
"text",
"group",
"Is",
"displayed",
"at",
"the",
"top",
"of",
"sparked",
"area"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/sparkline.js#L338-L355 |
8,437 | eventbrite/britecharts | src/charts/sparkline.js | drawEndMarker | function drawEndMarker(){
if (circle) {
svg.selectAll('.sparkline-circle').remove();
}
circle = svg.selectAll('.chart-group')
.append('circle')
.attr('class', 'sparkline-circle')
.attr('cx', xScale(data[data.length - 1].d... | javascript | function drawEndMarker(){
if (circle) {
svg.selectAll('.sparkline-circle').remove();
}
circle = svg.selectAll('.chart-group')
.append('circle')
.attr('class', 'sparkline-circle')
.attr('cx', xScale(data[data.length - 1].d... | [
"function",
"drawEndMarker",
"(",
")",
"{",
"if",
"(",
"circle",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.sparkline-circle'",
")",
".",
"remove",
"(",
")",
";",
"}",
"circle",
"=",
"svg",
".",
"selectAll",
"(",
"'.chart-group'",
")",
".",
"append",
"... | Draws a marker at the end of the sparkline | [
"Draws",
"a",
"marker",
"at",
"the",
"end",
"of",
"the",
"sparkline"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/sparkline.js#L360-L371 |
8,438 | eventbrite/britecharts | sandbox/sandbox.js | main | function main() {
loadDependencies();
setInitialData();
domHelpers.initDomElements();
setDataInInputField();
setConfigInInputField();
setChartSelectorType();
setNewChart();
setHandlers();
} | javascript | function main() {
loadDependencies();
setInitialData();
domHelpers.initDomElements();
setDataInInputField();
setConfigInInputField();
setChartSelectorType();
setNewChart();
setHandlers();
} | [
"function",
"main",
"(",
")",
"{",
"loadDependencies",
"(",
")",
";",
"setInitialData",
"(",
")",
";",
"domHelpers",
".",
"initDomElements",
"(",
")",
";",
"setDataInInputField",
"(",
")",
";",
"setConfigInInputField",
"(",
")",
";",
"setChartSelectorType",
"(... | Main function to run the sandbox | [
"Main",
"function",
"to",
"run",
"the",
"sandbox"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L75-L85 |
8,439 | eventbrite/britecharts | sandbox/sandbox.js | setHandlers | function setHandlers() {
d3.select(`.${chartSelectorClass}`).on('change', _handleChartSelectorChange);
d3.select(`.${dataSelectorClass}`).on('change', _handleDataSelectorChange);
d3.select(`.${dataSubmitButtonClass}`).on('click', _handleDataUpdate);
d3.select(`.${dataResetButtonClass}`).on('click', _ha... | javascript | function setHandlers() {
d3.select(`.${chartSelectorClass}`).on('change', _handleChartSelectorChange);
d3.select(`.${dataSelectorClass}`).on('change', _handleDataSelectorChange);
d3.select(`.${dataSubmitButtonClass}`).on('click', _handleDataUpdate);
d3.select(`.${dataResetButtonClass}`).on('click', _ha... | [
"function",
"setHandlers",
"(",
")",
"{",
"d3",
".",
"select",
"(",
"`",
"${",
"chartSelectorClass",
"}",
"`",
")",
".",
"on",
"(",
"'change'",
",",
"_handleChartSelectorChange",
")",
";",
"d3",
".",
"select",
"(",
"`",
"${",
"dataSelectorClass",
"}",
"`... | Sets handlers on all of our input fields on the sandbox dom | [
"Sets",
"handlers",
"on",
"all",
"of",
"our",
"input",
"fields",
"on",
"the",
"sandbox",
"dom"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L98-L111 |
8,440 | eventbrite/britecharts | sandbox/sandbox.js | setNewDataTypes | function setNewDataTypes() {
let chartType = getCurrentType();
let dataTypes = Object.keys(defaultData[chartType]);
let dataSelector = d3.select(`.${dataSelectorClass}`)
.selectAll('option')
.data(dataTypes);
dataSelector.enter().append('option')
.merge(dataSelector)
... | javascript | function setNewDataTypes() {
let chartType = getCurrentType();
let dataTypes = Object.keys(defaultData[chartType]);
let dataSelector = d3.select(`.${dataSelectorClass}`)
.selectAll('option')
.data(dataTypes);
dataSelector.enter().append('option')
.merge(dataSelector)
... | [
"function",
"setNewDataTypes",
"(",
")",
"{",
"let",
"chartType",
"=",
"getCurrentType",
"(",
")",
";",
"let",
"dataTypes",
"=",
"Object",
".",
"keys",
"(",
"defaultData",
"[",
"chartType",
"]",
")",
";",
"let",
"dataSelector",
"=",
"d3",
".",
"select",
... | Reads from the constants file to fill the data type selelctor with the data types of that chart | [
"Reads",
"from",
"the",
"constants",
"file",
"to",
"fill",
"the",
"data",
"type",
"selelctor",
"with",
"the",
"data",
"types",
"of",
"that",
"chart"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L176-L190 |
8,441 | eventbrite/britecharts | sandbox/sandbox.js | getCurrentData | function getCurrentData() {
let currentData = storage.getDataByKey(savedDataKey);
if (!currentData) {
let chartType = getCurrentType();
let {initialDataType} = defaultConfig[chartType];
currentData = defaultData[chartType][initialDataType];
storage.setDataByKey(savedDataKey, c... | javascript | function getCurrentData() {
let currentData = storage.getDataByKey(savedDataKey);
if (!currentData) {
let chartType = getCurrentType();
let {initialDataType} = defaultConfig[chartType];
currentData = defaultData[chartType][initialDataType];
storage.setDataByKey(savedDataKey, c... | [
"function",
"getCurrentData",
"(",
")",
"{",
"let",
"currentData",
"=",
"storage",
".",
"getDataByKey",
"(",
"savedDataKey",
")",
";",
"if",
"(",
"!",
"currentData",
")",
"{",
"let",
"chartType",
"=",
"getCurrentType",
"(",
")",
";",
"let",
"{",
"initialDa... | Gets the current data either from the store or from the data file.
If no data is found on the store, one is set from the data file.
@return {Object} Data object [data is parsed before it is set] | [
"Gets",
"the",
"current",
"data",
"either",
"from",
"the",
"store",
"or",
"from",
"the",
"data",
"file",
".",
"If",
"no",
"data",
"is",
"found",
"on",
"the",
"store",
"one",
"is",
"set",
"from",
"the",
"data",
"file",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L197-L210 |
8,442 | eventbrite/britecharts | sandbox/sandbox.js | getCurrentConfig | function getCurrentConfig() {
let initString = storage.getDataByKey(savedConfigKey);
if (!initString) {
let chartType = getCurrentType();
let {chartConfig} = defaultConfig[chartType];
initString = formatParamsIntoChartInitString(chartConfig);
storage.setDataByKey(savedConfigKe... | javascript | function getCurrentConfig() {
let initString = storage.getDataByKey(savedConfigKey);
if (!initString) {
let chartType = getCurrentType();
let {chartConfig} = defaultConfig[chartType];
initString = formatParamsIntoChartInitString(chartConfig);
storage.setDataByKey(savedConfigKe... | [
"function",
"getCurrentConfig",
"(",
")",
"{",
"let",
"initString",
"=",
"storage",
".",
"getDataByKey",
"(",
"savedConfigKey",
")",
";",
"if",
"(",
"!",
"initString",
")",
"{",
"let",
"chartType",
"=",
"getCurrentType",
"(",
")",
";",
"let",
"{",
"chartCo... | Gets teh current chart configuration either from the store or from the constants file.
If no configuraiton is found on the store, one is set from the constants.
@return {String} config string | [
"Gets",
"teh",
"current",
"chart",
"configuration",
"either",
"from",
"the",
"store",
"or",
"from",
"the",
"constants",
"file",
".",
"If",
"no",
"configuraiton",
"is",
"found",
"on",
"the",
"store",
"one",
"is",
"set",
"from",
"the",
"constants",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L217-L230 |
8,443 | eventbrite/britecharts | sandbox/sandbox.js | getCurrentType | function getCurrentType() {
let currentType = storage.getDataByKey(savedChartTypeKey);
if (!currentType) {
currentType = charts[0];
storage.setDataByKey(savedChartTypeKey, currentType);
}
return currentType;
} | javascript | function getCurrentType() {
let currentType = storage.getDataByKey(savedChartTypeKey);
if (!currentType) {
currentType = charts[0];
storage.setDataByKey(savedChartTypeKey, currentType);
}
return currentType;
} | [
"function",
"getCurrentType",
"(",
")",
"{",
"let",
"currentType",
"=",
"storage",
".",
"getDataByKey",
"(",
"savedChartTypeKey",
")",
";",
"if",
"(",
"!",
"currentType",
")",
"{",
"currentType",
"=",
"charts",
"[",
"0",
"]",
";",
"storage",
".",
"setDataB... | Gets the current chart type either from the store or from the constants file
If no chart type is found in the store, one is set from the constants.
@return {String} chart type | [
"Gets",
"the",
"current",
"chart",
"type",
"either",
"from",
"the",
"store",
"or",
"from",
"the",
"constants",
"file",
"If",
"no",
"chart",
"type",
"is",
"found",
"in",
"the",
"store",
"one",
"is",
"set",
"from",
"the",
"constants",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L237-L246 |
8,444 | eventbrite/britecharts | sandbox/sandbox.js | _handleAddTooltip | function _handleAddTooltip(tooltipType) {
let initString = getCurrentConfig();
let tooltipInitString = tooltipConfigs[tooltipType].initString;
initString = initString.concat(tooltipInitString);
configEditor.setValue(prettifyInitString(initString));
setNewChart();
} | javascript | function _handleAddTooltip(tooltipType) {
let initString = getCurrentConfig();
let tooltipInitString = tooltipConfigs[tooltipType].initString;
initString = initString.concat(tooltipInitString);
configEditor.setValue(prettifyInitString(initString));
setNewChart();
} | [
"function",
"_handleAddTooltip",
"(",
"tooltipType",
")",
"{",
"let",
"initString",
"=",
"getCurrentConfig",
"(",
")",
";",
"let",
"tooltipInitString",
"=",
"tooltipConfigs",
"[",
"tooltipType",
"]",
".",
"initString",
";",
"initString",
"=",
"initString",
".",
... | Adds tooltip code to the editor
@param {string} tooltipType Constant from constant file | [
"Adds",
"tooltip",
"code",
"to",
"the",
"editor"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L252-L258 |
8,445 | eventbrite/britecharts | sandbox/sandbox.js | _handleDataSelectorChange | function _handleDataSelectorChange () {
let chartType = getCurrentType();
let dataType = d3.select(`.${dataSelectorClass}`).property('value');
let currentData = defaultData[chartType][dataType];
storage.setDataByKey(savedDataKey, currentData);
updateAllComponents();
} | javascript | function _handleDataSelectorChange () {
let chartType = getCurrentType();
let dataType = d3.select(`.${dataSelectorClass}`).property('value');
let currentData = defaultData[chartType][dataType];
storage.setDataByKey(savedDataKey, currentData);
updateAllComponents();
} | [
"function",
"_handleDataSelectorChange",
"(",
")",
"{",
"let",
"chartType",
"=",
"getCurrentType",
"(",
")",
";",
"let",
"dataType",
"=",
"d3",
".",
"select",
"(",
"`",
"${",
"dataSelectorClass",
"}",
"`",
")",
".",
"property",
"(",
"'value'",
")",
";",
... | Handles data selection change, updates the data on the store and then updates all components | [
"Handles",
"data",
"selection",
"change",
"updates",
"the",
"data",
"on",
"the",
"store",
"and",
"then",
"updates",
"all",
"components"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L263-L270 |
8,446 | eventbrite/britecharts | sandbox/sandbox.js | _handleDataUpdate | function _handleDataUpdate() {
const rawData = dataEditor.getValue();
let freshData = null;
try {
freshData = evalDataString(rawData);
} catch(e) {
errors.push(new Error('Could not parse the data from the input field', rawData));
}
storage.setDataByKey(savedDataKey, freshData);... | javascript | function _handleDataUpdate() {
const rawData = dataEditor.getValue();
let freshData = null;
try {
freshData = evalDataString(rawData);
} catch(e) {
errors.push(new Error('Could not parse the data from the input field', rawData));
}
storage.setDataByKey(savedDataKey, freshData);... | [
"function",
"_handleDataUpdate",
"(",
")",
"{",
"const",
"rawData",
"=",
"dataEditor",
".",
"getValue",
"(",
")",
";",
"let",
"freshData",
"=",
"null",
";",
"try",
"{",
"freshData",
"=",
"evalDataString",
"(",
"rawData",
")",
";",
"}",
"catch",
"(",
"e",... | Updates the data for the chart on the store, then sets a new chart so the new data is displayed
@return {[type]} [description] | [
"Updates",
"the",
"data",
"for",
"the",
"chart",
"on",
"the",
"store",
"then",
"sets",
"a",
"new",
"chart",
"so",
"the",
"new",
"data",
"is",
"displayed"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L288-L303 |
8,447 | eventbrite/britecharts | sandbox/sandbox.js | _handleDataReset | function _handleDataReset() {
storage.removeDataByKey(savedDataKey);
let data = getCurrentData();
dataEditor.setValue(prettifyJson(data));
} | javascript | function _handleDataReset() {
storage.removeDataByKey(savedDataKey);
let data = getCurrentData();
dataEditor.setValue(prettifyJson(data));
} | [
"function",
"_handleDataReset",
"(",
")",
"{",
"storage",
".",
"removeDataByKey",
"(",
"savedDataKey",
")",
";",
"let",
"data",
"=",
"getCurrentData",
"(",
")",
";",
"dataEditor",
".",
"setValue",
"(",
"prettifyJson",
"(",
"data",
")",
")",
";",
"}"
] | Resets the data to its default state | [
"Resets",
"the",
"data",
"to",
"its",
"default",
"state"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L308-L314 |
8,448 | eventbrite/britecharts | sandbox/sandbox.js | _handleConfigReset | function _handleConfigReset() {
storage.removeDataByKey(savedConfigKey);
let initString = getCurrentConfig();
configEditor.setValue(prettifyInitString(initString));
} | javascript | function _handleConfigReset() {
storage.removeDataByKey(savedConfigKey);
let initString = getCurrentConfig();
configEditor.setValue(prettifyInitString(initString));
} | [
"function",
"_handleConfigReset",
"(",
")",
"{",
"storage",
".",
"removeDataByKey",
"(",
"savedConfigKey",
")",
";",
"let",
"initString",
"=",
"getCurrentConfig",
"(",
")",
";",
"configEditor",
".",
"setValue",
"(",
"prettifyInitString",
"(",
"initString",
")",
... | Resets the chart config to its default state | [
"Resets",
"the",
"chart",
"config",
"to",
"its",
"default",
"state"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L329-L335 |
8,449 | eventbrite/britecharts | sandbox/sandbox.js | _handleChartSelectorChange | function _handleChartSelectorChange() {
storage.clear();
let chartType = d3.select(`.${chartSelectorClass}`).property('value');
storage.setDataByKey(savedChartTypeKey, chartType);
updateAllComponents();
} | javascript | function _handleChartSelectorChange() {
storage.clear();
let chartType = d3.select(`.${chartSelectorClass}`).property('value');
storage.setDataByKey(savedChartTypeKey, chartType);
updateAllComponents();
} | [
"function",
"_handleChartSelectorChange",
"(",
")",
"{",
"storage",
".",
"clear",
"(",
")",
";",
"let",
"chartType",
"=",
"d3",
".",
"select",
"(",
"`",
"${",
"chartSelectorClass",
"}",
"`",
")",
".",
"property",
"(",
"'value'",
")",
";",
"storage",
".",... | Updates the chart type when the chart selector is changed | [
"Updates",
"the",
"chart",
"type",
"when",
"the",
"chart",
"selector",
"is",
"changed"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L341-L348 |
8,450 | eventbrite/britecharts | sandbox/sandbox.js | _safeLoadDependency | function _safeLoadDependency(name) {
try {
window[name.split('/').pop()] = require(`../src/charts/${name}`);
} catch(e) {
errors.push({
error: e,
filePath: name
});
}
} | javascript | function _safeLoadDependency(name) {
try {
window[name.split('/').pop()] = require(`../src/charts/${name}`);
} catch(e) {
errors.push({
error: e,
filePath: name
});
}
} | [
"function",
"_safeLoadDependency",
"(",
"name",
")",
"{",
"try",
"{",
"window",
"[",
"name",
".",
"split",
"(",
"'/'",
")",
".",
"pop",
"(",
")",
"]",
"=",
"require",
"(",
"`",
"${",
"name",
"}",
"`",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",... | Safe load dependency. If there is an error, it loads the error to be displayed in the notification bar
@param {file name} name name of fiel at src/charts. probably could refactor to take full path | [
"Safe",
"load",
"dependency",
".",
"If",
"there",
"is",
"an",
"error",
"it",
"loads",
"the",
"error",
"to",
"be",
"displayed",
"in",
"the",
"notification",
"bar"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/sandbox/sandbox.js#L354-L363 |
8,451 | eventbrite/britecharts | src/charts/scatter-plot.js | buildAxis | function buildAxis() {
xAxis = d3Axis.axisBottom(xScale)
.ticks(xTicks)
.tickPadding(tickPadding)
.tickFormat(d3Format.format(xAxisFormat));
yAxis = d3Axis.axisLeft(yScale)
.ticks(yTicks)
.tickPadding(tickPadding)
... | javascript | function buildAxis() {
xAxis = d3Axis.axisBottom(xScale)
.ticks(xTicks)
.tickPadding(tickPadding)
.tickFormat(d3Format.format(xAxisFormat));
yAxis = d3Axis.axisLeft(yScale)
.ticks(yTicks)
.tickPadding(tickPadding)
... | [
"function",
"buildAxis",
"(",
")",
"{",
"xAxis",
"=",
"d3Axis",
".",
"axisBottom",
"(",
"xScale",
")",
".",
"ticks",
"(",
"xTicks",
")",
".",
"tickPadding",
"(",
"tickPadding",
")",
".",
"tickFormat",
"(",
"d3Format",
".",
"format",
"(",
"xAxisFormat",
"... | Creates the x-axis and y-axis with proper orientations
@return {void}
@private | [
"Creates",
"the",
"x",
"-",
"axis",
"and",
"y",
"-",
"axis",
"with",
"proper",
"orientations"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L241-L251 |
8,452 | eventbrite/britecharts | src/charts/scatter-plot.js | buildVoronoi | function buildVoronoi() {
voronoi = d3Voronoi.voronoi()
.x((d) => xScale(d.x))
.y((d) => yScale(d.y))
.extent([
[0, 0],
[chartWidth, chartHeight]
])(dataPoints);
} | javascript | function buildVoronoi() {
voronoi = d3Voronoi.voronoi()
.x((d) => xScale(d.x))
.y((d) => yScale(d.y))
.extent([
[0, 0],
[chartWidth, chartHeight]
])(dataPoints);
} | [
"function",
"buildVoronoi",
"(",
")",
"{",
"voronoi",
"=",
"d3Voronoi",
".",
"voronoi",
"(",
")",
".",
"x",
"(",
"(",
"d",
")",
"=>",
"xScale",
"(",
"d",
".",
"x",
")",
")",
".",
"y",
"(",
"(",
"d",
")",
"=>",
"yScale",
"(",
"d",
".",
"y",
... | Draws the voronoi component in the chart.
@return {void}
@private | [
"Draws",
"the",
"voronoi",
"component",
"in",
"the",
"chart",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L286-L294 |
8,453 | eventbrite/britecharts | src/charts/scatter-plot.js | buildScales | function buildScales() {
const [minX, minY] = [d3Array.min(dataPoints, ({ x }) => x), d3Array.min(dataPoints, ({ y }) => y)];
const [maxX, maxY] = [d3Array.max(dataPoints, ({ x }) => x), d3Array.max(dataPoints, ({ y }) => y)];
const yScaleBottomValue = Math.abs(minY) < 0 ? Math.abs(m... | javascript | function buildScales() {
const [minX, minY] = [d3Array.min(dataPoints, ({ x }) => x), d3Array.min(dataPoints, ({ y }) => y)];
const [maxX, maxY] = [d3Array.max(dataPoints, ({ x }) => x), d3Array.max(dataPoints, ({ y }) => y)];
const yScaleBottomValue = Math.abs(minY) < 0 ? Math.abs(m... | [
"function",
"buildScales",
"(",
")",
"{",
"const",
"[",
"minX",
",",
"minY",
"]",
"=",
"[",
"d3Array",
".",
"min",
"(",
"dataPoints",
",",
"(",
"{",
"x",
"}",
")",
"=>",
"x",
")",
",",
"d3Array",
".",
"min",
"(",
"dataPoints",
",",
"(",
"{",
"y... | Creates the x and y scales of the chart
@return {void}
@private | [
"Creates",
"the",
"x",
"and",
"y",
"scales",
"of",
"the",
"chart"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L301-L342 |
8,454 | eventbrite/britecharts | src/charts/scatter-plot.js | cleanData | function cleanData(originalData) {
return originalData.reduce((acc, d) => {
d.name = String(d[nameKey]);
d.x = d[xKey];
d.y = d[yKey];
return [...acc, d];
}, []);
} | javascript | function cleanData(originalData) {
return originalData.reduce((acc, d) => {
d.name = String(d[nameKey]);
d.x = d[xKey];
d.y = d[yKey];
return [...acc, d];
}, []);
} | [
"function",
"cleanData",
"(",
"originalData",
")",
"{",
"return",
"originalData",
".",
"reduce",
"(",
"(",
"acc",
",",
"d",
")",
"=>",
"{",
"d",
".",
"name",
"=",
"String",
"(",
"d",
"[",
"nameKey",
"]",
")",
";",
"d",
".",
"x",
"=",
"d",
"[",
... | Cleaning data casting the values and names to the proper type while keeping
the rest of properties on the data
@param {ScatterPlotData} originalData Raw data as passed to the container
@return {ScatterPlotData} Clean data
@private | [
"Cleaning",
"data",
"casting",
"the",
"values",
"and",
"names",
"to",
"the",
"proper",
"type",
"while",
"keeping",
"the",
"rest",
"of",
"properties",
"on",
"the",
"data"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L372-L380 |
8,455 | eventbrite/britecharts | src/charts/scatter-plot.js | drawAxisLabels | function drawAxisLabels() {
// If y-axis label is given, draw it
if (yAxisLabel) {
if (yAxisLabelEl) {
svg.selectAll('.y-axis-label-text').remove();
}
yAxisLabelEl = svg.select('.axis-labels-group')
.append(... | javascript | function drawAxisLabels() {
// If y-axis label is given, draw it
if (yAxisLabel) {
if (yAxisLabelEl) {
svg.selectAll('.y-axis-label-text').remove();
}
yAxisLabelEl = svg.select('.axis-labels-group')
.append(... | [
"function",
"drawAxisLabels",
"(",
")",
"{",
"// If y-axis label is given, draw it",
"if",
"(",
"yAxisLabel",
")",
"{",
"if",
"(",
"yAxisLabelEl",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'.y-axis-label-text'",
")",
".",
"remove",
"(",
")",
";",
"}",
"yAxisLab... | Draws axis labels next to x and y axis to
represent data value labels on the chart
@return {void}
@private | [
"Draws",
"axis",
"labels",
"next",
"to",
"x",
"and",
"y",
"axis",
"to",
"represent",
"data",
"value",
"labels",
"on",
"the",
"chart"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L405-L440 |
8,456 | eventbrite/britecharts | src/charts/scatter-plot.js | drawTrendline | function drawTrendline(linearData) {
if (trendLinePath) {
trendLinePath.remove();
}
const params = [
{x: linearData.x1, y: linearData.y1},
{x: linearData.x2, y: linearData.y2}
];
let line = d3Shape.line()
... | javascript | function drawTrendline(linearData) {
if (trendLinePath) {
trendLinePath.remove();
}
const params = [
{x: linearData.x1, y: linearData.y1},
{x: linearData.x2, y: linearData.y2}
];
let line = d3Shape.line()
... | [
"function",
"drawTrendline",
"(",
"linearData",
")",
"{",
"if",
"(",
"trendLinePath",
")",
"{",
"trendLinePath",
".",
"remove",
"(",
")",
";",
"}",
"const",
"params",
"=",
"[",
"{",
"x",
":",
"linearData",
".",
"x1",
",",
"y",
":",
"linearData",
".",
... | Draws a trend line given the data that contains
and y params from calculated y-intercept and slope
using linear regression formula.
@param {Object} linearData
@returns {void}
@private | [
"Draws",
"a",
"trend",
"line",
"given",
"the",
"data",
"that",
"contains",
"and",
"y",
"params",
"from",
"calculated",
"y",
"-",
"intercept",
"and",
"slope",
"using",
"linear",
"regression",
"formula",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L468-L501 |
8,457 | eventbrite/britecharts | src/charts/scatter-plot.js | drawVerticalGridLines | function drawVerticalGridLines() {
maskGridLines = svg.select('.grid-lines-group')
.selectAll('line.vertical-grid-line')
.data(xScale.ticks(xTicks))
.enter()
.append('line')
.attr('class', 'vertical-grid-line')
... | javascript | function drawVerticalGridLines() {
maskGridLines = svg.select('.grid-lines-group')
.selectAll('line.vertical-grid-line')
.data(xScale.ticks(xTicks))
.enter()
.append('line')
.attr('class', 'vertical-grid-line')
... | [
"function",
"drawVerticalGridLines",
"(",
")",
"{",
"maskGridLines",
"=",
"svg",
".",
"select",
"(",
"'.grid-lines-group'",
")",
".",
"selectAll",
"(",
"'line.vertical-grid-line'",
")",
".",
"data",
"(",
"xScale",
".",
"ticks",
"(",
"xTicks",
")",
")",
".",
... | Draws vertical gridlines of the chart
These gridlines are parallel to y-axis
@return {void}
@private | [
"Draws",
"vertical",
"gridlines",
"of",
"the",
"chart",
"These",
"gridlines",
"are",
"parallel",
"to",
"y",
"-",
"axis"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L509-L520 |
8,458 | eventbrite/britecharts | src/charts/scatter-plot.js | drawDataPoints | function drawDataPoints() {
let circles = svg.select('.chart-group')
.attr('clip-path', `url(#${maskingRectangleId})`)
.selectAll('circle')
.data(dataPoints)
.enter();
if (isAnimated) {
circles
.... | javascript | function drawDataPoints() {
let circles = svg.select('.chart-group')
.attr('clip-path', `url(#${maskingRectangleId})`)
.selectAll('circle')
.data(dataPoints)
.enter();
if (isAnimated) {
circles
.... | [
"function",
"drawDataPoints",
"(",
")",
"{",
"let",
"circles",
"=",
"svg",
".",
"select",
"(",
"'.chart-group'",
")",
".",
"attr",
"(",
"'clip-path'",
",",
"`",
"${",
"maskingRectangleId",
"}",
"`",
")",
".",
"selectAll",
"(",
"'circle'",
")",
".",
"data... | Draws the points for each data element on the chart group
@return {void}
@private | [
"Draws",
"the",
"points",
"for",
"each",
"data",
"element",
"on",
"the",
"chart",
"group"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L527-L566 |
8,459 | eventbrite/britecharts | src/charts/scatter-plot.js | drawDataPointsValueHighlights | function drawDataPointsValueHighlights(data) {
showCrossHairComponentsWithLabels(true);
// Draw line perpendicular to y-axis
highlightCrossHairContainer.selectAll('line.highlight-y-line')
.attr('stroke', nameColorMap[data.name])
.attr('class', 'highlight-... | javascript | function drawDataPointsValueHighlights(data) {
showCrossHairComponentsWithLabels(true);
// Draw line perpendicular to y-axis
highlightCrossHairContainer.selectAll('line.highlight-y-line')
.attr('stroke', nameColorMap[data.name])
.attr('class', 'highlight-... | [
"function",
"drawDataPointsValueHighlights",
"(",
"data",
")",
"{",
"showCrossHairComponentsWithLabels",
"(",
"true",
")",
";",
"// Draw line perpendicular to y-axis",
"highlightCrossHairContainer",
".",
"selectAll",
"(",
"'line.highlight-y-line'",
")",
".",
"attr",
"(",
"'... | Draws the crosshair lines and label components
given the coordinates and name of the data point
@param {Object} dataPoint
@return {void}
@private | [
"Draws",
"the",
"crosshair",
"lines",
"and",
"label",
"components",
"given",
"the",
"coordinates",
"and",
"name",
"of",
"the",
"data",
"point"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L575-L614 |
8,460 | eventbrite/britecharts | src/charts/scatter-plot.js | drawHorizontalGridLines | function drawHorizontalGridLines() {
maskGridLines = svg.select('.grid-lines-group')
.selectAll('line.horizontal-grid-line')
.data(yScale.ticks(yTicks))
.enter()
.append('line')
.attr('class', 'horizontal-grid-line')
... | javascript | function drawHorizontalGridLines() {
maskGridLines = svg.select('.grid-lines-group')
.selectAll('line.horizontal-grid-line')
.data(yScale.ticks(yTicks))
.enter()
.append('line')
.attr('class', 'horizontal-grid-line')
... | [
"function",
"drawHorizontalGridLines",
"(",
")",
"{",
"maskGridLines",
"=",
"svg",
".",
"select",
"(",
"'.grid-lines-group'",
")",
".",
"selectAll",
"(",
"'line.horizontal-grid-line'",
")",
".",
"data",
"(",
"yScale",
".",
"ticks",
"(",
"yTicks",
")",
")",
"."... | Draw horizontal gridles of the chart
These gridlines are parallel to x-axis
@return {void}
@private | [
"Draw",
"horizontal",
"gridles",
"of",
"the",
"chart",
"These",
"gridlines",
"are",
"parallel",
"to",
"x",
"-",
"axis"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L661-L672 |
8,461 | eventbrite/britecharts | src/charts/scatter-plot.js | calcLinearRegression | function calcLinearRegression() {
let n = dataPoints.length,
x = 0,
y = 0,
xy = 0,
x2 = 0,
y2 = 0;
dataPoints.forEach(d => {
x += d.x;
y += d.y;
xy += d.x * d.y;
x2 += d.x... | javascript | function calcLinearRegression() {
let n = dataPoints.length,
x = 0,
y = 0,
xy = 0,
x2 = 0,
y2 = 0;
dataPoints.forEach(d => {
x += d.x;
y += d.y;
xy += d.x * d.y;
x2 += d.x... | [
"function",
"calcLinearRegression",
"(",
")",
"{",
"let",
"n",
"=",
"dataPoints",
".",
"length",
",",
"x",
"=",
"0",
",",
"y",
"=",
"0",
",",
"xy",
"=",
"0",
",",
"x2",
"=",
"0",
",",
"y2",
"=",
"0",
";",
"dataPoints",
".",
"forEach",
"(",
"d",... | Returns an object that contains necessary
coordinates for drawing the trendline. The
calculation of slope and y-intercept uses
basic accumulative linear regression formula.
@return {Object}
@private | [
"Returns",
"an",
"object",
"that",
"contains",
"necessary",
"coordinates",
"for",
"drawing",
"the",
"trendline",
".",
"The",
"calculation",
"of",
"slope",
"and",
"y",
"-",
"intercept",
"uses",
"basic",
"accumulative",
"linear",
"regression",
"formula",
"."
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L682-L710 |
8,462 | eventbrite/britecharts | src/charts/scatter-plot.js | getPointProps | function getPointProps(svg) {
let mousePos = d3Selection.mouse(svg);
mousePos[0] -= margin.left;
mousePos[1] -= margin.top;
return {
closestPoint: voronoi.find(mousePos[0], mousePos[1]),
mousePos
};
} | javascript | function getPointProps(svg) {
let mousePos = d3Selection.mouse(svg);
mousePos[0] -= margin.left;
mousePos[1] -= margin.top;
return {
closestPoint: voronoi.find(mousePos[0], mousePos[1]),
mousePos
};
} | [
"function",
"getPointProps",
"(",
"svg",
")",
"{",
"let",
"mousePos",
"=",
"d3Selection",
".",
"mouse",
"(",
"svg",
")",
";",
"mousePos",
"[",
"0",
"]",
"-=",
"margin",
".",
"left",
";",
"mousePos",
"[",
"1",
"]",
"-=",
"margin",
".",
"top",
";",
"... | Calculates and returns
@param {*} svg
@return {Object}
@private | [
"Calculates",
"and",
"returns"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L718-L728 |
8,463 | eventbrite/britecharts | src/charts/scatter-plot.js | handleMouseMove | function handleMouseMove(e) {
let { mousePos, closestPoint } = getPointProps(e);
let pointData = getPointData(closestPoint);
if (hasCrossHairs) {
drawDataPointsValueHighlights(pointData);
}
highlightDataPoint(pointData);
dispatch... | javascript | function handleMouseMove(e) {
let { mousePos, closestPoint } = getPointProps(e);
let pointData = getPointData(closestPoint);
if (hasCrossHairs) {
drawDataPointsValueHighlights(pointData);
}
highlightDataPoint(pointData);
dispatch... | [
"function",
"handleMouseMove",
"(",
"e",
")",
"{",
"let",
"{",
"mousePos",
",",
"closestPoint",
"}",
"=",
"getPointProps",
"(",
"e",
")",
";",
"let",
"pointData",
"=",
"getPointData",
"(",
"closestPoint",
")",
";",
"if",
"(",
"hasCrossHairs",
")",
"{",
"... | Handler called on mousemove event
@return {void}
@private | [
"Handler",
"called",
"on",
"mousemove",
"event"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L735-L746 |
8,464 | eventbrite/britecharts | src/charts/scatter-plot.js | handleMouseOver | function handleMouseOver (e, d) {
dispatcher.call('customMouseOver', e, d, d3Selection.mouse(e));
} | javascript | function handleMouseOver (e, d) {
dispatcher.call('customMouseOver', e, d, d3Selection.mouse(e));
} | [
"function",
"handleMouseOver",
"(",
"e",
",",
"d",
")",
"{",
"dispatcher",
".",
"call",
"(",
"'customMouseOver'",
",",
"e",
",",
"d",
",",
"d3Selection",
".",
"mouse",
"(",
"e",
")",
")",
";",
"}"
] | Handler called on mouseover event
@return {void}
@private | [
"Handler",
"called",
"on",
"mouseover",
"event"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L753-L755 |
8,465 | eventbrite/britecharts | src/charts/scatter-plot.js | handleMouseOut | function handleMouseOut(e, d) {
removePointHighlight();
if (hasCrossHairs) {
showCrossHairComponentsWithLabels(false);
}
dispatcher.call('customMouseOut', e, d, d3Selection.mouse(e));
} | javascript | function handleMouseOut(e, d) {
removePointHighlight();
if (hasCrossHairs) {
showCrossHairComponentsWithLabels(false);
}
dispatcher.call('customMouseOut', e, d, d3Selection.mouse(e));
} | [
"function",
"handleMouseOut",
"(",
"e",
",",
"d",
")",
"{",
"removePointHighlight",
"(",
")",
";",
"if",
"(",
"hasCrossHairs",
")",
"{",
"showCrossHairComponentsWithLabels",
"(",
"false",
")",
";",
"}",
"dispatcher",
".",
"call",
"(",
"'customMouseOut'",
",",
... | Handler called on mouseout event
@return {void}
@private | [
"Handler",
"called",
"on",
"mouseout",
"event"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L762-L769 |
8,466 | eventbrite/britecharts | src/charts/scatter-plot.js | handleClick | function handleClick(e) {
let { closestPoint } = getPointProps(e);
let d = getPointData(closestPoint);
handleClickAnimation(d);
dispatcher.call('customClick', e, d, d3Selection.mouse(e), [chartWidth, chartHeight]);
} | javascript | function handleClick(e) {
let { closestPoint } = getPointProps(e);
let d = getPointData(closestPoint);
handleClickAnimation(d);
dispatcher.call('customClick', e, d, d3Selection.mouse(e), [chartWidth, chartHeight]);
} | [
"function",
"handleClick",
"(",
"e",
")",
"{",
"let",
"{",
"closestPoint",
"}",
"=",
"getPointProps",
"(",
"e",
")",
";",
"let",
"d",
"=",
"getPointData",
"(",
"closestPoint",
")",
";",
"handleClickAnimation",
"(",
"d",
")",
";",
"dispatcher",
".",
"call... | Custom onClick event handler
@return {void}
@private | [
"Custom",
"onClick",
"event",
"handler"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L776-L783 |
8,467 | eventbrite/britecharts | src/charts/scatter-plot.js | handleClickAnimation | function handleClickAnimation(dataPoint) {
bounceCircleHighlight(
highlightCircle,
ease,
areaScale(dataPoint.y),
areaScale(dataPoint.y * 2)
);
} | javascript | function handleClickAnimation(dataPoint) {
bounceCircleHighlight(
highlightCircle,
ease,
areaScale(dataPoint.y),
areaScale(dataPoint.y * 2)
);
} | [
"function",
"handleClickAnimation",
"(",
"dataPoint",
")",
"{",
"bounceCircleHighlight",
"(",
"highlightCircle",
",",
"ease",
",",
"areaScale",
"(",
"dataPoint",
".",
"y",
")",
",",
"areaScale",
"(",
"dataPoint",
".",
"y",
"*",
"2",
")",
")",
";",
"}"
] | Applies animation on data point click
@param {Object} dataPoint
@return {void}
@private | [
"Applies",
"animation",
"on",
"data",
"point",
"click"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L791-L798 |
8,468 | eventbrite/britecharts | src/charts/scatter-plot.js | highlightDataPoint | function highlightDataPoint(data) {
removePointHighlight();
if (!highlightFilter) {
highlightFilter = createFilterContainer(svg.select('.metadata-group'));
highlightFilterId = createGlowWithMatrix(highlightFilter);
}
highlightCircle
... | javascript | function highlightDataPoint(data) {
removePointHighlight();
if (!highlightFilter) {
highlightFilter = createFilterContainer(svg.select('.metadata-group'));
highlightFilterId = createGlowWithMatrix(highlightFilter);
}
highlightCircle
... | [
"function",
"highlightDataPoint",
"(",
"data",
")",
"{",
"removePointHighlight",
"(",
")",
";",
"if",
"(",
"!",
"highlightFilter",
")",
"{",
"highlightFilter",
"=",
"createFilterContainer",
"(",
"svg",
".",
"select",
"(",
"'.metadata-group'",
")",
")",
";",
"h... | Applies glow to hovered data point
@return {void}
@private | [
"Applies",
"glow",
"to",
"hovered",
"data",
"point"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L805-L827 |
8,469 | eventbrite/britecharts | src/charts/scatter-plot.js | initHighlightComponents | function initHighlightComponents() {
highlightCircle = svg.select('.metadata-group')
.selectAll('circle.highlight-circle')
.data([1])
.enter()
.append('circle')
.attr('class', 'highlight-circle')
.attr(... | javascript | function initHighlightComponents() {
highlightCircle = svg.select('.metadata-group')
.selectAll('circle.highlight-circle')
.data([1])
.enter()
.append('circle')
.attr('class', 'highlight-circle')
.attr(... | [
"function",
"initHighlightComponents",
"(",
")",
"{",
"highlightCircle",
"=",
"svg",
".",
"select",
"(",
"'.metadata-group'",
")",
".",
"selectAll",
"(",
"'circle.highlight-circle'",
")",
".",
"data",
"(",
"[",
"1",
"]",
")",
".",
"enter",
"(",
")",
".",
"... | Places the highlighter point to the DOM
to be used once one of the data points is
highlighted
@return {void}
@private | [
"Places",
"the",
"highlighter",
"point",
"to",
"the",
"DOM",
"to",
"be",
"used",
"once",
"one",
"of",
"the",
"data",
"points",
"is",
"highlighted"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L836-L880 |
8,470 | eventbrite/britecharts | src/charts/scatter-plot.js | showCrossHairComponentsWithLabels | function showCrossHairComponentsWithLabels(status = false) {
const opacityIndex = status ? 1 : 0;
highlightCrossHairContainer.attr('opacity', opacityIndex);
highlightCrossHairLabelsContainer.attr('opacity', opacityIndex);
} | javascript | function showCrossHairComponentsWithLabels(status = false) {
const opacityIndex = status ? 1 : 0;
highlightCrossHairContainer.attr('opacity', opacityIndex);
highlightCrossHairLabelsContainer.attr('opacity', opacityIndex);
} | [
"function",
"showCrossHairComponentsWithLabels",
"(",
"status",
"=",
"false",
")",
"{",
"const",
"opacityIndex",
"=",
"status",
"?",
"1",
":",
"0",
";",
"highlightCrossHairContainer",
".",
"attr",
"(",
"'opacity'",
",",
"opacityIndex",
")",
";",
"highlightCrossHai... | Sets the visibility of cross hair lines
if 1, it sets lines to visible,
if 0, it hides lines
@param {boolean}
@return {void}
@private | [
"Sets",
"the",
"visibility",
"of",
"cross",
"hair",
"lines",
"if",
"1",
"it",
"sets",
"lines",
"to",
"visible",
"if",
"0",
"it",
"hides",
"lines"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/scatter-plot.js#L899-L904 |
8,471 | eventbrite/britecharts | src/charts/helpers/export.js | exportChart | function exportChart(d3svg, filename, title) {
if (isIE) {
console.error(IE_ERROR_MSG);
return false;
}
let img = createImage(convertSvgToHtml.call(this, d3svg, title));
img.onload = handleImageLoad.bind(
img,
createCanvas(this.w... | javascript | function exportChart(d3svg, filename, title) {
if (isIE) {
console.error(IE_ERROR_MSG);
return false;
}
let img = createImage(convertSvgToHtml.call(this, d3svg, title));
img.onload = handleImageLoad.bind(
img,
createCanvas(this.w... | [
"function",
"exportChart",
"(",
"d3svg",
",",
"filename",
",",
"title",
")",
"{",
"if",
"(",
"isIE",
")",
"{",
"console",
".",
"error",
"(",
"IE_ERROR_MSG",
")",
";",
"return",
"false",
";",
"}",
"let",
"img",
"=",
"createImage",
"(",
"convertSvgToHtml",... | Main function to be used as a method by chart instances to export charts to png
@param {array} svgs (or an svg element) pass in both chart & legend as array or just chart as svg or in array
@param {string} filename [download to be called <filename>.png]
@param {string} title Title for the image | [
"Main",
"function",
"to",
"be",
"used",
"as",
"a",
"method",
"by",
"chart",
"instances",
"to",
"export",
"charts",
"to",
"png"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/helpers/export.js#L45-L59 |
8,472 | eventbrite/britecharts | src/charts/helpers/export.js | convertSvgToHtml | function convertSvgToHtml (d3svg, title) {
if (!d3svg) {
return;
}
d3svg.attr('version', 1.1)
.attr('xmlns', 'http://www.w3.org/2000/svg');
let serializer = serializeWithStyles.initializeSerializer();
let html = serializer(d3svg.node());
html = f... | javascript | function convertSvgToHtml (d3svg, title) {
if (!d3svg) {
return;
}
d3svg.attr('version', 1.1)
.attr('xmlns', 'http://www.w3.org/2000/svg');
let serializer = serializeWithStyles.initializeSerializer();
let html = serializer(d3svg.node());
html = f... | [
"function",
"convertSvgToHtml",
"(",
"d3svg",
",",
"title",
")",
"{",
"if",
"(",
"!",
"d3svg",
")",
"{",
"return",
";",
"}",
"d3svg",
".",
"attr",
"(",
"'version'",
",",
"1.1",
")",
".",
"attr",
"(",
"'xmlns'",
",",
"'http://www.w3.org/2000/svg'",
")",
... | Takes the D3 SVG element, adds proper SVG tags, adds inline styles
from stylesheets, adds white background and returns string
@param {SVGElement} d3svg TYPE d3 svg element
@return {String} String of passed d3 | [
"Takes",
"the",
"D3",
"SVG",
"element",
"adds",
"proper",
"SVG",
"tags",
"adds",
"inline",
"styles",
"from",
"stylesheets",
"adds",
"white",
"background",
"and",
"returns",
"string"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/helpers/export.js#L75-L90 |
8,473 | eventbrite/britecharts | src/charts/helpers/export.js | handleImageLoad | function handleImageLoad(canvas, filename, e) {
e.preventDefault();
downloadCanvas(drawImageOnCanvas(this, canvas), filename);
} | javascript | function handleImageLoad(canvas, filename, e) {
e.preventDefault();
downloadCanvas(drawImageOnCanvas(this, canvas), filename);
} | [
"function",
"handleImageLoad",
"(",
"canvas",
",",
"filename",
",",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"downloadCanvas",
"(",
"drawImageOnCanvas",
"(",
"this",
",",
"canvas",
")",
",",
"filename",
")",
";",
"}"
] | Handles on load event fired by img.onload, this=img
@param {object} canvas TYPE: el <canvas>
@param {string} filename
@param {object} e | [
"Handles",
"on",
"load",
"event",
"fired",
"by",
"img",
".",
"onload",
"this",
"=",
"img"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/helpers/export.js#L169-L173 |
8,474 | eventbrite/britecharts | src/charts/helpers/export.js | prependTitle | function prependTitle(html, title, svgWidth) {
if (!title || !svgWidth) {
return html;
}
let {grey} = colorSchemas;
html = html.replace(/<g/,`<text x="${this.margin().left}" y="${config.titleTopOffset}" font-family="${config.titleFontFamily}" font-size="${config.titleFontSi... | javascript | function prependTitle(html, title, svgWidth) {
if (!title || !svgWidth) {
return html;
}
let {grey} = colorSchemas;
html = html.replace(/<g/,`<text x="${this.margin().left}" y="${config.titleTopOffset}" font-family="${config.titleFontFamily}" font-size="${config.titleFontSi... | [
"function",
"prependTitle",
"(",
"html",
",",
"title",
",",
"svgWidth",
")",
"{",
"if",
"(",
"!",
"title",
"||",
"!",
"svgWidth",
")",
"{",
"return",
"html",
";",
"}",
"let",
"{",
"grey",
"}",
"=",
"colorSchemas",
";",
"html",
"=",
"html",
".",
"re... | if passed, append title to the raw html to appear on graph
@param {string} html raw html string
@param {string} title title of the graph
@param {number} svgWidth width of graph container
@return {string} raw html with title prepended | [
"if",
"passed",
"append",
"title",
"to",
"the",
"raw",
"html",
"to",
"appear",
"on",
"graph"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/helpers/export.js#L182-L191 |
8,475 | eventbrite/britecharts | src/charts/donut.js | buildContainerGroups | function buildContainerGroups() {
let container = svg
.append('g')
.classed('container-group', true);
container
.append('g')
.classed('chart-group', true);
container
.append('g')
.classed('lege... | javascript | function buildContainerGroups() {
let container = svg
.append('g')
.classed('container-group', true);
container
.append('g')
.classed('chart-group', true);
container
.append('g')
.classed('lege... | [
"function",
"buildContainerGroups",
"(",
")",
"{",
"let",
"container",
"=",
"svg",
".",
"append",
"(",
"'g'",
")",
".",
"classed",
"(",
"'container-group'",
",",
"true",
")",
";",
"container",
".",
"append",
"(",
"'g'",
")",
".",
"classed",
"(",
"'chart-... | Builds containers for the chart, the legend and a wrapper for all of them
@private | [
"Builds",
"containers",
"for",
"the",
"chart",
"the",
"legend",
"and",
"a",
"wrapper",
"for",
"all",
"of",
"them"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L183-L194 |
8,476 | eventbrite/britecharts | src/charts/donut.js | buildLayout | function buildLayout() {
layout = d3Shape.pie()
.padAngle(paddingAngle)
.value(getQuantity)
.sort(orderingFunction);
} | javascript | function buildLayout() {
layout = d3Shape.pie()
.padAngle(paddingAngle)
.value(getQuantity)
.sort(orderingFunction);
} | [
"function",
"buildLayout",
"(",
")",
"{",
"layout",
"=",
"d3Shape",
".",
"pie",
"(",
")",
".",
"padAngle",
"(",
"paddingAngle",
")",
".",
"value",
"(",
"getQuantity",
")",
".",
"sort",
"(",
"orderingFunction",
")",
";",
"}"
] | Builds the pie layout that will produce data ready to draw
@private | [
"Builds",
"the",
"pie",
"layout",
"that",
"will",
"produce",
"data",
"ready",
"to",
"draw"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L200-L205 |
8,477 | eventbrite/britecharts | src/charts/donut.js | cleanData | function cleanData(data) {
let dataWithPercentages;
let cleanData = data.reduce((acc, d) => {
// Skip data without quantity
if (d[quantityLabel] === undefined || d[quantityLabel] === null) {
return acc;
}
d.quan... | javascript | function cleanData(data) {
let dataWithPercentages;
let cleanData = data.reduce((acc, d) => {
// Skip data without quantity
if (d[quantityLabel] === undefined || d[quantityLabel] === null) {
return acc;
}
d.quan... | [
"function",
"cleanData",
"(",
"data",
")",
"{",
"let",
"dataWithPercentages",
";",
"let",
"cleanData",
"=",
"data",
".",
"reduce",
"(",
"(",
"acc",
",",
"d",
")",
"=>",
"{",
"// Skip data without quantity",
"if",
"(",
"d",
"[",
"quantityLabel",
"]",
"===",... | Cleaning data casting the quantities, names and percentages to the proper type while keeping
the rest of properties on the data. It also calculates the percentages if not present.
@param {DonutChartData} data Data as passed to the container
@return {DonutChartData} Clean data with percentages
@private | [
"Cleaning",
"data",
"casting",
"the",
"quantities",
"names",
"and",
"percentages",
"to",
"the",
"proper",
"type",
"while",
"keeping",
"the",
"rest",
"of",
"properties",
"on",
"the",
"data",
".",
"It",
"also",
"calculates",
"the",
"percentages",
"if",
"not",
... | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L250-L279 |
8,478 | eventbrite/britecharts | src/charts/donut.js | drawEmptySlice | function drawEmptySlice() {
if (slices) {
svg.selectAll('g.arc').remove();
}
slices = svg.select('.chart-group')
.selectAll('g.arc')
.data(layout(emptyDonutData));
let newSlices = slices.enter()
.append('g'... | javascript | function drawEmptySlice() {
if (slices) {
svg.selectAll('g.arc').remove();
}
slices = svg.select('.chart-group')
.selectAll('g.arc')
.data(layout(emptyDonutData));
let newSlices = slices.enter()
.append('g'... | [
"function",
"drawEmptySlice",
"(",
")",
"{",
"if",
"(",
"slices",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'g.arc'",
")",
".",
"remove",
"(",
")",
";",
"}",
"slices",
"=",
"svg",
".",
"select",
"(",
"'.chart-group'",
")",
".",
"selectAll",
"(",
"'g.a... | Draw an empty slice
@private | [
"Draw",
"an",
"empty",
"slice"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L293-L318 |
8,479 | eventbrite/britecharts | src/charts/donut.js | drawLegend | function drawLegend(obj) {
if (obj.data) {
svg.select('.donut-text')
.text(() => centeredTextFunction(obj.data))
.attr('dy', '.2em')
.attr('text-anchor', 'middle');
svg.select('.donut-text').call(wrapText, legendWi... | javascript | function drawLegend(obj) {
if (obj.data) {
svg.select('.donut-text')
.text(() => centeredTextFunction(obj.data))
.attr('dy', '.2em')
.attr('text-anchor', 'middle');
svg.select('.donut-text').call(wrapText, legendWi... | [
"function",
"drawLegend",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"data",
")",
"{",
"svg",
".",
"select",
"(",
"'.donut-text'",
")",
".",
"text",
"(",
"(",
")",
"=>",
"centeredTextFunction",
"(",
"obj",
".",
"data",
")",
")",
".",
"attr",
"(",... | Draws the values on the donut slice inside the text element
@param {Object} obj Data object
@private | [
"Draws",
"the",
"values",
"on",
"the",
"donut",
"slice",
"inside",
"the",
"text",
"element"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L326-L336 |
8,480 | eventbrite/britecharts | src/charts/donut.js | drawSlices | function drawSlices() {
// Not ideal, we need to figure out how to call exit for nested elements
if (slices) {
svg.selectAll('g.arc').remove();
}
slices = svg.select('.chart-group')
.selectAll('g.arc')
.data(layout(data));
... | javascript | function drawSlices() {
// Not ideal, we need to figure out how to call exit for nested elements
if (slices) {
svg.selectAll('g.arc').remove();
}
slices = svg.select('.chart-group')
.selectAll('g.arc')
.data(layout(data));
... | [
"function",
"drawSlices",
"(",
")",
"{",
"// Not ideal, we need to figure out how to call exit for nested elements",
"if",
"(",
"slices",
")",
"{",
"svg",
".",
"selectAll",
"(",
"'g.arc'",
")",
".",
"remove",
"(",
")",
";",
"}",
"slices",
"=",
"svg",
".",
"selec... | Draws the slices of the donut
@private | [
"Draws",
"the",
"slices",
"of",
"the",
"donut"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L342-L397 |
8,481 | eventbrite/britecharts | src/charts/donut.js | handleMouseOver | function handleMouseOver(el, d, chartWidth, chartHeight) {
drawLegend(d);
dispatcher.call('customMouseOver', el, d, d3Selection.mouse(el), [chartWidth, chartHeight]);
if (hasHoverAnimation) {
// if the hovered slice is not the same as the last slice hovered
... | javascript | function handleMouseOver(el, d, chartWidth, chartHeight) {
drawLegend(d);
dispatcher.call('customMouseOver', el, d, d3Selection.mouse(el), [chartWidth, chartHeight]);
if (hasHoverAnimation) {
// if the hovered slice is not the same as the last slice hovered
... | [
"function",
"handleMouseOver",
"(",
"el",
",",
"d",
",",
"chartWidth",
",",
"chartHeight",
")",
"{",
"drawLegend",
"(",
"d",
")",
";",
"dispatcher",
".",
"call",
"(",
"'customMouseOver'",
",",
"el",
",",
"d",
",",
"d3Selection",
".",
"mouse",
"(",
"el",
... | Handles a path mouse over
@return {void}
@private | [
"Handles",
"a",
"path",
"mouse",
"over"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L416-L432 |
8,482 | eventbrite/britecharts | src/charts/donut.js | handleMouseMove | function handleMouseMove(el, d, chartWidth, chartHeight) {
dispatcher.call('customMouseMove', el, d, d3Selection.mouse(el), [chartWidth, chartHeight]);
} | javascript | function handleMouseMove(el, d, chartWidth, chartHeight) {
dispatcher.call('customMouseMove', el, d, d3Selection.mouse(el), [chartWidth, chartHeight]);
} | [
"function",
"handleMouseMove",
"(",
"el",
",",
"d",
",",
"chartWidth",
",",
"chartHeight",
")",
"{",
"dispatcher",
".",
"call",
"(",
"'customMouseMove'",
",",
"el",
",",
"d",
",",
"d3Selection",
".",
"mouse",
"(",
"el",
")",
",",
"[",
"chartWidth",
",",
... | Handles a path mouse move
@return {void}
@private | [
"Handles",
"a",
"path",
"mouse",
"move"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L439-L441 |
8,483 | eventbrite/britecharts | src/charts/donut.js | handleMouseOut | function handleMouseOut(el, d, chartWidth, chartHeight) {
cleanLegend();
// When there is a fixed highlighted slice,
// we will always highlight it and render legend
if (highlightedSlice && hasFixedHighlightedSlice && !hasLastHoverSliceHighlighted) {
draw... | javascript | function handleMouseOut(el, d, chartWidth, chartHeight) {
cleanLegend();
// When there is a fixed highlighted slice,
// we will always highlight it and render legend
if (highlightedSlice && hasFixedHighlightedSlice && !hasLastHoverSliceHighlighted) {
draw... | [
"function",
"handleMouseOut",
"(",
"el",
",",
"d",
",",
"chartWidth",
",",
"chartHeight",
")",
"{",
"cleanLegend",
"(",
")",
";",
"// When there is a fixed highlighted slice,",
"// we will always highlight it and render legend",
"if",
"(",
"highlightedSlice",
"&&",
"hasFi... | Handles a path mouse out
@return {void}
@private | [
"Handles",
"a",
"path",
"mouse",
"out"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L448-L471 |
8,484 | eventbrite/britecharts | src/charts/donut.js | initHighlightSlice | function initHighlightSlice() {
highlightedSlice = svg.selectAll('.chart-group .arc path')
.select(filterHighlightedSlice).node();
if (highlightedSlice) {
drawLegend(highlightedSlice.__data__);
tweenGrowth(highlightedSlice, externalRadius, pieDraw... | javascript | function initHighlightSlice() {
highlightedSlice = svg.selectAll('.chart-group .arc path')
.select(filterHighlightedSlice).node();
if (highlightedSlice) {
drawLegend(highlightedSlice.__data__);
tweenGrowth(highlightedSlice, externalRadius, pieDraw... | [
"function",
"initHighlightSlice",
"(",
")",
"{",
"highlightedSlice",
"=",
"svg",
".",
"selectAll",
"(",
"'.chart-group .arc path'",
")",
".",
"select",
"(",
"filterHighlightedSlice",
")",
".",
"node",
"(",
")",
";",
"if",
"(",
"highlightedSlice",
")",
"{",
"dr... | Find the slice by id and growth it if needed
@private | [
"Find",
"the",
"slice",
"by",
"id",
"and",
"growth",
"it",
"if",
"needed"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L486-L494 |
8,485 | eventbrite/britecharts | src/charts/donut.js | tweenGrowth | function tweenGrowth(slice, outerRadius, delay = 0) {
d3Selection.select(slice)
.transition()
.delay(delay)
.attrTween('d', function(d) {
let i = d3Interpolate.interpolate(d.outerRadius, outerRadius);
return (t) => {
... | javascript | function tweenGrowth(slice, outerRadius, delay = 0) {
d3Selection.select(slice)
.transition()
.delay(delay)
.attrTween('d', function(d) {
let i = d3Interpolate.interpolate(d.outerRadius, outerRadius);
return (t) => {
... | [
"function",
"tweenGrowth",
"(",
"slice",
",",
"outerRadius",
",",
"delay",
"=",
"0",
")",
"{",
"d3Selection",
".",
"select",
"(",
"slice",
")",
".",
"transition",
"(",
")",
".",
"delay",
"(",
"delay",
")",
".",
"attrTween",
"(",
"'d'",
",",
"function",... | Animate slice with tweens depending on the attributes given
@param {DOMElement} slice Slice to growth
@param {Number} outerRadius Final outer radius value
@param {Number} delay Delay of animation
@private | [
"Animate",
"slice",
"with",
"tweens",
"depending",
"on",
"the",
"attributes",
"given"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L531-L544 |
8,486 | eventbrite/britecharts | src/charts/donut.js | wrapText | function wrapText(text, legendWidth) {
let fontSize = externalRadius / 5;
textHelper.wrapText.call(null, 0, fontSize, legendWidth, text.node());
} | javascript | function wrapText(text, legendWidth) {
let fontSize = externalRadius / 5;
textHelper.wrapText.call(null, 0, fontSize, legendWidth, text.node());
} | [
"function",
"wrapText",
"(",
"text",
",",
"legendWidth",
")",
"{",
"let",
"fontSize",
"=",
"externalRadius",
"/",
"5",
";",
"textHelper",
".",
"wrapText",
".",
"call",
"(",
"null",
",",
"0",
",",
"fontSize",
",",
"legendWidth",
",",
"text",
".",
"node",
... | Utility function that wraps a text into the given width
@param {D3Selection} text Text to write
@param {Number} legendWidth Width of the container
@private | [
"Utility",
"function",
"that",
"wraps",
"a",
"text",
"into",
"the",
"given",
"width"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/donut.js#L570-L574 |
8,487 | eventbrite/britecharts | src/charts/tooltip.js | getValueText | function getValueText(data) {
let value = data[valueLabel];
let valueText;
if (data.missingValue) {
valueText = '-';
} else {
valueText = getFormattedValue(value).toString();
}
return valueText;
} | javascript | function getValueText(data) {
let value = data[valueLabel];
let valueText;
if (data.missingValue) {
valueText = '-';
} else {
valueText = getFormattedValue(value).toString();
}
return valueText;
} | [
"function",
"getValueText",
"(",
"data",
")",
"{",
"let",
"value",
"=",
"data",
"[",
"valueLabel",
"]",
";",
"let",
"valueText",
";",
"if",
"(",
"data",
".",
"missingValue",
")",
"{",
"valueText",
"=",
"'-'",
";",
"}",
"else",
"{",
"valueText",
"=",
... | Extracts the value from the data object
@param {Object} data Data value containing the info
@return {String} Value to show | [
"Extracts",
"the",
"value",
"from",
"the",
"data",
"object"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L296-L307 |
8,488 | eventbrite/britecharts | src/charts/tooltip.js | updateTitle | function updateTitle(dataPoint) {
let tTitle = title;
let formattedDate = formatDate(new Date(dataPoint[dateLabel]));
if (tTitle.length) {
if (shouldShowDateInTitle) {
tTitle = `${tTitle} - ${formattedDate}`;
}
} else {... | javascript | function updateTitle(dataPoint) {
let tTitle = title;
let formattedDate = formatDate(new Date(dataPoint[dateLabel]));
if (tTitle.length) {
if (shouldShowDateInTitle) {
tTitle = `${tTitle} - ${formattedDate}`;
}
} else {... | [
"function",
"updateTitle",
"(",
"dataPoint",
")",
"{",
"let",
"tTitle",
"=",
"title",
";",
"let",
"formattedDate",
"=",
"formatDate",
"(",
"new",
"Date",
"(",
"dataPoint",
"[",
"dateLabel",
"]",
")",
")",
";",
"if",
"(",
"tTitle",
".",
"length",
")",
"... | Updates value of tooltipTitle with the data meaning and the date
@param {Object} dataPoint Point of data to use as source
@return void
@private | [
"Updates",
"value",
"of",
"tooltipTitle",
"with",
"the",
"data",
"meaning",
"and",
"the",
"date"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L409-L422 |
8,489 | eventbrite/britecharts | src/charts/tooltip.js | formatDate | function formatDate(date) {
let settings = dateFormat || defaultAxisSettings;
let format = null;
let localeOptions = {month:'short', day:'numeric'};
if (settings === axisTimeCombinations.DAY_MONTH || settings === axisTimeCombinations.MONTH_YEAR) {
format ... | javascript | function formatDate(date) {
let settings = dateFormat || defaultAxisSettings;
let format = null;
let localeOptions = {month:'short', day:'numeric'};
if (settings === axisTimeCombinations.DAY_MONTH || settings === axisTimeCombinations.MONTH_YEAR) {
format ... | [
"function",
"formatDate",
"(",
"date",
")",
"{",
"let",
"settings",
"=",
"dateFormat",
"||",
"defaultAxisSettings",
";",
"let",
"format",
"=",
"null",
";",
"let",
"localeOptions",
"=",
"{",
"month",
":",
"'short'",
",",
"day",
":",
"'numeric'",
"}",
";",
... | Figures out which date format to use when showing the date of the current data entry
@param {Date} date Date object to format
@return {Function} The proper date formatting function
@private | [
"Figures",
"out",
"which",
"date",
"format",
"to",
"use",
"when",
"showing",
"the",
"date",
"of",
"the",
"current",
"data",
"entry"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L430-L452 |
8,490 | eventbrite/britecharts | src/charts/tooltip.js | _sortByTopicsOrder | function _sortByTopicsOrder(topics, order=topicsOrder) {
return order.map((orderName) => topics.filter(({name}) => name === orderName)[0]);
} | javascript | function _sortByTopicsOrder(topics, order=topicsOrder) {
return order.map((orderName) => topics.filter(({name}) => name === orderName)[0]);
} | [
"function",
"_sortByTopicsOrder",
"(",
"topics",
",",
"order",
"=",
"topicsOrder",
")",
"{",
"return",
"order",
".",
"map",
"(",
"(",
"orderName",
")",
"=>",
"topics",
".",
"filter",
"(",
"(",
"{",
"name",
"}",
")",
"=>",
"name",
"===",
"orderName",
")... | Helper method to sort the passed topics array by the names passed int he order arary
@param {Object[]} topics Topics data, retrieved from datapoint passed by line chart
@param {Object[]} order Array of names in the order to sort topics by
@return {Object[]} sorted topics object
@private | [
"Helper",
"method",
"to",
"sort",
"the",
"passed",
"topics",
"array",
"by",
"the",
"names",
"passed",
"int",
"he",
"order",
"arary"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L461-L463 |
8,491 | eventbrite/britecharts | src/charts/tooltip.js | _sortByAlpha | function _sortByAlpha(topics) {
return topics
.map(d => d)
.sort((a, b) => {
if (a.name > b.name) return 1;
if (a.name === b.name) return 0;
return -1;
});
let otherIndex = topics.map(({... | javascript | function _sortByAlpha(topics) {
return topics
.map(d => d)
.sort((a, b) => {
if (a.name > b.name) return 1;
if (a.name === b.name) return 0;
return -1;
});
let otherIndex = topics.map(({... | [
"function",
"_sortByAlpha",
"(",
"topics",
")",
"{",
"return",
"topics",
".",
"map",
"(",
"d",
"=>",
"d",
")",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"if",
"(",
"a",
".",
"name",
">",
"b",
".",
"name",
")",
"return",
"1",
";",
... | Sorts topic by alphabetical order for arrays of objects with a name proeprty
@param {Array} topics List of topic objects
@return {Array} List of topic name strings
@private | [
"Sorts",
"topic",
"by",
"alphabetical",
"order",
"for",
"arrays",
"of",
"objects",
"with",
"a",
"name",
"proeprty"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L471-L488 |
8,492 | eventbrite/britecharts | src/charts/tooltip.js | updateContent | function updateContent(dataPoint){
var topics = dataPoint[topicLabel];
// sort order by topicsOrder array if passed
if (topicsOrder.length) {
topics = _sortByTopicsOrder(topics);
} else if (topics.length && topics[0].name) {
topics = _sort... | javascript | function updateContent(dataPoint){
var topics = dataPoint[topicLabel];
// sort order by topicsOrder array if passed
if (topicsOrder.length) {
topics = _sortByTopicsOrder(topics);
} else if (topics.length && topics[0].name) {
topics = _sort... | [
"function",
"updateContent",
"(",
"dataPoint",
")",
"{",
"var",
"topics",
"=",
"dataPoint",
"[",
"topicLabel",
"]",
";",
"// sort order by topicsOrder array if passed",
"if",
"(",
"topicsOrder",
".",
"length",
")",
"{",
"topics",
"=",
"_sortByTopicsOrder",
"(",
"t... | Draws the data entries inside the tooltip
@param {Object} dataPoint Data entry from to take the info
@return void
@private | [
"Draws",
"the",
"data",
"entries",
"inside",
"the",
"tooltip"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L557-L571 |
8,493 | eventbrite/britecharts | src/charts/tooltip.js | updateTooltip | function updateTooltip(dataPoint, xPosition, yPosition) {
updateContent(dataPoint);
updatePositionAndSize(dataPoint, xPosition, yPosition);
} | javascript | function updateTooltip(dataPoint, xPosition, yPosition) {
updateContent(dataPoint);
updatePositionAndSize(dataPoint, xPosition, yPosition);
} | [
"function",
"updateTooltip",
"(",
"dataPoint",
",",
"xPosition",
",",
"yPosition",
")",
"{",
"updateContent",
"(",
"dataPoint",
")",
";",
"updatePositionAndSize",
"(",
"dataPoint",
",",
"xPosition",
",",
"yPosition",
")",
";",
"}"
] | Updates tooltip title, content, size and position
sorts by alphatical name order if not forced order given
@param {lineChartPointByDate} dataPoint Current datapoint to show info about
@param {Number} xPosition Position of the mouse on the X axis
@return void
@private | [
"Updates",
"tooltip",
"title",
"content",
"size",
"and",
"position",
"sorts",
"by",
"alphatical",
"name",
"order",
"if",
"not",
"forced",
"order",
"given"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/tooltip.js#L582-L585 |
8,494 | eventbrite/britecharts | src/charts/helpers/text.js | function(text, fontSize = defaultTextSize, fontFace = defaultFontFace) {
let a = document.createElement('canvas'),
b = a.getContext('2d');
b.font = fontSize + 'px ' + fontFace;
return b.measureText(text).width;
} | javascript | function(text, fontSize = defaultTextSize, fontFace = defaultFontFace) {
let a = document.createElement('canvas'),
b = a.getContext('2d');
b.font = fontSize + 'px ' + fontFace;
return b.measureText(text).width;
} | [
"function",
"(",
"text",
",",
"fontSize",
"=",
"defaultTextSize",
",",
"fontFace",
"=",
"defaultFontFace",
")",
"{",
"let",
"a",
"=",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
",",
"b",
"=",
"a",
".",
"getContext",
"(",
"'2d'",
")",
";",
... | Figures out an approximate of the text width by using a canvas element
This avoids having to actually render the text to measure it from the DOM itself
@param {String} text Text to measure
@param {Number} [fontSize=12] Font size (or default)
@param {String} [fontFace='Arial'] Font family to use... | [
"Figures",
"out",
"an",
"approximate",
"of",
"the",
"text",
"width",
"by",
"using",
"a",
"canvas",
"element",
"This",
"avoids",
"having",
"to",
"actually",
"render",
"the",
"text",
"to",
"measure",
"it",
"from",
"the",
"DOM",
"itself"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/helpers/text.js#L144-L151 | |
8,495 | eventbrite/britecharts | src/charts/heatmap.js | buildScales | function buildScales() {
colorScale = d3Scale.scaleLinear()
.range([colorSchema[0], colorSchema[colorSchema.length - 1]])
.domain(d3Array.extent(data, getValue))
.interpolate(d3Interpolate.interpolateHcl);
} | javascript | function buildScales() {
colorScale = d3Scale.scaleLinear()
.range([colorSchema[0], colorSchema[colorSchema.length - 1]])
.domain(d3Array.extent(data, getValue))
.interpolate(d3Interpolate.interpolateHcl);
} | [
"function",
"buildScales",
"(",
")",
"{",
"colorScale",
"=",
"d3Scale",
".",
"scaleLinear",
"(",
")",
".",
"range",
"(",
"[",
"colorSchema",
"[",
"0",
"]",
",",
"colorSchema",
"[",
"colorSchema",
".",
"length",
"-",
"1",
"]",
"]",
")",
".",
"domain",
... | Creates the scales for the heatmap chart
@return void | [
"Creates",
"the",
"scales",
"for",
"the",
"heatmap",
"chart"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/heatmap.js#L183-L188 |
8,496 | eventbrite/britecharts | src/charts/heatmap.js | drawBoxes | function drawBoxes() {
boxes = svg.select('.chart-group').selectAll('.box').data(data);
boxes.enter()
.append('rect')
.classed('box', true)
.attr('width', boxSize)
.attr('height', boxSize)
.attr('x', ({hour}) => hour ... | javascript | function drawBoxes() {
boxes = svg.select('.chart-group').selectAll('.box').data(data);
boxes.enter()
.append('rect')
.classed('box', true)
.attr('width', boxSize)
.attr('height', boxSize)
.attr('x', ({hour}) => hour ... | [
"function",
"drawBoxes",
"(",
")",
"{",
"boxes",
"=",
"svg",
".",
"select",
"(",
"'.chart-group'",
")",
".",
"selectAll",
"(",
"'.box'",
")",
".",
"data",
"(",
"data",
")",
";",
"boxes",
".",
"enter",
"(",
")",
".",
"append",
"(",
"'rect'",
")",
".... | Draws the boxes of the heatmap | [
"Draws",
"the",
"boxes",
"of",
"the",
"heatmap"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/heatmap.js#L193-L213 |
8,497 | eventbrite/britecharts | src/charts/heatmap.js | drawDayLabels | function drawDayLabels() {
let dayLabelsGroup = svg.select('.day-labels-group');
dayLabels = svg.select('.day-labels-group').selectAll('.day-label')
.data(daysHuman);
dayLabels.enter()
.append('text')
.text((label) => label)
... | javascript | function drawDayLabels() {
let dayLabelsGroup = svg.select('.day-labels-group');
dayLabels = svg.select('.day-labels-group').selectAll('.day-label')
.data(daysHuman);
dayLabels.enter()
.append('text')
.text((label) => label)
... | [
"function",
"drawDayLabels",
"(",
")",
"{",
"let",
"dayLabelsGroup",
"=",
"svg",
".",
"select",
"(",
"'.day-labels-group'",
")",
";",
"dayLabels",
"=",
"svg",
".",
"select",
"(",
"'.day-labels-group'",
")",
".",
"selectAll",
"(",
"'.day-label'",
")",
".",
"d... | Draws the day labels | [
"Draws",
"the",
"day",
"labels"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/heatmap.js#L218-L234 |
8,498 | eventbrite/britecharts | src/charts/heatmap.js | drawHourLabels | function drawHourLabels() {
let hourLabelsGroup = svg.select('.hour-labels-group');
hourLabels = svg.select('.hour-labels-group').selectAll('.hour-label')
.data(hoursHuman);
hourLabels.enter()
.append('text')
.text((label) => label)
... | javascript | function drawHourLabels() {
let hourLabelsGroup = svg.select('.hour-labels-group');
hourLabels = svg.select('.hour-labels-group').selectAll('.hour-label')
.data(hoursHuman);
hourLabels.enter()
.append('text')
.text((label) => label)
... | [
"function",
"drawHourLabels",
"(",
")",
"{",
"let",
"hourLabelsGroup",
"=",
"svg",
".",
"select",
"(",
"'.hour-labels-group'",
")",
";",
"hourLabels",
"=",
"svg",
".",
"select",
"(",
"'.hour-labels-group'",
")",
".",
"selectAll",
"(",
"'.hour-label'",
")",
"."... | Draws the hour labels | [
"Draws",
"the",
"hour",
"labels"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/heatmap.js#L239-L255 |
8,499 | eventbrite/britecharts | src/charts/stacked-area.js | addGlowFilter | function addGlowFilter(el) {
if (!highlightFilter) {
highlightFilter = createFilterContainer(svg.select('.metadata-group'));
highlightFilterId = createGlowWithMatrix(highlightFilter);
}
let glowEl = d3Selection.select(el);
glowEl
... | javascript | function addGlowFilter(el) {
if (!highlightFilter) {
highlightFilter = createFilterContainer(svg.select('.metadata-group'));
highlightFilterId = createGlowWithMatrix(highlightFilter);
}
let glowEl = d3Selection.select(el);
glowEl
... | [
"function",
"addGlowFilter",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"highlightFilter",
")",
"{",
"highlightFilter",
"=",
"createFilterContainer",
"(",
"svg",
".",
"select",
"(",
"'.metadata-group'",
")",
")",
";",
"highlightFilterId",
"=",
"createGlowWithMatrix",
... | Adds a filter to the element
@param {DOMElement} el
@private | [
"Adds",
"a",
"filter",
"to",
"the",
"element"
] | 0767051287e9e7211e610b1b13244da71e8e355e | https://github.com/eventbrite/britecharts/blob/0767051287e9e7211e610b1b13244da71e8e355e/src/charts/stacked-area.js#L241-L259 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.