Skip to content

Commit

Permalink
Support for linkDirectionalArrowLength (#410)
Browse files Browse the repository at this point in the history
* No dir

* Renamed directional configuration setting, fixed direction particles assignment

---------

Co-authored-by: Niels de Jong <niels-121@hotmail.com>
  • Loading branch information
BennuFire and nielsdejong committed Apr 18, 2023
1 parent dbf3ee2 commit c89206b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/modules/ROOT/pages/user-guide/reports/graph.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ directly maps to the width value.
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.

Expand Down
3 changes: 3 additions & 0 deletions src/chart/graph/GraphChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const NeoGraphChart = (props: ChartProps) => {
// Retrieve config from advanced settings
const settings = getSettings(props.settings, props.extensions, props.getGlobalParameter);
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 : {};
const parameters = props.parameters ? props.parameters : {};

Expand Down Expand Up @@ -139,6 +141,7 @@ const NeoGraphChart = (props: ChartProps) => {
height: height,
backgroundColor: settings.backgroundColor,
linkDirectionalParticles: linkDirectionalParticles,
linkDirectionalArrowLength: arrowLengthProp,
linkDirectionalParticleSpeed: settings.linkDirectionalParticleSpeed,
nodeLabelFontSize: settings.nodeLabelFontSize,
nodeLabelColor: settings.nodeLabelColor,
Expand Down
1 change: 1 addition & 0 deletions src/chart/graph/GraphChartVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface GraphChartVisualizationProps {
backgroundColor: any;
linkDirectionalParticles?: number;
linkDirectionalParticleSpeed: number;
linkDirectionalArrowLength: number;
nodeLabelFontSize: number;
nodeLabelColor: string;
relLabelFontSize: number;
Expand Down
3 changes: 2 additions & 1 deletion src/chart/graph/GraphChartVisualization2D.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps
height={props.style.height - 10}
linkCurvature='curvature'
backgroundColor={props.style.backgroundColor}
linkDirectionalArrowLength={3}
linkDirectionalArrowLength={props.style.linkDirectionalArrowLength}
linkDirectionalArrowRelPos={1}
dagMode={props.engine.layout}
linkWidth={(link: any) => link.width}
Expand All @@ -42,6 +42,7 @@ export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps
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={() => {
Expand Down
6 changes: 6 additions & 0 deletions src/config/ReportConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const REPORT_TYPES = {
type: SELECTION_TYPES.TEXT,
default: 'width',
},

relationshipParticles: {
label: 'Animated particles on Relationships',
type: SELECTION_TYPES.LIST,
Expand All @@ -202,6 +203,11 @@ export const REPORT_TYPES = {
type: SELECTION_TYPES.NUMBER,
default: 0.005,
},
arrowLengthProp: {
label: 'Arrow head size',
type: SELECTION_TYPES.NUMBER,
default: 3,
},
layout: {
label: 'Graph Layout (experimental)',
type: SELECTION_TYPES.LIST,
Expand Down

0 comments on commit c89206b

Please sign in to comment.