Skip to content

Commit

Permalink
move to fcose layout
Browse files Browse the repository at this point in the history
  • Loading branch information
gkorland committed Jan 18, 2024
1 parent 2f0f76e commit 0fbb26a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/graph/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import { toast } from "@/components/ui/use-toast";
import CytoscapeComponent from 'react-cytoscapejs'
import cytoscape from 'cytoscape';
import fcose from 'cytoscape-fcose';
import { useRef, useState } from "react";
import { Node, Graph, Category, getCategoryColorName } from "./model";
import { signOut } from "next-auth/react";
Expand All @@ -11,6 +13,8 @@ import { Labels } from "./labels";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";

cytoscape.use( fcose );

// The stylesheet for the graph
const STYLESHEET: cytoscape.Stylesheet[] = [
{
Expand Down Expand Up @@ -70,10 +74,9 @@ const STYLESHEET: cytoscape.Stylesheet[] = [
]

const LAYOUT = {
name: "cose",
name: "fcose",
fit: true,
padding: 30,
avoidOverlap: true,
}

export default function Page() {
Expand Down Expand Up @@ -203,7 +206,7 @@ export default function Page() {
</TableBody>
</Table>
</TabsContent>
<TabsContent value="graph" className="grow w-full">
<TabsContent value="graph" className="grow w-full">
<div className="h-full flex flex-col">
<div className="grid grid-cols-6">
<Toolbar className="col-start-1 justify-start" chartRef={chartRef} />
Expand Down
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cytoscape": "^3.28.1",
"cytoscape-fcose": "^2.2.0",
"falkordb": "^5.0.1",
"lucide-react": "^0.301.0",
"next": "14.0.4",
Expand All @@ -35,6 +36,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@types/cytoscape-fcose": "^2.2.4",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-cytoscapejs": "^1.2.5",
Expand Down

0 comments on commit 0fbb26a

Please sign in to comment.