Visualization tool solo show ----- processing prefuse show

Source: Internet
Author: User

After listing some software and plug-ins mainly developed based on Java in the previous article "visual tool solo show", I carefully figured out which ones can be used by me.

After looking at the details, we are going to pick out the processing and prefuse generals to show their strength!

(Note: gephi was not mentioned in the previous and current "solo show", but it does not mean that it is not a stream or grade. It is just a high-end and excellent visualization tool, these two articles are the comparison of some tools after the author explores the source code of gephi, so they are not listed .)

 

1. Processing:

Processing's initial goal was to develop the sketchbook and environment for graphics and to visually teach the basic knowledge of computer science. Later, it gradually evolved into an environment that can be used to create a professional graphic visualization project.

Processing is written in Java programming language.

Processing API address: http://processing.org/reference/ has how to color, draw lines, rendering graphics and images and so on.

Http://processing.org/reference/javadoc/core/

Official website address: http://www.processing.org/

Processing develops Java Applet applications. A Java Applet can be run in a web browser. Java Applet must be embedded in the HTML page as a <APPLET> script to run in a web browser. One of its disadvantages is to use small Java applications, which may be slow when uploading data to some computers, and not everyone has installed Java (although most people have installed it ). However, there is also a solution. processing has released its JavaScript version.

However, Java Applet has its own shortcomings, which are less efficient and requires JVM support. There is no developed ide tool. A Java Applet can be run in a web browser. Java Applet must be embedded in the HTML page as a <APPLET> script to run in a web browser .)

The following describes a part of the processing API:

The processing application has a certain structure, which is important when developing a graphic application (more than animation) that can run continuously and change the display window at any time. In this case, the importance of setup and draw functions is highlighted.

The setup () function is used for initialization and is executed once during processing. Usually, the setup () function contains the size () function (used to define the window boundary) and the initialization of the variables to be used during the operation. The draw () function is continuously executed during processing. After the draw () function ends, a new screen is drawn in the display window, And the draw () function is called again. The default draw speed is 60 images per second, but you can also change this speed by calling the framerate () function.

In addition, noloop () and draw () can be used to control when to draw the screen. The noloop () function will stop the painting, and the loop () function can be used to start painting again. You can call redraw () to control when a draw is called.

The size () keyword specifies the X and Y coordinates of the display window. Size () accepts the optional third parameter mode. Mode is used to define the rendering engine to use and support PDF (directly rendered as Adobe®PDF files), OpenGL (using an available open-Gl graphics adapter), p3d (for rapid 3-D rendering), and so on. The default value is java2d, which is best suited for high-quality 2-D imaging.

You can use the get () operation to read the color of a given pixel in the display. Although set () is very simple, it is not the fastest way to display operations. For quick access, you can use the pixels array (consistent with the loadpixels and updatepixels functions ).

Using a single function in processing is easy to draw shapes. You can use the stroke () function to specify the color used to draw a shape. This function can accept a separate grayscale parameter or three RGB parameters. You can also use the fill command to define the fill color of the shape.

The line () function accepts four parameters, representing the point in which the line is to be drawn. The rect () function can draw a rectangle, and the first two points define the position, while the last two points define the width and height respectively. The ellipse () function also accepts four parameters to define the location and width/height respectively. A circle is formed when the width and height are equal. You can also use the ellipsemode () function to customize an ellipse. It specifies whether the position X and Y represent the corner or center of the ellipse ).

Quad () can easily draw a polygon with four edges. The quadrilateral accepts eight parameters, representing the four vertices of the Quadrilateral.

Processing supports listening for keyboard and mouse events, such as keypressed (), keyrealeased (), mousepressed (), and mousemoved.

Processing supports object-oriented programming.

However, processing is not like the prefuse that we will introduce below. It has already integrated layout algorithms.

References: http://www.ibm.com/developerworks/cn/opensource/os-datavis/

The following is a demo running on the processing client (you can also run it in Eclipse/myeclipse, and you need to install the processing plug-in ):

 1 void setup() { 2   size(640, 360, P3D); 3   noStroke(); 4 } 5  6 void draw() { 7   background(0); 8   translate(width / 2, height / 2); 9   10   // Orange point light on the right11   pointLight(150, 100, 0, // Color12              200, -150, 0); // Position13 14   // Blue directional light from the left15   directionalLight(0, 102, 255, // Color16                    1, 0, 0); // The x-, y-, z-axis direction17 18   // Yellow spotlight from the front19   spotLight(255, 255, 109, // Color20             0, 40, 200, // Position21             0, -0.5, -0.5, // Direction22             PI / 2, 2); // Angle, concentration23   24   rotateY(map(mouseX, 0, width, 0, PI));25   rotateX(map(mouseY, 0, height, 0, PI));26   box(150);27 }

Running:

 

2. prefuse:

Prefuse API address: http://prefuse.org/doc/api/

Prefuse User Manual: http://prefuse.org/doc/manual/

Prefuse is a data visualization tool developed in Java. It supports rich data models, visualization, and interaction features, with tables, tree shapes, a series of la S and animations. Prefuse uses Java 2D graphics library programming, which can be effectively integrated into Java swing applications and applets, and is free to use. ------ Source code is available.

Official website address: http://prefuse.org/

Prefuse is a user interface toolkit that provides interactive information visualization.

Prefuse can be a file system, computer network, website, biological classification, or social network. To display images, you must first obtain and import the data.

Prefuse provides graphic interfaces, including nodes, edges, Tree nodes, graphs, and trees. It also provides graphic read/write interfaces, including reading data files in XML, CSV, and other formats.

Prefuse provides the image filtering function, including locking a certain range of images for display and operation. Itemregistry (Component registration mechanism) is the core data structure mechanism in prefuse. It controls the ing between the original image and the visualization component display, and provides a fast iterative queue for the components to be filtered.

Renderers is responsible for drawing and calculating graphic boundaries. It is also a way for rendererfacotry to visually present a given visualization component.

The Renderer provides shaperenderer, textrenderer, textimagerederer, edgerenderer, and subtreeaggregaterenderer) and other rendering methods.

The data display class provides drawing and interactive operations on the screen. It inherits javax. Swing. jcomponent and provides graphical interface listening and feedback through the controllistener interface and prefuse. controls. This class supports text editing, graphic conversion, translation, and scaling of screen images.

Image processing operations (such as filtering, layout, and attribute allocation) are implemented by constructing a MPs module pipeline called actions. Actionlists submits and executes tasks to activitymanager.

Actions mainly includes the following operations:

Filters:Graphfilter, treefilter, fisheyetreefilter, and fisheyegraphfilter

Layout:Forcedirectedlayout, radiallayout, squarifiedtreemaplayout ,...

Assignment:Colorfunction, sizefunction, fontfunction

Interpolation:Colorinterpolator, linearinterpolator, polarinterpolator

 

How to Use prefuse to build an app:

  1. Design a visual interface and determine how to layout and interact;
  2. Determine the input and output of graph data;
  3. Initialize itemregistry and display (s) classes;
  4. Select or implement the renderers (Renderer) and rendererfactory (rendering factory );
  5. Construct various required actionlists;
  6. Use the existing actions library or custom modules (or submodules such as the force function );
  7. Compile the user callback interface to coordinate actionlists.

Supplement: vizster is a prefuse-built visualization of online social network services such as Friendster and Orkut.

Vizster is also an online social network visualization software developed based on prefuse.

Let's take a look at the display effects of the two prefuse built-in demos:

 

In summary, we can find that processing is simple and flexible. You only need a few lines of code to draw beautiful images. It focuses more on artistic effects, such as 3D effects and lighting angles;

Prefuse features higher flexibility, smaller API granularity, and convenient operation. It also has multiple built-in layout methods, such as force-directed layout, tree layout, and grid layout.

If you need to reprint please indicate the source: http://www.cnblogs.com/bigdataZJ/p/VisualizationSoloShow2.html

 

Visualization tool solo show ----- processing prefuse show

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.