Adds border color

This commit is contained in:
Henning Dieterichs
2023-11-19 14:03:11 +01:00
parent 96115a9a70
commit 5b0d979a23
2 changed files with 8 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import { Network, Options, DataSet } from "vis-network/standalone";
import { observer } from "mobx-react";
import * as React from "react";
import { NodeGraphData, EdgeGraphData } from "../sGraph";
import { DataSet, Network, Options } from "vis-network/standalone";
import { EdgeGraphData, NodeGraphData } from "../sGraph";
@observer
export class VisJsGraphViewer extends React.Component<{
@@ -12,7 +12,7 @@ export class VisJsGraphViewer extends React.Component<{
private readonly nodes = new DataSet<{
id: string;
label?: string;
color?: string;
color?: { border: string; background: string } | string;
shape?: string;
}>();
private readonly edges = new DataSet<{
@@ -42,7 +42,7 @@ export class VisJsGraphViewer extends React.Component<{
this.nodes.update({
id: n.id,
label: n.label !== undefined ? n.label : n.id,
color: n.color,
color: { background: n.color, border: n.borderColor },
shape: n.shape,
});
}

View File

@@ -1,11 +1,10 @@
import {
sOpenObject,
sLiteral,
sArrayOf,
sString,
sLiteral,
sOpenObject,
sOptionalProp,
sString,
sUnion,
sBoolean,
} from "@hediet/semantic-json";
import { visualizationNs } from "../../consts";
@@ -16,6 +15,7 @@ export const sGraphNode = sOpenObject({
id: sString(),
label: sOptionalProp(sString(), {}),
color: sOptionalProp(sString(), {}),
borderColor: sOptionalProp(sString(), {}),
shape: sOptionalProp(sUnion([sLiteral("ellipse"), sLiteral("box")]), {}),
}).defineAs(visualizationNs("GraphNode"));