Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.2 Release #752

Merged
merged 106 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f151d32
Made API keys hidden (password fields) in the query translator module
nielsdejong Oct 10, 2023
d2525ae
Legend on bottom, working on scrolling
Oct 24, 2023
66d0317
Scrolling added, legend gets cut off. Need to set width according to …
Oct 24, 2023
6e0aad9
Set autowidth depending on length of array
Oct 24, 2023
940ed29
wednesday
Oct 25, 2023
0caa78a
Added new report action type for tables: multiselect checkboxes (#664)
nielsdejong Oct 27, 2023
3a2cf4d
Fix handling external updates of parameter values in parameter select…
nielsdejong Oct 27, 2023
5e27a02
Feature/new dashboard load UI (#657)
nielsdejong Oct 27, 2023
c2b879b
monday
Oct 30, 2023
5032618
Horizontal/Vertical legend switch
Oct 30, 2023
2e1cf07
Sorted graph sizing with padding
Oct 30, 2023
dafb5b6
Tuesday Afternoon
Oct 31, 2023
db2cbce
Mapped bar chart event to standardized action event
nielsdejong Oct 31, 2023
221a602
Wednesday Morning
Nov 1, 2023
d3fee84
Added event handling for actions on bar charts
nielsdejong Nov 1, 2023
fcca63d
Fixed styling for bar chart report action
Nov 2, 2023
f4c2791
Bump @babel/traverse from 7.21.4 to 7.23.2 in /gallery (#670)
dependabot[bot] Nov 3, 2023
7b7bed1
Bump @babel/traverse from 7.20.13 to 7.23.2 (#669)
dependabot[bot] Nov 3, 2023
4f29427
Bump postcss from 8.4.23 to 8.4.31 in /gallery (#656)
dependabot[bot] Nov 6, 2023
f823de2
Bump postcss from 8.4.21 to 8.4.31 (#655)
dependabot[bot] Nov 6, 2023
9dfff37
added minimum bar height
Nov 6, 2023
e4b0ecd
Text hard to read on dark theme (#668)
JonanOribe Nov 6, 2023
27fd472
Monday
Nov 6, 2023
96bd80b
Hotfix for wrong default parameter replacement in markdown
nielsdejong Nov 7, 2023
2d030a4
Merge branch 'develop' of github.com:neo4j-labs/neodash into develop
nielsdejong Nov 7, 2023
295857b
Add back arrow on connection modal (#675)
hugorplobo Nov 10, 2023
3742393
VULCAN-126/Override default message (#683)
nielsdejong Nov 10, 2023
65a28bf
Added report action functionality in bar chart when using BarComponent
Nov 13, 2023
be8b08f
Fix/hiding columns in table (#685)
AleSim94 Nov 13, 2023
ad4bd0b
Fix parameters values (#641)
BennuFire Nov 13, 2023
cbe4aed
Removed adjustedData state for min bar height
Nov 13, 2023
207b141
Added comments to BarChart.tsx
Nov 13, 2023
d7be8c7
Updated dashboard format to 2.4. Double resolution for horizontal and…
nielsdejong Nov 14, 2023
fceb5f3
Feature/gantt chart (#684)
alfredorubin96 Nov 14, 2023
c54acd3
adding in advanced config for the graph viz more graph layout config …
AleSim94 Nov 14, 2023
a6140d0
Adding form widget as a new extension (#568)
nielsdejong Nov 14, 2023
8055a9a
Removed dependencies, reverted reportconfig bar chart order
Nov 15, 2023
5bce9cd
Changed BarComponent always renders now so pointer always shows on ba…
Nov 15, 2023
bdb3c8e
moved onClick logic to handleBarClick const
Nov 15, 2023
27d35f1
Model Examples and LLM improvements (#600)
alfredorubin96 Nov 15, 2023
6eb1d94
Extracted margin logic from BarChartComponent into new const
Nov 15, 2023
c71b6b4
Extracted legend logic into separate function
Nov 15, 2023
d8374af
extracted onChange and onInputChange to separate functions
Nov 15, 2023
183ff3f
Issue with setting customWidth
Nov 15, 2023
1e66f6c
refactor: add explicit enum constants
hugorplobo Nov 15, 2023
85ff8fd
Merge branch 'master' into develop
nielsdejong Nov 16, 2023
9732c09
Added release notes for 2.4 + bonus feature (keyboard shortcut to run…
nielsdejong Nov 16, 2023
86cf207
Hotfixes for Sonarqube issues
nielsdejong Nov 16, 2023
85d9581
minor fix in the forms where it wasn't getting the correct value in t…
alfredorubin96 Nov 16, 2023
826e0e0
Fix hiding column prefix (#695)
alfredorubin96 Nov 16, 2023
1768dea
Merge branch 'master' into develop
nielsdejong Nov 16, 2023
216d1d6
fixing merge
alfredorubin96 Nov 16, 2023
197e268
Added manual legendWidth back in
Nov 17, 2023
09b0b4d
Font-color not changed in graph contextual popups when in dark mode #621
JonanOribe Nov 17, 2023
430381d
Fixed styling of report action and moved visualisation logic to outsi…
Nov 17, 2023
c73b971
Friday
Nov 17, 2023
d81f145
refactor: extract unions to explicit types
hugorplobo Nov 15, 2023
0924af5
Updated documentation
Nov 20, 2023
bb37e0c
fixed most code smells
Nov 20, 2023
190fb11
Fix for only displaying active databases in the sidebar (#698)
nielsdejong Nov 21, 2023
9486969
Merge branch 'develop' into Font-color-not-changed-in-graph-contextua…
JonanOribe Nov 22, 2023
fcb08ec
Removed checked in html file
nielsdejong Nov 23, 2023
9b36f99
fixed typos, dependencies, UX
nielsdejong Nov 23, 2023
1b4f484
Fix bugs in actions helper
nielsdejong Nov 23, 2023
c9e5a90
refactor: add value to input
freitagfelipe Nov 26, 2023
6a022e2
refactor: update any types
freitagfelipe Nov 26, 2023
82c3b0a
Enabled page switch actions on bar charts
nielsdejong Nov 26, 2023
c4ef665
Change on filter tooltip to avoid hide table data
JonanOribe Nov 27, 2023
bdb478c
Merge branch 'develop' into table-widget-filter-hiding-first-value
JonanOribe Nov 27, 2023
8ab4b56
Merge pull request #712 from JonanOribe/table-widget-filter-hiding-fi…
alfredorubin96 Nov 27, 2023
f089f1a
Merge pull request #702 from hugorplobo/refactor-enum
alfredorubin96 Nov 27, 2023
7716802
Merge pull request #703 from hugorplobo/refactor-union
alfredorubin96 Nov 27, 2023
94d58ab
Merge pull request #711 from hugorplobo/uncontrolled-component
alfredorubin96 Nov 27, 2023
4220f54
Merge pull request #699 from JonanOribe/Font-color-not-changed-in-gra…
alfredorubin96 Nov 27, 2023
086faf8
removing code smells
alfredorubin96 Nov 27, 2023
fef6f9a
Merge branch 'develop' into any-type
alfredorubin96 Nov 27, 2023
6753676
Merge pull request #710 from hugorplobo/any-type
alfredorubin96 Nov 27, 2023
a49801f
Fixed bug (hopefully)
Nov 29, 2023
a9eb6c4
merging with develop
alfredorubin96 Dec 5, 2023
1cc26e3
Added comments for styles naming convention
Dec 5, 2023
9753f70
Bump @adobe/css-tools from 4.3.1 to 4.3.2 (#720)
dependabot[bot] Dec 6, 2023
b56215e
Feature/8raven (#705)
alfredorubin96 Dec 6, 2023
b9ab834
Fixed menu placement for node property selector in form modal
nielsdejong Dec 6, 2023
de4e25b
Fix race condition caused by incorrect date casted from serialized da…
nielsdejong Dec 6, 2023
4e2c2f4
Parameter selector suggestions are now sorted by length
nielsdejong Dec 6, 2023
3cc3f1a
Merge pull request #689 from neo4j-labs/feature/ikea-fixes-alternative
AleSim94 Dec 6, 2023
e3e7833
Merge pull request #728 from neo4j-labs/feature/686-param-selector-limit
AleSim94 Dec 6, 2023
1c2519d
Merge pull request #727 from neo4j-labs/fix/717-race-condition-uncast…
AleSim94 Dec 6, 2023
58b188c
Merge pull request #726 from neo4j-labs/issue/700-form-field-modal-se…
AleSim94 Dec 6, 2023
2dd0330
Merge branch 'master' into develop
nielsdejong Dec 6, 2023
441e29f
Improved styling of dashboard header buttons, download CSV button (#729)
nielsdejong Dec 6, 2023
8fa8c15
Bumped version to 2.4.1 & added release notes (#731)
nielsdejong Dec 7, 2023
52426c8
fixing rule based styling wrong casting at number
alfredorubin96 Dec 15, 2023
717d596
Merge pull request #738 from neo4j-labs/fix/rule_based_styling
alfredorubin96 Dec 15, 2023
2d4e5f2
Hotfix for broken custom header deployments
nielsdejong Jan 8, 2024
e6d535a
changing report config default options (#724)
alfredorubin96 Jan 8, 2024
f02c147
Browser tab titles (#708)
m-o-n-i-s-h Jan 9, 2024
9adda61
Fixed linting. Added dark mode fix for graphs (#743)
nielsdejong Jan 9, 2024
48fe130
Adding in 3D graph visualization as an advanced visualization (#737)
nielsdejong Jan 10, 2024
ac8eda1
Improved handling of draft dashboards in the sidebar, allowing to dis…
nielsdejong Jan 10, 2024
f708147
Added parameter select setting for autopopulating first selector valu…
nielsdejong Jan 10, 2024
ee32fe1
2.4.2 Release Notes (#745)
nielsdejong Jan 12, 2024
9a541b3
Merge
nielsdejong Jan 12, 2024
c4cf2fd
Collection of bug fixes for the 2.4.2 release (#744)
nielsdejong Jan 12, 2024
9caa1b9
Hotfix for typo in release notes
nielsdejong Jan 12, 2024
166efbf
Final docs for 2.4.2 release
nielsdejong Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding in 3D graph visualization as an advanced visualization (#737)
* Multiple relationships between nodes in 3D graph & self-loops

* Refactoring graph code

* Renamed files for graph visualization interface

* Refactored 2D/3D graph to share a common base

* Enabled report actions

* Finalized 3D graph code

* Added docs for 3D graph

* Fixed non-https placeholder for advanced setting

* Actions/rule-based styling for 3d graph
  • Loading branch information
nielsdejong authored Jan 10, 2024
commit 48fe13028eea87ae508ed35ba9d72f397b5be4c7
Binary file added docs/modules/ROOT/images/graph3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/modules/ROOT/images/graph3dvirtual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*** xref:user-guide/reports/bar-chart.adoc[Bar Chart]
*** xref:user-guide/reports/pie-chart.adoc[Pie Chart]
*** xref:user-guide/reports/line-chart.adoc[Line Chart]
*** xref:user-guide/reports/graph3d.adoc[3D Graph]
*** xref:user-guide/reports/sunburst.adoc[Sunburst]
*** xref:user-guide/reports/circle-packing.adoc[Circle Packing]
*** xref:user-guide/reports/choropleth.adoc[Choropleth]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ For specific use-cases, these visualizations may convey information that a simpl
To use advanced visualizations, enable them in the **Extensions Window**. This makes them selectable inside reports, as well as add examples to the Example window.

The following visualizations are part of this extension:

- A link:../../reports/graph3d[3D Graph] to visualize a graph in three dimensions.
- A link:../../reports/sankey[Sankey Chart] to visualize flows.
- Three charts to plot hierarchical data (link:../../reports/sunburst[Sunburst], link:../../reports/circle-packing[Circle Packing], link:../../reports/treemap[Treemap])
- A link:../../reports/gauge-chart[Gauge Chart] to show percentages.
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/user-guide/reports/graph.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RETURN p, a, m

image::graph.png[Basic Graph]

== Virtual Graph (apoc is required)
== Virtual Graph

....
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(p2:Person)
Expand Down
135 changes: 135 additions & 0 deletions docs/modules/ROOT/pages/user-guide/reports/graph3d.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
= 3D Graph

link:../../extensions/advanced-visualizations[label:Advanced&nbsp;Visualization[]]

The 3D graph report extends the default graph visualization with another dimensions.
It supports ~95% of the features & customizations for the regular (2D) graph, including rule-based styling and report actions.

== Examples

=== Basic Graph

....
MATCH (p:Person)-[a:ACTED_IN]->(m:Movie)
WHERE m.title = 'The Matrix'
RETURN p, a, m
....

image::graph3d.png[Basic 3D Graph]

== Virtual Graph

....
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(p2:Person)
WHERE m.title = "The Matrix"
RETURN p, p2, apoc.create.vRelationship(p, "KNOWS", {}, p2)
....

image::graph3dvirtual.png[Virtual 3D Graph]

== Advanced Settings

[width="100%",cols="12%,2%,3%,83%",options="header",]
|===
|Name |Type |Default Value |Description
|Node Color Scheme |List |neodash |The color scheme to use for the node
labels. Colors are assigned automatically (consequitevely) to the
different labels returned by the Cypher query.

|Node Label Color |Text |black |The color of the labels drawn on the
nodes.

|Node Label Font Size |Number |3.5 |Size of the labels drawn on the
nodes.

|Node Size |Number |2 |Default size of a node in the graph
visualization. This size is applied if no custom size styling is defined
and no Rule-Based styling is active.

|Node Size Property |Text |size |Optionally, the name of the node
property to map to the node size. This lets you define sizes on a
node-specific level, if you have a property that directly maps to the
numeric size value.

|Node Color Property |Text |color |Optionally, the name of the node
property to map to the node color. This lets you define colors on a
node-specific level, if you have a property that directly maps to the
HTML color value.

|Relationship Color |Text |#a0a0a0 |The color used for drawing the
relationship arrows in the visualization.

|Relationship Width |Text |1 |The (default) width of the relationship
arrows in the visualization.

|Relationship Label Color |Text |#a0a0a0 |The color of the labels
(relationship type) drawn next to the relationship arrows.

|Relationship Label Font Size |Text |2.75 |The font size of the labels
(relationship type) drawn next to the relationship arrows.

|Relationship Color Property |Text |color |Optionally, the name of the
relationship property to map to the arrow color. This lets you define
colors on a relationship-specific level, if you have a property that
directly maps to the HTML color value.

|Relationship Width Property |Text |width |Optionally, the name of the
relationship property to map to the arrow width. This lets you define
widths on a relationship-specific level, if you have a property that
directly maps to the width value.

|Animated Particles on Relationships |on/off |off |If enabled, draw
relationships with animated particles on them, moving in the direction
of the relationship.

|Arrow head size |Number |3 |Use this to set the length of the arrow head, size is adjusted automatically.
If 0, no arrow will be drawn.

|Background Color |Text |#fafafa |The background color of the
visualization.

|Layout (experimental) |List |force-directed |tree-top-down |tree-bottom-up |tree-left-right |tree-right-left |radial | Use this to switch from
the main (force-directed) layout to one of the experimental layouts
(tree, radial). For the experimental layouts, make sure
your graph is a DAG (directed acyclic graph).

| Graph Depth Separation | Number | 30 | Specify the level distance for the tree layout.
This setting controls the separation between different levels in the tree hierarchy. Adjusting this value impacts the overall spacing of the tree layout in your graph visualization.

|Enable graph exploration |on/off |on |Enables basic exploration functionality for the graph. Exploration can be done by right clicking on a node, and choosing 'Expand' to choose a type to traverse. Data is retrieved real-time and not cached in the visualization.

|Enable graph editing |on/off |off |Enables editing of nodes and relationships in the graph from the right-click context menu. In addition, lets users create new relationships with existing types/property keys as present in the database.

|Show pop-up on Hover |on/off |on |if enabled, shows a pop-up when a
user hovers over one of the nodes/relationships in the visualization.
The pop-up contains the label and properties of the node/relationship.

|Show properties on Click |on/off |on |if enabled, opens up a window
when a user clicks on one of the nodes/relationships in the
visualization. The window contains the label and properties of the
node/relationship.

|Drilldown Link |Text (URL) |(no value) |Specifying a URL here will
display a floating button on the top right of the visualization. This
button can be used to drilldown into a different tool (e.g. Bloom) so
that the graph can be explored further. Dynamic Dashboard Parameters
(e.g. $neodash_person_name) can be used in these links as well.

|Hide Selections |on/off |off |If enabled, hides the property selector
(footer of the visualization).

|Override no data message |Text |Query returned no data. |Override the message displayed to the user when their query returns no data.

|Auto-run query |on/off |on |when activated automatically runs the query
when the report is displayed. When set to `off', the query is displayed
and will need to be executed manually.
|Report Description |markdown text | | When specified, adds another button the report header that opens a pop-up. This pop-up contains the rendered markdown from this setting.
|===

== Rule-Based Styling

Using the link:../#_rule_based_styling[Rule-Based Styling] menu, the
following style rules can be applied to the graph:

- The background color of a node.
- The label color of a node.
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/user-guide/reports/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pages:
- link:bar-chart[Bar Chart]
- link:pie-chart[Pie Chart]
- link:line-chart[Line Chart]
- link:graph3d[3D Graph]
- link:sunburst[Sunburst]
- link:circle-packing[Circle Packing]
- link:treemap[Treemap]
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"react-cool-dimensions": "^2.0.7",
"react-dom": "^17.0.2",
"react-force-graph-2d": "^1.23.8",
"react-force-graph-3d": "^1.24.1",
"react-gauge-chart": "^0.4.1",
"react-grid-layout": "^1.3.4",
"react-leaflet": "^3.2.5",
Expand All @@ -97,6 +98,8 @@
"remark-gfm": "^3.0.1",
"reselect": "^4.1.8",
"tailwindcss": "^3.3.2",
"three": "^0.159.0",
"three-spritetext": "^1.8.1",
"use-neo4j": "^0.3.13",
"yaml": "^2.2.1"
},
Expand Down
17 changes: 13 additions & 4 deletions src/chart/graph/GraphChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,27 @@ import { getSettings } from '../SettingsUtils';
import { getPageNumbersAndNamesList } from '../../extensions/advancedcharts/Utils';
import { CloudArrowDownIconOutline } from '@neo4j-ndl/react/icons';

export interface GraphChartProps extends ChartProps {
lockable?: boolean;
component?: any;
}

const DEFAULT_VISUALIZATION_COMPONENT = NeoGraphChartVisualization2D;

/**
* Draws graph data using a force-directed-graph visualization.
* This visualization is powered by `react-force-graph`.
* See https://github.com/vasturiano/react-force-graph for examples on customization.
*/
const NeoGraphChart = (props: ChartProps) => {
const NeoGraphChart = (props: GraphChartProps) => {
if (props.records == null || props.records.length == 0 || props.records[0].keys == null) {
return <>No data, re-run the report.</>;
}
const Visualization = props.component ? props.component : DEFAULT_VISUALIZATION_COMPONENT;

// Retrieve config from advanced settings
const settings = getSettings(props.settings, props.extensions, props.getGlobalParameter);
const lockable = props.lockable !== undefined ? props.lockable : true;
const linkDirectionalParticles = props.settings && props.settings.relationshipParticles ? 5 : undefined;
const arrowLengthProp = props?.settings?.arrowLengthProp ?? 3;
let nodePositions = props.settings && props.settings.nodePositions ? props.settings.nodePositions : {};
Expand Down Expand Up @@ -217,7 +226,7 @@ const NeoGraphChart = (props: ChartProps) => {
}, [props.records]);

return (
<div ref={observe} style={{ width: '100%', height: '95%' }}>
<div ref={observe} style={{ width: '100%', height: '100%' }}>
<NeoGraphChartCanvas>
<IconButtonArray
aria-label={'graph icon'}
Expand All @@ -227,10 +236,10 @@ const NeoGraphChart = (props: ChartProps) => {
>
<GraphChartContextMenu {...chartProps} />
<NeoGraphChartFitViewButton {...chartProps} />
{settings.lockable ? <NeoGraphChartLockButton {...chartProps} /> : <></>}
{lockable && settings.lockable ? <NeoGraphChartLockButton {...chartProps} /> : <></>}
{settings.drilldownLink ? <NeoGraphChartDeepLinkButton {...chartProps} /> : <></>}
</IconButtonArray>
<NeoGraphChartVisualization2D {...chartProps} />
<Visualization {...chartProps} />
<NeoGraphChartInspectModal {...chartProps}></NeoGraphChartInspectModal>
{settings.allowDownload && props.records && props.records.length > 0 ? (
<IconButtonArray floating orientation='horizontal' className='n-z-10 n-absolute n-bottom-2 n-left-4'>
Expand Down
16 changes: 16 additions & 0 deletions src/chart/graph/GraphChartVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ export interface GraphChartVisualizationProps {
customTablePropertiesOfModal: any[];
pageIdAndParameterName: string;
};
/**
* A set of configuration parameters used for the visualization engine.
*/
config?: {
graphComponent: any;
cooldownAfterengineStop: number;
nodeCanvasObjectMode?: () => void;
nodeCanvasObject?: (node: any, ctx: any) => void;
linkCanvasObjectMode?: () => void;
linkCanvasObject?: (link: any, ctx: any) => void;
nodeThreeObjectExtend?: boolean;
nodeThreeObject?: (node) => void;
linkThreeObjectExtend?: boolean;
linkThreeObject?: (link) => void;
linkPositionUpdate?: (sprite: any, { start, end }: { start: any; end: any }, link: any, ref: any) => void;
};
/**
* entries in 'extensions' let users plug in extra functionality into the visualization based on enabled plugins.
*/
Expand Down
120 changes: 25 additions & 95 deletions src/chart/graph/GraphChartVisualization2D.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,103 +5,33 @@ import { getTooltip } from './component/GraphChartTooltip';
import { GraphChartVisualizationProps } from './GraphChartVisualization';
import { generateNodeCanvasObject } from './util/NodeUtils';
import { generateRelCanvasObject } from './util/RelUtils';
import { NeoGraphChartVisualizationBase } from './GraphChartVisualizationBase';

/*
* TODO: check if makes sense to change zoom logic from panning to buttons
* (when i scroll the graphCharts has the priority )
*
*/
export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps) => {
const fgRef: React.MutableRefObject<any> = useRef();

if (!props.style.width || !props.style.height) {
return <></>;
}
props.interactivity.zoomToFit = () => fgRef.current && fgRef.current.zoomToFit(400);

return (
<ForceGraph2D
ref={fgRef}
width={props.style.width - 20}
height={props.style.height}
linkCurvature='curvature'
backgroundColor={props.style.backgroundColor}
linkDirectionalArrowLength={props.style.linkDirectionalArrowLength}
linkDirectionalArrowRelPos={1}
dagMode={props.engine.layout}
dagLevelDistance={props.engine.graphDepthSep}
linkWidth={(link: any) => link.width}
linkLabel={(link: any) => (props.interactivity.showPropertiesOnHover ? `<div>${getTooltip(link)}</div>` : '')}
nodeLabel={(node: any) => (props.interactivity.showPropertiesOnHover ? `<div>${getTooltip(node)}</div>` : '')}
nodeVal={(node: any) => node.size}
onNodeClick={(item) => {
let rules = getRuleWithFieldPropertyName(item, props.extensions.actionsRules, 'onNodeClick', 'labels');
rules != null
? rules.forEach((rule) => executeActionRule(rule, item, { ...props.interactivity }))
: props.interactivity.onNodeClick(item);
}}
onLinkClick={(item) => {
let rules = getRuleWithFieldPropertyName(item, props.extensions.actionsRules, 'onLinkClick', 'type');
rules != null
? rules.forEach((rule) => executeActionRule(rule, item, props.interactivity.setGlobalParameter))
: props.interactivity.onRelationshipClick(item);
}}
onNodeRightClick={(node, event) => props.interactivity.onNodeRightClick(node, event)}
onLinkRightClick={(link, event) => props.interactivity.onRelationshipRightClick(link, event)}
onBackgroundClick={() => props.interactivity.onNodeClick(undefined)}
onBackgroundRightClick={() => props.interactivity.onNodeClick(undefined)}
linkLineDash={(link) => (link.new ? [2, 1] : null)}
linkDirectionalParticles={props.style.linkDirectionalParticles}
linkDirectionalParticleSpeed={props.style.linkDirectionalParticleSpeed}
cooldownTicks={props.engine.cooldownTicks}
onEngineStop={() => {
props.engine.setCooldownTicks(0);
if (props.engine.recenterAfterEngineStop) {
fgRef.current.zoomToFit(400);
props.engine.setRecenterAfterEngineStop(false);
}
}}
onZoom={() => {
props.interactivity.setContextMenuOpen(false);
}}
onNodeDrag={() => {
props.interactivity.setContextMenuOpen(false);
props.engine.setCooldownTicks(1);
props.engine.setRecenterAfterEngineStop(false);
}}
onNodeDragEnd={(node) => {
props.engine.setCooldownTicks(0);
if (props.interactivity.fixNodeAfterDrag) {
node.fx = node.x;
node.fy = node.y;
}
if (props.interactivity.layoutFrozen) {
const key = node.id;
const val = [node.x, node.y];
const old = { ...props.interactivity.nodePositions };
old[key] = val;
props.interactivity.setNodePositions(old);
}
}}
nodeCanvasObjectMode={() => 'after'}
nodeCanvasObject={(node: any, ctx: any) =>
generateNodeCanvasObject(
node,
ctx,
props.style.nodeIcons,
props.interactivity.layoutFrozen,
props.interactivity.nodePositions,
props.style.nodeLabelFontSize,
props.style.defaultNodeSize,
props.style.nodeLabelColor,
props.extensions.styleRules,
props.engine.selection
)
}
linkCanvasObjectMode={() => 'after'}
linkCanvasObject={(link: any, ctx: any) =>
generateRelCanvasObject(link, ctx, props.style.relLabelFontSize, props.style.relLabelColor)
}
graphData={props.style.width ? { nodes: props.data.nodes, links: props.data.links } : { nodes: [], links: [] }}
/>
);
const config2d = {
graphComponent: ForceGraph2D,
cooldownAfterengineStop: 0,
nodeCanvasObjectMode: () => 'after',
nodeCanvasObject: (node: any, ctx: any) =>
generateNodeCanvasObject(
node,
ctx,
props.style.nodeIcons,
props.interactivity.layoutFrozen,
props.interactivity.nodePositions,
props.style.nodeLabelFontSize,
props.style.defaultNodeSize,
props.style.nodeLabelColor,
props.extensions.styleRules,
props.engine.selection
),
linkCanvasObjectMode: () => 'after',
linkCanvasObject: (link: any, ctx: any) =>
generateRelCanvasObject(link, ctx, props.style.relLabelFontSize, props.style.relLabelColor),
};
const props2d = { ...props, config: config2d };
return <NeoGraphChartVisualizationBase {...props2d} />;
};
Loading
Loading