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

Support for linkDirectionalArrowLength #410

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -28,6 +28,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 @@ -134,6 +136,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
Loading