java图形界面库fx_(JavaFX) SmartGraph - 通用(Java FX)图形可视化库

(JavaFX) SmartGraph

This project provides a generic (Java FX) graph visualization library that can automatically arrange the vertices' locations through a force-directed algorithm in real-time.

You can, instead, statically place the vertices according to other algorithms.

Vertices and edges can be styled through a css stylesheet or programmatically (even at runtime).

ee675c9477778d8efc91c4b52d135fa2.gif

Prerequisites

You need a working JDK with JavaFX libraries to compile/use the library. The code was tested with JDK 8 and OpenJDK 11.

Using the library

Check the releases folder for compiled library and source code. The jar library is the only requirement, but if you need to attach the javadoc and source code in your IDE, additionally use the zip file.

The visualization library can be used together with any ADT that adheres to the Graph or Digraph interfaces. Sample implementations are included.

Accelerated graphics

Since the visualization is computation-intensive during automatic force-directed layout of vertices, you should make sure that the graphics card is used to offload much of the work. This is only guaranteed to work with Oracle's JDK.

In windows the JVM machine should automatically take care of that, while in Linux you must configure it manually with the -Dsun.java2d.opengl=True flag.

Getting Started

Basic usage

//create the graph

Graph g = new GraphEdgeList<>();

//... see example below

SmartPlacementStrategy strategy = new SmartCircularSortedPlacementStrategy();

SmartGraphPanel graphView = new SmartGraphPanel<>(g, strategy);

Scene scene = new Scene(graphView, 1024, 768);

Stage stage = new Stage(StageStyle.DECORATED);

stage.setTitle("JavaFXGraph Visualization");

stage.setScene(scene);

stage.show();

//IMPORTANT - Called after scene is displayed so we can have width and height values

graphView.init();

This will

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值