Package infovis.tree.visualization

Examples of infovis.tree.visualization.TreemapVisualization


            TreeReaderFactory.createTreeReader(fileName, t);
        if (reader == null || !reader.load()) {
            System.err.println("cannot load " + fileName);
        }

        TreemapVisualization visualization =
            new TreemapVisualization(t, null);
           
        JSplitPane split = ControlPanelFactory.createScrollVisualization(
                visualization);
        JFrame frame = new JFrame(fileName);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
View Full Code Here


        }
        final DefaultTree tree = new DefaultTree();
        System.out.println("Reading " + inputFile);
        AbstractReader reader =
            TreeReaderFactory.createTreeReader(inputFile, tree);
        TreemapVisualization visualization =
            new TreemapVisualization(tree, Strip.instance);
        if (reader != null && reader.load()) {
            System.out.println("Done.");
            for (Iterator iter = visual.keySet().iterator();
                iter.hasNext();
                ) {
                String key = (String) iter.next();
                String value = (String) visual.get(key);
                visualization.setVisualColumn(
                    key,
                    tree.getColumn(value));
            }
            final Column order = visualization.getVisualColumn("sort");
            final Column size = visualization.getVisualColumn(Visualization.VISUAL_SIZE);
            Permutation perm = visualization.getPermutation();
            perm.sort(new RowComparator() {
                public int compare(int row1, int row2) {
                    if (tree.isLeaf(row1) && tree.isLeaf(row2)) {
                        return size.compare(row1, row2);
                    }
                    else {
                        return order.compare(row1, row2);
                    }
                }

                public boolean isValueUndefined(int row) {
                    return order.isValueUndefined(row);
                }
            });
            visualization.setPermutation(perm);
            System.out.println("Rendering " + inputFile);
            Rectangle bounds = new Rectangle(0, 0, width, height);
            BufferedImage image =
                new BufferedImage(
                    width,
                    height,
                    BufferedImage.TYPE_INT_RGB);
            Graphics2D g2d = (Graphics2D) image.getGraphics();
            visualization.paint(g2d, bounds);
            try {
                System.out.println("Done.\nSaving to " + outputFile);
                ImageIO.write(image, "png", new File(outputFile));
                System.out.println("Done.");
            }
View Full Code Here

TOP

Related Classes of infovis.tree.visualization.TreemapVisualization

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.