Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
js1300 committed Jul 31, 2024
1 parent 9ec5177 commit c13093e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/engine.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Linegraph from './linegraph.js';
import Piegraph from './piegraph.js';
import Bargraph from './bargraph.js';
import Bargraph from "./bargraph.js";
import Linegraph from "./linegraph.js";
import Piegraph from "./piegraph.js";

export default class Engine {
constructor() {
this.graphDictionary = new Object();
this.graphDictionary = {};

window.addEventListener('resize', this.rerender.bind(this));
window.addEventListener("resize", this.rerender.bind(this));
}

addLinegraph(element, properties, data, axisFormatter, informationFormatter) {
Expand All @@ -17,7 +17,7 @@ export default class Engine {
data = JSON.parse(data);
}

var linegraph = new Linegraph(element, properties, data, axisFormatter, informationFormatter);
const linegraph = new Linegraph(element, properties, data, axisFormatter, informationFormatter);

this.graphDictionary[element.id] = linegraph;

Expand All @@ -32,7 +32,7 @@ export default class Engine {
data = JSON.parse(data);
}

var piegraph = new Piegraph(element, properties, data);
const piegraph = new Piegraph(element, properties, data);

this.graphDictionary[element.id] = piegraph;

Expand All @@ -47,25 +47,25 @@ export default class Engine {
data = JSON.parse(data);
}

var bargraph = new Bargraph(element, properties, data, axisFormatter, informationFormatter);
const bargraph = new Bargraph(element, properties, data, axisFormatter, informationFormatter);

this.graphDictionary[element.id] = bargraph;

return bargraph;
}

render() {
for (var elementId in this.graphDictionary) {
var graph = this.graphDictionary[elementId];
for (const elementId in this.graphDictionary) {
const graph = this.graphDictionary[elementId];
if (!graph.drawn) {
graph.draw();
}
}
}

rerender() {
for (var elementId in this.graphDictionary) {
var graph = this.graphDictionary[elementId];
for (const elementId in this.graphDictionary) {
const graph = this.graphDictionary[elementId];
graph.createLayers();
graph.addMouseEvents();
if (graph.drawn) {
Expand All @@ -79,8 +79,8 @@ export default class Engine {
}

removeGraph(element) {
var graph = this.getGraph(element);
const graph = this.getGraph(element);
graph.removeLayers();
delete this.graphDictionary[element.id];
Reflect.deleteProperty(this.graphDictionary, element.id);
}
}

0 comments on commit c13093e

Please sign in to comment.