Skip to content

Commit

Permalink
js: Update D3 from 4.13.0 to 7.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rht authored and tpike3 committed Apr 27, 2022
1 parent 49d1854 commit 63bca3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mesa/visualization/ModularVisualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
if platform.system() == "Windows" and platform.python_version_tuple() >= ("3", "7"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

D3_JS_FILE = "external/d3-4.13.0.min.js"
D3_JS_FILE = "external/d3-7.4.3.min.js"
CHART_JS_FILE = "external/chart-3.6.1.min.js"


Expand Down
8 changes: 4 additions & 4 deletions mesa/visualization/templates/js/NetworkModule_d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const NetworkModule = function (svg_width, svg_height) {
this.render = function (data) {
const graph = JSON.parse(JSON.stringify(data));

simulation = d3
const simulation = d3
.forceSimulation()
.nodes(graph.nodes)
.force("charge", d3.forceManyBody().strength(-80).distanceMin(2))
Expand Down Expand Up @@ -89,12 +89,12 @@ const NetworkModule = function (svg_width, svg_height) {
.data(graph.nodes)
.enter()
.append("circle")
.on("mouseover", function (d) {
.on("mouseover", function (event, d) {
tooltip.transition().duration(200).style("opacity", 0.9);
tooltip
.html(d.tooltip)
.style("left", d3.event.pageX + "px")
.style("top", d3.event.pageY + "px");
.style("left", event.pageX + "px")
.style("top", event.pageY + "px");
})
.on("mouseout", function () {
tooltip.transition().duration(500).style("opacity", 0);
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def ensure_JS_dep_single(url, out_name=None):
)
# Important: when updating the D3 version, make sure to update the constant
# D3_JS_FILE in mesa/visualization/ModularVisualization.py.
d3_version = "4.13.0"
d3_version = "7.4.3"
ensure_JS_dep_single(
f"https://cdnjs.cloudflare.com/ajax/libs/d3/{d3_version}/d3.min.js",
out_name=f"d3-{d3_version}.min.js",
Expand Down

0 comments on commit 63bca3e

Please sign in to comment.