Skip to content

Commit c89206b

Browse files
Support for linkDirectionalArrowLength (#410)
* No dir * Renamed directional configuration setting, fixed direction particles assignment --------- Co-authored-by: Niels de Jong <[email protected]>
1 parent dbf3ee2 commit c89206b

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

docs/modules/ROOT/pages/user-guide/reports/graph.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ directly maps to the width value.
9191
relationships with animated particles on them, moving in the direction
9292
of the relationship.
9393

94+
|Arrow head size |Number |3 |Use this to set the length of the arrow head, size is adjusted automatically.
95+
If 0, no arrow will be drawn.
96+
9497
|Background Color |Text |#fafafa |The background color of the
9598
visualization.
9699

src/chart/graph/GraphChart.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const NeoGraphChart = (props: ChartProps) => {
3333
// Retrieve config from advanced settings
3434
const settings = getSettings(props.settings, props.extensions, props.getGlobalParameter);
3535
const linkDirectionalParticles = props.settings && props.settings.relationshipParticles ? 5 : undefined;
36+
const arrowLengthProp = props?.settings?.arrowLengthProp ?? 3;
37+
3638
let nodePositions = props.settings && props.settings.nodePositions ? props.settings.nodePositions : {};
3739
const parameters = props.parameters ? props.parameters : {};
3840

@@ -139,6 +141,7 @@ const NeoGraphChart = (props: ChartProps) => {
139141
height: height,
140142
backgroundColor: settings.backgroundColor,
141143
linkDirectionalParticles: linkDirectionalParticles,
144+
linkDirectionalArrowLength: arrowLengthProp,
142145
linkDirectionalParticleSpeed: settings.linkDirectionalParticleSpeed,
143146
nodeLabelFontSize: settings.nodeLabelFontSize,
144147
nodeLabelColor: settings.nodeLabelColor,

src/chart/graph/GraphChartVisualization.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface GraphChartVisualizationProps {
6969
backgroundColor: any;
7070
linkDirectionalParticles?: number;
7171
linkDirectionalParticleSpeed: number;
72+
linkDirectionalArrowLength: number;
7273
nodeLabelFontSize: number;
7374
nodeLabelColor: string;
7475
relLabelFontSize: number;

src/chart/graph/GraphChartVisualization2D.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps
2424
height={props.style.height - 10}
2525
linkCurvature='curvature'
2626
backgroundColor={props.style.backgroundColor}
27-
linkDirectionalArrowLength={3}
27+
linkDirectionalArrowLength={props.style.linkDirectionalArrowLength}
2828
linkDirectionalArrowRelPos={1}
2929
dagMode={props.engine.layout}
3030
linkWidth={(link: any) => link.width}
@@ -42,6 +42,7 @@ export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps
4242
onBackgroundClick={() => props.interactivity.onNodeClick(undefined)}
4343
onBackgroundRightClick={() => props.interactivity.onNodeClick(undefined)}
4444
linkLineDash={(link) => (link.new ? [2, 1] : null)}
45+
linkDirectionalParticles={props.style.linkDirectionalParticles}
4546
linkDirectionalParticleSpeed={props.style.linkDirectionalParticleSpeed}
4647
cooldownTicks={props.engine.cooldownTicks}
4748
onEngineStop={() => {

src/config/ReportConfig.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const REPORT_TYPES = {
191191
type: SELECTION_TYPES.TEXT,
192192
default: 'width',
193193
},
194+
194195
relationshipParticles: {
195196
label: 'Animated particles on Relationships',
196197
type: SELECTION_TYPES.LIST,
@@ -202,6 +203,11 @@ export const REPORT_TYPES = {
202203
type: SELECTION_TYPES.NUMBER,
203204
default: 0.005,
204205
},
206+
arrowLengthProp: {
207+
label: 'Arrow head size',
208+
type: SELECTION_TYPES.NUMBER,
209+
default: 3,
210+
},
205211
layout: {
206212
label: 'Graph Layout (experimental)',
207213
type: SELECTION_TYPES.LIST,

0 commit comments

Comments
 (0)