Package prefuse

Examples of prefuse.Visualization


    // add state function to the FunctionTable
    static { FunctionTable.addFunction("STATE", StateLookupFunction.class); }
   
   
    public ZipDecode(final Table t) {
        super(new Visualization());
       
        // this predicate makes sure only the continental states are included
        Predicate filter = (Predicate)ExpressionParser.parse(
                "state >= 1 && state <= 56 && state != 2 && state != 15");
        VisualTable vt = m_vis.addTable(DATA, t, filter, getDataSchema());
View Full Code Here


   
    public GraphView(Graph g, String label) {
      super(new BorderLayout());
     
        // create a new, empty visualization for our data
        m_vis = new Visualization();
       
        // --------------------------------------------------------------------
        // set up the renderers
       
        LabelRenderer tr = new LabelRenderer();
View Full Code Here

    }
   
    public static JComponent demo(Graph g, String label) {

        // create a new, empty visualization for our data
        final Visualization vis = new Visualization();
        VisualGraph vg = vis.addGraph(graph, g);
        vis.setValue(edges, null, VisualItem.INTERACTIVE, Boolean.FALSE);
       
        TupleSet focusGroup = vis.getGroup(Visualization.FOCUS_ITEMS);
        focusGroup.addTupleSetListener(new TupleSetListener() {
            public void tupleSetChanged(TupleSet ts, Tuple[] add, Tuple[] rem)
            {
                for ( int i=0; i<rem.length; ++i )
                    ((VisualItem)rem[i]).setFixed(false);
                for ( int i=0; i<add.length; ++i ) {
                    ((VisualItem)add[i]).setFixed(false);
                    ((VisualItem)add[i]).setFixed(true);
                }
                vis.run("draw");
            }
        });
       
        // set up the renderers
        LabelRenderer tr = new LabelRenderer(label);
        tr.setRoundedCorner(8, 8);
        vis.setRendererFactory(new DefaultRendererFactory(tr));
       
      
       
        // -- set up the actions ----------------------------------------------
       
        int maxhops = 4, hops = 4;
        final GraphDistanceFilter filter = new GraphDistanceFilter(graph, hops);

        ActionList draw = new ActionList();
        draw.add(filter);
        draw.add(new ColorAction(nodes, VisualItem.FILLCOLOR, ColorLib.rgb(200,200,255)));
        draw.add(new ColorAction(nodes, VisualItem.STROKECOLOR, 0));
        draw.add(new ColorAction(nodes, VisualItem.TEXTCOLOR, ColorLib.rgb(0,0,0)));
        draw.add(new ColorAction(edges, VisualItem.FILLCOLOR, ColorLib.gray(200)));
        draw.add(new ColorAction(edges, VisualItem.STROKECOLOR, ColorLib.gray(200)));
       
        ColorAction fill = new ColorAction(nodes,
                VisualItem.FILLCOLOR, ColorLib.rgb(200,200,255));
        fill.add("_fixed", ColorLib.rgb(255,100,100));
        fill.add("_highlight", ColorLib.rgb(255,200,125));
       
        ForceDirectedLayout fdl = new ForceDirectedLayout(graph);
        ForceSimulator fsim = fdl.getForceSimulator();
        fsim.getForces()[0].setParameter(0, -1.2f);
       
        ActionList animate = new ActionList(Activity.INFINITY);
        animate.add(fdl);
        animate.add(fill);
        animate.add(new RepaintAction());
       
        // finally, we register our ActionList with the Visualization.
        // we can later execute our Actions by invoking a method on our
        // Visualization, using the name we've chosen below.
        vis.putAction("draw", draw);
        vis.putAction("layout", animate);
        vis.runAfter("draw", "layout");
       
       
        // --------------------------------------------------------------------
        // STEP 4: set up a display to show the visualization
       
        Display display = new Display(vis);
        display.setSize(500,500);
        display.setForeground(Color.GRAY);
        display.setBackground(Color.WHITE);
       
        // main display controls
        display.addControlListener(new FocusControl(1));
        display.addControlListener(new DragControl());
        display.addControlListener(new PanControl());
        display.addControlListener(new ZoomControl());
        display.addControlListener(new WheelZoomControl());
        display.addControlListener(new ZoomToFitControl());
        display.addControlListener(new NeighborHighlightControl());
       
        display.setForeground(Color.GRAY);
        display.setBackground(Color.WHITE);
       
        // --------------------------------------------------------------------       
        // STEP 5: launching the visualization
       
        // create a panel for editing force values
        final JForcePanel fpanel = new JForcePanel(fsim);
       
        final JValueSlider slider = new JValueSlider("Distance", 0, maxhops, hops);
        slider.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                filter.setDistance(slider.getValue().intValue());
                vis.run("draw");
            }
        });
        slider.setBackground(Color.WHITE);
        slider.setPreferredSize(new Dimension(300,30));
        slider.setMaximumSize(new Dimension(300,30));
View Full Code Here

    private AggregateTable m_agg;
    private VisualTable m_items;
   
    protected void setUp() throws Exception {
        Visualization v = new Visualization();
        m_items = v.addTable("items", TableTest.getTestCaseTable());
       
        m_agg = v.addAggregates("aggregates", VisualItem.SCHEMA);
        m_agg.addRow();
        m_agg.addRow();
       
        Iterator iter = m_items.tuples();
        for ( int i=0, count=m_items.getRowCount(); iter.hasNext(); ++i ) {
View Full Code Here

    private Node m_n0;
    private VisualItem m_vt0;
    private NodeItem m_vn0;
   
    public void setUp() {
        m_vis = new Visualization();
        m_t = TableTest.getTestCaseTable();
        m_g = GraphTest.getTestCaseGraph();
       
        m_t0 = m_t.getTuple(0);
        m_n0 = m_g.getNode(0);
View Full Code Here

    /**
     * Runs this Action (as an Activity). Called by the Activity super-class.
     * @see prefuse.activity.Activity#run(long)
     */
    protected void run(long elapsedTime) {
        Visualization vis = getVisualization();
        if ( vis != null ) {
            synchronized (vis) {
                run(getPace(elapsedTime));
            }
        } else {
View Full Code Here

            public boolean getBoolean(Tuple t) {
                return t.getFloat(HEADERS[3]) < thresh;
            }
        };
       
        Visualization vis = new Visualization();
        VisualTable vt = new VisualTable(t, vis, "data", p);
       
        for ( int i=0, r=0; i<NROWS; ++i ) {
            float val = ((Float)TABLE[3][i]).floatValue();
            if ( val < thresh ) {
View Full Code Here

    private EdgeRenderer m_edgeRenderer;
   
    private String m_label = "label";
   
    public RadialGraphView(Graph g, String label) {
        super(new Visualization());
        m_label = label;

        // -- set up visualization --
        m_vis.add(tree, g);
        m_vis.setInteractive(treeEdges, null, false);
View Full Code Here

    }
   
    public static JPanel demo(Graph g, final String label) {       
        // create a new radial tree view
        final RadialGraphView gview = new RadialGraphView(g, label);
        Visualization vis = gview.getVisualization();
       
        // create a search panel for the tree map
        SearchQueryBinding sq = new SearchQueryBinding(
             (Table)vis.getGroup(treeNodes), label,
             (SearchTupleSet)vis.getGroup(Visualization.SEARCH_ITEMS));
        JSearchPanel search = sq.createSearchPanel();
        search.setShowResultCount(true);
        search.setBorder(BorderFactory.createEmptyBorder(5,5,4,0));
        search.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 11));
       
View Full Code Here

* @author <a href="http://jheer.org">jeffrey heer</a>
*/
public class DataMountain extends Display {
   
    public DataMountain(Table t) {
        super(new Visualization());
        m_vis.addTable("data", t);
       
        LabelRenderer nodeRenderer = new LabelRenderer(null, "image");
        nodeRenderer.setTextField(null);
        nodeRenderer.setVerticalAlignment(Constants.BOTTOM);
View Full Code Here

TOP

Related Classes of prefuse.Visualization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.