File Graph3d.js
has 1358 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Emitter = require('emitter-component');
var util = require('../util');
var Point3d = require('./Point3d');
var Point2d = require('./Point2d');
var Slider = require('./Slider');
Function _getDataPoints
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._getDataPoints = function (data) {
// TODO: store the created matrix dataPoints in the filters instead of
// reloading each time.
var x, y, i, obj;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawAxis
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._redrawAxis = function() {
var ctx = this._getContext(),
from, to, step, prettyStep,
text, xText, yText, zText,
offset, xOffset, yOffset;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawAxis
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._redrawAxis = function() {
var ctx = this._getContext(),
from, to, step, prettyStep,
text, xText, yText, zText,
offset, xOffset, yOffset;
Function _dataPointFromXY
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._dataPointFromXY = function (x, y) {
var i,
distMax = 100, // px
dataPoint = null,
closestDataPoint = null,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawLegend
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._redrawLegend = function() {
//Return without drawing anything, if no legend is specified
if (this.showLegend !== true) {
return;
Function _showTooltip
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._showTooltip = function (dataPoint) {
var content, line, dot;
if (!this.tooltip) {
content = document.createElement('div');
Function _redrawBar
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._redrawBar = function(ctx, point, xWidth, yWidth, color, borderColor) {
var surface;
// calculate all corner points
var me = this;
Function _onTooltip
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._onTooltip = function (event) {
var delay = 300; // ms
var boundingRect = this.frame.getBoundingClientRect();
var mouseX = getMouseX(event) - boundingRect.left;
var mouseY = getMouseY(event) - boundingRect.top;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _getDataPoints
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._getDataPoints = function (data) {
// TODO: store the created matrix dataPoints in the filters instead of
// reloading each time.
var x, y, i, obj;
Function _dataPointFromXY
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._dataPointFromXY = function (x, y) {
var i,
distMax = 100, // px
dataPoint = null,
closestDataPoint = null,
Function _onMouseMove
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._onMouseMove = function (event) {
this.moving = true;
event = event || window.event;
// calculate change in mouse position
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawSurfaceGraphPoint
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._redrawSurfaceGraphPoint = function(ctx, point) {
var right = point.pointRight;
var top = point.pointTop;
var cross = point.pointCross;
Function setPointDrawingMethod
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype.setPointDrawingMethod = function() {
var method = undefined;
switch (this.style) {
case Graph3d.STYLE.BAR:
Function _redrawLegend
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._redrawLegend = function() {
//Return without drawing anything, if no legend is specified
if (this.showLegend !== true) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype.create = function () {
// remove all elements from the container element.
while (this.containerElement.hasChildNodes()) {
this.containerElement.removeChild(this.containerElement.firstChild);
}
Function _onTooltip
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._onTooltip = function (event) {
var delay = 300; // ms
var boundingRect = this.frame.getBoundingClientRect();
var mouseX = getMouseX(event) - boundingRect.left;
var mouseY = getMouseY(event) - boundingRect.top;
Function _onMouseMove
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph3d.prototype._onMouseMove = function (event) {
this.moving = true;
event = event || window.event;
// calculate change in mouse position
Function _hideTooltip
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._hideTooltip = function () {
if (this.tooltip) {
this.tooltip.dataPoint = null;
for (var prop in this.tooltip.dom) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _insideTriangle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._insideTriangle = function (point, triangle) {
var a = triangle[0],
b = triangle[1],
c = triangle[2];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawSurfaceGraphPoint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Graph3d.prototype._redrawSurfaceGraphPoint = function(ctx, point) {
var right = point.pointRight;
var top = point.pointTop;
var cross = point.pointCross;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _redrawBar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Graph3d.prototype._redrawBar = function(ctx, point, xWidth, yWidth, color, borderColor) {
Avoid deeply nested control flow statements. Open
if (this._insideTriangle(center, triangle1) ||
this._insideTriangle(center, triangle2)) {
// return immediately at the first hit
return dataPoint;
}
Function drawAxisLabelY
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Graph3d.prototype.drawAxisLabelY = function(ctx, point3d, text, armAngle, yMargin) {
Function drawAxisLabelX
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Graph3d.prototype.drawAxisLabelX = function(ctx, point3d, text, armAngle, yMargin) {
Function _drawCircle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Graph3d.prototype._drawCircle = function(ctx, point, color, borderColor, size) {
TODO found Open
// TODO: implement Array().indexOf() for Internet Explorer
- Exclude checks
TODO found Open
// TODO: can this be automated? verticalRatio?
- Exclude checks
TODO found Open
strokeStyle = this.axisColor; // TODO: should be customizable
- Exclude checks
TODO found Open
return; // TODO: throw exception?
- Exclude checks
TODO found Open
ctx.font = '14px arial'; // TODO: put in options
- Exclude checks
TODO found Open
// TODO: get the actual rendered style of the containerElement
- Exclude checks
TODO found Open
// TODO: this dept calculation doesn't work 100% of the cases due to perspective,
- Exclude checks
TODO found Open
v = Math.min(1 + (crossproduct.x / len) / 2, 1); // value. TODO: scale
- Exclude checks
TODO found Open
// TODO: customize axis range
- Exclude checks
TODO found Open
ctx.stroke(); // TODO: only draw stroke when strokeWidth > 0
- Exclude checks
FIXME found Open
// FIXME: there is a bug with determining the surface side (shadow or colored)
- Exclude checks
TODO found Open
offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis?
- Exclude checks
TODO found Open
|| this.style === Graph3d.STYLE.BARSIZE //TODO add legend support for BARSIZE
- Exclude checks
TODO found Open
// TODO: only draw stroke when strokeWidth > 0
- Exclude checks
TODO found Open
// TODO: store the created matrix dataPoints in the filters instead of
- Exclude checks
TODO found Open
// TODO: later on, all min/maxes of all datagroups will be combined here
- Exclude checks
TODO found Open
// TODO: make z-grid lines really 3d?
- Exclude checks
TODO found Open
// TODO: these events are never cleaned up... can give a 'memory leakage'
- Exclude checks
TODO found Open
ctx.font = '14px arial'; // TODO: put in options
- Exclude checks
TODO found Open
// TODO: css here is not nice here...
- Exclude checks