diff --git a/app/api/graph/model.ts b/app/api/graph/model.ts index 91df1a2..27ae450 100644 --- a/app/api/graph/model.ts +++ b/app/api/graph/model.ts @@ -209,7 +209,7 @@ export class Graph { return new Graph(graphName || "", [], [], { nodes: [], links: [] }, new Map(), new Map(), new Map(), new Map(), colors) } - public static create(id: string, results: any, colors?: string[]): Graph { + public static create(id: string, results: { data: Data, metadata: any[] }, colors?: string[]): Graph { const graph = Graph.empty(undefined, colors) graph.extend(results) graph.id = id diff --git a/app/graph/View.tsx b/app/graph/View.tsx index 201fa0a..a33c2aa 100644 --- a/app/graph/View.tsx +++ b/app/graph/View.tsx @@ -20,7 +20,9 @@ export default function View({ graph, setGraph, selectedValue }: { const handlePreferencesChange = (colors?: string[]) => { setGraph(Graph.create(graph.Id, { data: graph.Data, metadata: graph.Metadata }, colors || colorsArr)) - if (colors) return + if (colors) { + localStorage.removeItem(graph.Id) + } localStorage.setItem(graph.Id, JSON.stringify(colorsArr)); } @@ -40,9 +42,9 @@ export default function View({ graph, setGraph, selectedValue }: { className="w-[30%] h-[50%]" title="Preferences" > -
+

Legends

-
    +
      { colorsArr.map((c, i) => (
    • setHover(c)} onMouseLeave={(() => setHover(""))} key={c} className={cn(`flex gap-8 items-center`)}> @@ -154,7 +156,7 @@ export default function View({ graph, setGraph, selectedValue }: {