Flare
- 格式:doc
- 大小:35.50 KB
- 文档页数:2
Flare Introduction1.Flare is a third-party Flex library for data visualization. It’s an open-source software underBSD license, so we can use and modify it freely even for commercial purpose. Flare's design was adapted from its predecessor prefuse, a visualization toolkit for Java.2.Flare src on svn: yoda\opbook\src\modules\apps_framework\src\prefuse3.Website of flare: /4.Note its development on github is inactive now. The latest released version is at 2009.01.24.The src on our svn is a modified version by Engkee based on initial check-in. Refer to svn log for details of change history.5.Top level PX UI code (top->bottom)ProcessViewInfo->LayoutFrame->NetworkMapTile->NetworkMapTileRenderer-|>FlareLayoutTileRenderer->FlareLayoutComponent<|-BasicTreeGraph6.Flare Core ObjectsVisualizationDataDataSprite/NodeSprite/EdgeSprite7.Flare tutorial: /tutorialOverview of the flare libraryHere is a quick overview of the flare toolkit. Inside the flare project, look inside the “src/flare”folder. You'll find a number of packages providing different features:analytics: operators for computing statistics and analyzing dataanimate: tools for creating animationsdata: methods for reading and writing data setsdisplay: DisplayObject types that extend those provided by flash.displayflex: a wrapper for embedding Flare visualizations in Flex applicationsphysics: a physics engine for physical effects or force-directed layoutquery: a query processor for ActionScript objectsscale: classes for handling data scales, such as linear, log, and time scalesutil: a set of utility classes providing commonly needed functionsvis: the flare visualization components and operatorsCreating and Managing Visual ObjectsNow we would like to visualize a data set. To do this, we map individual data records into visual items. Flare provides a set of visual objects to represent the data. Here's an overview of the basic classes provided by the flare.vis.data package.DataSprite: Base class for sprites that visually represent data. DataSprite is a subclass of the Flash Player's Sprite class. DataSprite includes a data property where the data tuple(an ActionScript Object) is stored and also provides additional visual variables beyondthose supported by basic sprites, including color, shape, and size fields, and support forsetting positions in polar coordinates.NodeSprite: DataSprite instance representing a node. This is the default type used forvisualizing data. NodeSprite instances can be connected within network or tree structures by EdgeSprite instances.EdgeSprite: DataSprite instance representing an edge. An EdgeSprite connects two NodeSprites. The nodes are accessible throughthe source and targetproperties. EdgeSprites are used to create graphs and trees, as wellas to represent lines, such as in time-series graphs.Loading DataNote our data would be dynamically changed.Typically, NodeSprites and EdgeSprites are created and stored in theflare.vis.data.Data class, which manages all the visual items for a single visualization. The Data class provides methods for creating new visual objects for data tuples and for representing a graph structure.The Data class also provides methods for traversing and updating the contained data items.The nodes and edges properties return lists of the nodes and edges contained within the data.Each of these lists includes a visit method that allows you to pass in a function that will then be called with each node or edge. Also, thesetProperty and setProperties methods allow you to set property values for all nodes or edges at once. These methods optionally takea Transitioner as an argument, so you can animate the property update.To actually create node and edges objects, we use the addNode and addEdgeFormethods.addNode: takes an input data tuple (an Object) and creates a new NodeSprite for visualizing that data.addEdgeFor: takes two existing NodeSprites and adds an EdgeSprite connecting them.The method also optionally excepts a data tuple (again, an Objectrepresenting any datafields) for the edge.Constructing a VisualizationNow let's put this all together to start making visualizations. The Visualizationclass representsa single visualization, including visual marks (stored in a Datainstance) and axes. To create avisualization, we load a data set, add the data to a visualization, and set up operators that determine how to visualize the data.8.Flare Sample: /apps/index9.Flare API doc: /api/。