Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
minor visual changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RowanTrickett committed Sep 5, 2023
1 parent 22e7958 commit 4bdf28a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion d3_networkVisualisation/graphSettingOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ export function setupData(edgeData, titles, minWeight, width, height) {
(obj) => obj.weight >= minWeight
);

const numUniqueValues = Object.keys(titles).length;
// Randomly initialise node positions with normal distribution
// nodeData needs entries in the form { id: 0, x: 10, y: 10 }
const nodeData = Array.from({ length: 1923 }, (_, i) => ({
const nodeData = Array.from({ length: numUniqueValues }, (_, i) => ({
id: i, // id used to refer to each node
title: titles[i],
x: Math.min(Math.max(randomNormal(0.5, 0.15)(), 0), 1) * (width - 16) + 8,
Expand Down
6 changes: 3 additions & 3 deletions d3_networkVisualisation/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ForceGraph } from "./network.js";
import edgeData_cols from "../nbs/data/identicalColumns_scoredByRarity_mt5.json" assert { type: "json" };
import edgeData_cols_Alt from "../nbs/data/identicalColumns_scoredByRarity_alt.json" assert { type: "json" };
import edgeData_embeddings from "../nbs/data/descriptionEmbeddings_t5pct.json" assert { type: "json" };
import dataTitlesId from "../nbs/data/datasets_titles_ids.json" assert { type: "json" };
import dataTitlesId from "../nbs/data/datasets_title_id.json" assert { type: "json" };
import {
getSecondDegreeData,
toggleEdges,
Expand All @@ -16,7 +16,7 @@ import {

// Initialising variables
const width = window.innerWidth * 0.9;
const height = window.innerHeight * 0.85;
const height = window.innerHeight;
var minWeight = 10;
var selectedNode = null;
var edgeData = edgeData_cols_Alt;
Expand Down Expand Up @@ -71,7 +71,7 @@ dd.onchange = () => {

// Resetting the graph with the new data and updating the slider to match the range of the connection weights
resetGraph();
slider.setAttribute("min", "2");
slider.setAttribute("min", "0");
slider.setAttribute("step", "0.2");
}
};
Expand Down
1 change: 1 addition & 0 deletions d3_networkVisualisation/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ html {

body {
background-color: #181818;
overflow: hidden;
}

.hide-links {
Expand Down

0 comments on commit 4bdf28a

Please sign in to comment.