MCPcopy Index your code
hub / github.com/plotly/plotly.js / getAvgPixelByChannel

Function getAvgPixelByChannel

test/jasmine/tests/parcoords_test.js:61–76  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

59}
60
61function getAvgPixelByChannel(id) {
62 var canvas = d3Select(id).node();
63
64 var imgData = readPixel(canvas, 0, 0, canvas.width, canvas.height);
65 var n = imgData.length * 0.25;
66 var r = 0;
67 var g = 0;
68 var b = 0;
69
70 for(var i = 0; i < imgData.length; i++) {
71 r += imgData[i++];
72 g += imgData[i++];
73 b += imgData[i++];
74 }
75 return [r / n, g / n, b / n];
76}
77
78describe('parcoords initialization tests', function() {
79 'use strict';

Callers 1

parcoords_test.jsFile · 0.85

Calls 1

readPixelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…