Browse Source

lint graph2d (#3307)

revert-3409-performance
macleodbroad-wf 7 years ago
committed by Yotam Berkowitz
parent
commit
e5d0b59963
3 changed files with 8 additions and 12 deletions
  1. +1
    -4
      lib/timeline/component/graph2d_types/bar.js
  2. +5
    -4
      lib/timeline/component/graph2d_types/line.js
  3. +2
    -4
      lib/timeline/component/graph2d_types/points.js

+ 1
- 4
lib/timeline/component/graph2d_types/bar.js View File

@ -1,13 +1,11 @@
var DOMutil = require('../../../DOMutil'); var DOMutil = require('../../../DOMutil');
var Points = require('./points'); var Points = require('./points');
function Bargraph(groupId, options) {
function Bargraph(groupId, options) { // eslint-disable-line no-unused-vars
} }
Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) {
var fillHeight = iconHeight * 0.5; var fillHeight = iconHeight * 0.5;
var path, fillPath;
var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
outline.setAttributeNS(null, "x", x); outline.setAttributeNS(null, "x", x);
outline.setAttributeNS(null, "y", y - fillHeight); outline.setAttributeNS(null, "y", y - fillHeight);
@ -108,7 +106,6 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
} }
else { else {
var nextKey = i + (intersections[key].amount - intersections[key].resolved); var nextKey = i + (intersections[key].amount - intersections[key].resolved);
var prevKey = i - (intersections[key].resolved + 1);
if (nextKey < combinedData.length) { if (nextKey < combinedData.length) {
coreDistance = Math.abs(combinedData[nextKey].screen_x - key); coreDistance = Math.abs(combinedData[nextKey].screen_x - key);
} }

+ 5
- 4
lib/timeline/component/graph2d_types/line.js View File

@ -1,6 +1,6 @@
var DOMutil = require('../../../DOMutil'); var DOMutil = require('../../../DOMutil');
function Line(groupId, options) {
function Line(groupId, options) { // eslint-disable-line no-unused-vars
} }
Line.calcPath = function (dataset, group) { Line.calcPath = function (dataset, group) {
@ -137,18 +137,19 @@ Line.serializePath = function(pathArray,type,inverse){
return ""; return "";
} }
var d = type; var d = type;
var i;
if (inverse){ if (inverse){
for (var i = pathArray.length-2; i > 0; i--){
for (i = pathArray.length-2; i > 0; i--){
d += pathArray[i][0] + "," + pathArray[i][1] + " "; d += pathArray[i][0] + "," + pathArray[i][1] + " ";
} }
} }
else { else {
for (var i = 1; i < pathArray.length; i++){
for (i = 1; i < pathArray.length; i++){
d += pathArray[i][0] + "," + pathArray[i][1] + " "; d += pathArray[i][0] + "," + pathArray[i][1] + " ";
} }
} }
return d; return d;
}
};
/** /**
* This uses an uniform parametrization of the interpolation algorithm: * This uses an uniform parametrization of the interpolation algorithm:

+ 2
- 4
lib/timeline/component/graph2d_types/points.js View File

@ -1,15 +1,14 @@
var DOMutil = require('../../../DOMutil'); var DOMutil = require('../../../DOMutil');
function Points(groupId, options) {
function Points(groupId, options) { // eslint-disable-line no-unused-vars
} }
/** /**
* draw the data points * draw the data points
* *
* @param {Array} dataset * @param {Array} dataset
* @param {Object} JSONcontainer
* @param {Object} svg | SVG DOM element
* @param {GraphGroup} group * @param {GraphGroup} group
* @param {Object} framework | SVG DOM element
* @param {Number} [offset] * @param {Number} [offset]
*/ */
Points.draw = function (dataset, group, framework, offset) { Points.draw = function (dataset, group, framework, offset) {
@ -32,7 +31,6 @@ Points.draw = function (dataset, group, framework, offset) {
Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) {
var fillHeight = iconHeight * 0.5; var fillHeight = iconHeight * 0.5;
var path, fillPath;
var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
outline.setAttributeNS(null, "x", x); outline.setAttributeNS(null, "x", x);

Loading…
Cancel
Save