Skip to content

Commit

Permalink
enable default config and filters
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaie committed Nov 17, 2023
1 parent 819a650 commit ab49b32
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions docs/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand All @@ -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'},
Expand All @@ -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;
}
Expand Down
12 changes: 10 additions & 2 deletions src/network/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand All @@ -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'},
Expand All @@ -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;
}
Expand Down

0 comments on commit ab49b32

Please # to comment.