From ab49b32e3bdbd974c1e2d93cec1c076f45bfbbd3 Mon Sep 17 00:00:00 2001 From: Seiji Matsuoka Date: Fri, 17 Nov 2023 14:32:26 +0900 Subject: [PATCH] enable default config and filters --- docs/build/app.js | 12 ++++++++++-- src/network/state.js | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/build/app.js b/docs/build/app.js index f7900b8..1e4d28d 100644 --- a/docs/build/app.js +++ b/docs/build/app.js @@ -1712,8 +1712,10 @@ var app = (function (d3, pako) { }; // Initialize snapshot - this.name = "default"; - this.filters = []; + this.name = "default"; // not shown + this.filters = session.filters || [ + {field: 'edge.weight', operator: '>=', value: 0.7, groups: []} + ]; this.config = { numericFields: [], categoricalFields: [], @@ -1724,6 +1726,9 @@ var app = (function (d3, pako) { alwaysShowEdge: false, forceParam: 'dense' }; + if (session.hasOwnProperty("config")) { + Object.assign(this.config, session.config); + } this.appearance = { nodeColor: {rangePreset: 'green', scale: 'constant'}, nodeSize: {rangePreset: '10-40px', scale: 'constant'}, @@ -1733,6 +1738,9 @@ var app = (function (d3, pako) { edgeWidth: {rangePreset: '4-20px', scale: 'constant'}, edgeLabel: {size: 12, visible: false} }; + if (session.hasOwnProperty("appearance")) { + Object.assign(this.appearance, session.appearance); + } this.snapshots = session.snapshots || []; this.snapshotIndex = this.snapshots.length - 1; } diff --git a/src/network/state.js b/src/network/state.js index c057a8c..bd53f93 100644 --- a/src/network/state.js +++ b/src/network/state.js @@ -77,8 +77,10 @@ export default class NetworkState extends TransformState { }; // Initialize snapshot - this.name = "default"; - this.filters = []; + this.name = "default"; // not shown + this.filters = session.filters || [ + {field: 'edge.weight', operator: '>=', value: 0.7, groups: []} + ]; this.config = { numericFields: [], categoricalFields: [], @@ -89,6 +91,9 @@ export default class NetworkState extends TransformState { alwaysShowEdge: false, forceParam: 'dense' }; + if (session.hasOwnProperty("config")) { + Object.assign(this.config, session.config) + } this.appearance = { nodeColor: {rangePreset: 'green', scale: 'constant'}, nodeSize: {rangePreset: '10-40px', scale: 'constant'}, @@ -98,6 +103,9 @@ export default class NetworkState extends TransformState { edgeWidth: {rangePreset: '4-20px', scale: 'constant'}, edgeLabel: {size: 12, visible: false} }; + if (session.hasOwnProperty("appearance")) { + Object.assign(this.appearance, session.appearance) + } this.snapshots = session.snapshots || []; this.snapshotIndex = this.snapshots.length - 1; }