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 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) {
var fillHeight = iconHeight * 0.5;
var path, fillPath;
var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
outline.setAttributeNS(null, "x", x);
outline.setAttributeNS(null, "y", y - fillHeight);
@ -108,7 +106,6 @@ Bargraph.draw = function (groupIds, processedGroupData, framework) {
}
else {
var nextKey = i + (intersections[key].amount - intersections[key].resolved);
var prevKey = i - (intersections[key].resolved + 1);
if (nextKey < combinedData.length) {
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');
function Line(groupId, options) {
function Line(groupId, options) { // eslint-disable-line no-unused-vars
}
Line.calcPath = function (dataset, group) {
@ -137,18 +137,19 @@ Line.serializePath = function(pathArray,type,inverse){
return "";
}
var d = type;
var i;
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] + " ";
}
}
else {
for (var i = 1; i < pathArray.length; i++){
for (i = 1; i < pathArray.length; i++){
d += pathArray[i][0] + "," + pathArray[i][1] + " ";
}
}
return d;
}
};
/**
* 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');
function Points(groupId, options) {
function Points(groupId, options) { // eslint-disable-line no-unused-vars
}
/**
* draw the data points
*
* @param {Array} dataset
* @param {Object} JSONcontainer
* @param {Object} svg | SVG DOM element
* @param {GraphGroup} group
* @param {Object} framework | SVG DOM element
* @param {Number} [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) {
var fillHeight = iconHeight * 0.5;
var path, fillPath;
var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
outline.setAttributeNS(null, "x", x);

Loading…
Cancel
Save