Skip to content

Commit

Permalink
Fixed an issue where the legend count and objects would erase or be i…
Browse files Browse the repository at this point in the history
…ncorrect after removing an overlay
  • Loading branch information
itsMando committed Sep 10, 2024
1 parent 97d9bbe commit e464a07
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 46 deletions.
Binary file added GLIMPSE Event API.pdf
Binary file not shown.
17 changes: 14 additions & 3 deletions glimpse/local-server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def get_avg_betweenness_centrality():
socketio = SocketIO(app)
# socketio = SocketIO(app, cors_allowed_origins="*", async_mode="gevent")

#------------------------------ Server ------------------------------#

#------------------------------ Server Routes ------------------------------#

@app.route("/")
def hello():
return {"api": "GLIMPSE flask backend"}
Expand Down Expand Up @@ -94,7 +97,10 @@ def get_stats():

return summary_stats

#------------------ Socket Events ------------------#
#------------------------------ Server Routes ------------------------------#

#------------------------------ Socket Events ------------------------------#

@socketio.on("glimpse")
def glimpse(data):
socketio.emit("update-data", data)
Expand All @@ -115,6 +121,11 @@ def delete_node(nodeID):
def delete_edge(edgeID):
socketio.emit("delete-edge", edgeID)

#------------------------------ Start WebSocket Server ------------------------------#
#------------------------------ Socket Events ------------------------------#

#-------------------------- Start WebSocket Server --------------------------#

if __name__ == "__main__":
socketio.run(app, debug=True, log_output=True)
socketio.run(app, debug=True, log_output=True)

#-------------------------- Start WebSocket Server --------------------------#
39 changes: 19 additions & 20 deletions glimpse/renderer/src/components/Graph.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
import React, { useEffect, useRef } from "react";
import { Box, Stack } from "@mui/material";
import { Network } from "vis-network";
import axios from "axios";
import React, { useEffect, useRef } from "react";
import { DataSet } from "vis-data";
import ActionDrawer from "./ActionDrawer";
import NodePopup from "./NodePopup";
import "../styles/vis-network.css";
import { Network } from "vis-network";
import "../styles/Graph.css";
import Legend from "./Legend";
import ContextMenu from "./ContextMenu";
import NewNodeForm from "./NewNodeForm";
import VisActionsDial from "./VisActionsDial";
import axios from "axios";
const { graphOptions } = JSON.parse(await window.glimpseAPI.getConfig());
import "../styles/vis-network.css";
import {
getTitle,
setGraphData,
Export,
getLegendData,
NodeFocus,
getTitle,
hideEdge,
hideEdges,
updateNode,
showAttributes,
hideObjects,
HighlightEdges,
HighlightGroup,
Next,
NodeFocus,
Prev,
rotateCW,
rotateCCW,
getRandomColor,
rotateCW,
setGraphData,
showAttributes,
updateNode,
} from "../utils/graphUtils";
import ActionDrawer from "./ActionDrawer";
import ContextMenu from "./ContextMenu";
import Legend from "./Legend";
import NewNodeForm from "./NewNodeForm";
import NodePopup from "./NodePopup";
import VisActionsDial from "./VisActionsDial";
const { graphOptions } = JSON.parse(await window.glimpseAPI.getConfig());

const ANGLE = Math.PI / 12; // 15 degrees in radians

Expand Down Expand Up @@ -251,7 +250,7 @@ const Graph = ({ dataToVis, theme, isGlm }) => {
to: nodeID,
title: `objectType: parentChild\nname: ${microgrid.name}-${nodeID}\nfrom: ${microgrid.name}\nto: ${nodeID}`,
color: { inherit: true },
type: type,
type: "parentChild",
width: 0.15,
})[0]
);
Expand Down Expand Up @@ -284,7 +283,7 @@ const Graph = ({ dataToVis, theme, isGlm }) => {
from: comm_node.name,
to: nodeID,
title: `objectType: parentChild\nname: ${comm_node.name}-${nodeID}\nfrom: ${comm_node.name}\nto: ${nodeID}`,
type: type,
type: "parentChild",
color: { inherit: true },
width: 0.15,
})[0]
Expand Down
47 changes: 24 additions & 23 deletions glimpse/renderer/src/styles/vis-network.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e464a07

Please sign in to comment.