Flare does not need to write the graphml file in the JSP file and then read the file in the as file.

Source: Internet
Author: User

Package {
Import flare. animate. transitioner;
Import flare. Scale. scaletype;
Import flare. util. palette. colorpalette;
Import flare. util. palette. shapepalette;
Import flare. Vis. Visualization;
Import flare. Vis. Controls. clickcontrol;
Import flare. Vis. data. Data;
Import flare. Vis. Data. edgesprite;
Import flare. Vis. Data. nodesprite;
Import flare. Vis. Operator. encoder. colorencoder;
Import flare. Vis. Operator. encoder. shapeencoder;
Import flare. Vis. Operator. encoder. sizeencoder;
Import flare. Vis. Operator. layout. axislayout;

Import flash. display. Sprite;
Import flash. Events. event;
Import flash. Geom. rectangle;
[SWF (width = "500", Height = "400", backgroundcolor = "# ffffff", framerade = "30")]
Public class flare_axislayout extends Sprite
{
Public Function flare_axislayout ()
{
VaR data: array = [{X: 25, Y: 23, sex: "male", age: 29}, {X: 32, Y: 58, sex: "female", age: 29}];
VaR visual: Visualization = new visualization (data. fromarray (data ));
VaR axis: axislayout = new axislayout ("data. X", "data. Y ");
Visual. bounds = new rectangle (50, 50, 400,300 );
Visual. Operators. Add (axis );
// Set the axis style;
Visual. xyaxes. xaxis. linecolor = 0xff0000;
// Add nodes to axis;
VaR node1: nodesprite = visual. Data. addnode ({X: 35, Y: 43, sex: "female", age: 10 });
VaR node2: nodesprite = visual. Data. addnode ({X: 12, Y: 27, sex: "unknow", age: 2 });
VaR edge: edgesprite = new edgesprite (node1, node2, false );
Visual. Data. addedge (edge );


// Add event listener to visual; Note: no nodes;
VaR CLICK: clickcontrol = new clickcontrol (null, 1, clickhandler );
Visual. Controls. Add (click );

VaR colorpalette: colorpalette = new colorpalette ([0xffff0000, 0xff00ff00, 0xff0000ff], [0 xffaaaaaa, 0xff000000]);
VaR shapepalette: shapepalette = new shapepalette ();
// Add color style to nodes;
// Palette: You just selected color from palette;

VaR color: colorencoder = new colorencoder ("data. Sex", Data. nodes, "fillcolor", scaletype. Categories, colorpalette );
Visual. Operators. Add (color );
// Add shape style to nodes;
VaR shape: shapeencoder = new shapeencoder ("data. Sex ");
Visual. Operators. Add (SHAPE );
// Add properties to nodes and edges;
VaR T: transitioner = new transitioner (3 );


Visual. Data. nodes. setproperty ("linecolor", 0xffff0000, t );
Visual. Data. nodes. setproperty ("linewidth", 2, T );
Visual. Data. edges. setproperty ("linewidth", 2, T );
Visual. Data. edges. setproperty ("linecolor", 0xffff0000, t );
T. Play ();
// According to age property set the size style;
VaR size: sizeencoder = new sizeencoder ("data. Age ");
Visual. Operators. Add (size );
//

This. addchild (visual );
Visual. Update ();
}
Private function clickhandler (EVT: Event): void {
Trace ("click ")
}
}
}

Related Article

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.