Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.StandardPieItemLabelGenerator


    public void processChart(Object chart, Map params) {
        PiePlot plot = (PiePlot) ((JFreeChart) chart).getPlot();

        plot.setBackgroundAlpha(0.7f);
        plot.setLabelGenerator(new StandardPieItemLabelGenerator(
                "{0}: {1} [ {2} ]"));

        setSectionPaints(COLORS, plot);

    }
View Full Code Here


        if (dataset instanceof EnhancedJDBCPieDataset) {
            EnhancedJDBCPieDataset ds = (EnhancedJDBCPieDataset) dataset;
            spilg = ds.getLabelGenerator();

            if (spilg == null) {
                spilg = new StandardPieItemLabelGenerator("{0}: {2} [ {1} ]");
                ((StandardPieItemLabelGenerator) spilg).getPercentFormat()
                        .setMinimumFractionDigits(2);
            }

        }
View Full Code Here

    /**
     * Test that the equals() method distinguishes all fields.
     */
    public void testEquals() {
        StandardPieItemLabelGenerator g1 = new StandardPieItemLabelGenerator();
        StandardPieItemLabelGenerator g2 = new StandardPieItemLabelGenerator();
        assertTrue(g1.equals(g2));
        assertTrue(g2.equals(g1));
       
        g1 = new StandardPieItemLabelGenerator(
            "{0}", new DecimalFormat("#,##0.00"), NumberFormat.getPercentInstance()
        );
        assertFalse(g1.equals(g2));
        g2 = new StandardPieItemLabelGenerator(
            "{0}", new DecimalFormat("#,##0.00"), NumberFormat.getPercentInstance()
        );
        assertTrue(g1.equals(g2));
    }
View Full Code Here

   
    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        StandardPieItemLabelGenerator g1 = new StandardPieItemLabelGenerator();
        StandardPieItemLabelGenerator g2 = null;
        try {
            g2 = (StandardPieItemLabelGenerator) g1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("StandardPieItemLabelGeneratorTests.testCloning: failed to clone.");
        }
        assertTrue(g1 != g2);
        assertTrue(g1.getClass() == g2.getClass());
        assertTrue(g1.equals(g2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        StandardPieItemLabelGenerator g1 = new StandardPieItemLabelGenerator();
        StandardPieItemLabelGenerator g2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(g1);
View Full Code Here

            Comparable currentKey = (Comparable) sectionKeys.get(sectionIndex);
            if (info != null) {
                EntityCollection entities = info.getOwner().getEntityCollection();
                if (entities != null) {
                    if (getToolTipGenerator() == null) {
                        setToolTipGenerator(new StandardPieItemLabelGenerator());
                    }
                    String tip = getToolTipGenerator().generateToolTip(dataset, currentKey);
                    String url = null;
                    if (getURLGenerator() != null) {
                        url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex());
View Full Code Here

        assertFalse(plot1.equals(plot2));
        plot2.setExplodePercent(3, 0.33);
        assertTrue(plot1.equals(plot2));
       
        // labelGenerator
        plot1.setLabelGenerator(new StandardPieItemLabelGenerator("{2}{1}{0}"));
        assertFalse(plot1.equals(plot2));
        plot2.setLabelGenerator(new StandardPieItemLabelGenerator("{2}{1}{0}"));
        assertTrue(plot1.equals(plot2));
      
        // labelFont
        Font f = new Font("SansSerif", Font.PLAIN, 20);
        plot1.setLabelFont(f);
        assertFalse(plot1.equals(plot2));
        plot2.setLabelFont(f);
        assertTrue(plot1.equals(plot2));
       
        // labelPaint
        plot1.setLabelPaint(Color.blue);
        assertFalse(plot1.equals(plot2));
        plot2.setLabelPaint(Color.blue);
        assertTrue(plot1.equals(plot2));
       
        // maximumLabelWidth
        plot1.setMaximumLabelWidth(0.33);
        assertFalse(plot1.equals(plot2));
        plot2.setMaximumLabelWidth(0.33);
        assertTrue(plot1.equals(plot2));
       
        // labelGap
        plot1.setLabelGap(0.11);
        assertFalse(plot1.equals(plot2));
        plot2.setLabelGap(0.11);
        assertTrue(plot1.equals(plot2));
       
        // linkMargin
        plot1.setLabelLinkMargin(0.11);
        assertFalse(plot1.equals(plot2));
        plot2.setLabelLinkMargin(0.11);
        assertTrue(plot1.equals(plot2));

        // labelLinkPaint
        plot1.setLabelLinkPaint(Color.red);
        assertFalse(plot1.equals(plot2));
        plot2.setLabelLinkPaint(Color.red);
        assertTrue(plot1.equals(plot2));
      
        // labelLinkStroke
        plot1.setLabelLinkStroke(new BasicStroke(1.0f));
        assertFalse(plot1.equals(plot2));
        plot2.setLabelLinkStroke(new BasicStroke(1.0f));
        assertTrue(plot1.equals(plot2));
      
        // toolTipGenerator
        plot1.setToolTipGenerator(new StandardPieItemLabelGenerator("{2}{1}{0}"));
        assertFalse(plot1.equals(plot2));
        plot2.setToolTipGenerator(new StandardPieItemLabelGenerator("{2}{1}{0}"));
        assertTrue(plot1.equals(plot2));
       
        // urlGenerator
        plot1.setURLGenerator(new StandardPieURLGenerator("xx"));
        assertFalse(plot1.equals(plot2));
View Full Code Here

                                            boolean legend,
                                            boolean tooltips,
                                            boolean urls) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieItemLabelGenerator());
        plot.setInsets(new Insets(0, 5, 5, 5));
        if (tooltips) {
            plot.setToolTipGenerator(
                new StandardPieItemLabelGenerator(
                    StandardPieItemLabelGenerator.DEFAULT_SECTION_LABEL_FORMAT
                )
            );
        }
        if (urls) {
View Full Code Here

                                            boolean urls,
                                            boolean subTitle,
                                            boolean showDifference) {

        PiePlot plot = new PiePlot(dataset);
        plot.setLabelGenerator(new StandardPieItemLabelGenerator());
        plot.setInsets(new Insets(0, 5, 5, 5));

        if (tooltips) {
            plot.setToolTipGenerator(
                new StandardPieItemLabelGenerator(
                    StandardPieItemLabelGenerator.DEFAULT_SECTION_LABEL_FORMAT
                )
            );
        }
        if (urls) {
View Full Code Here

        plot.setDataExtractOrder(order);
        plot.setBackgroundPaint(null);
        plot.setOutlineStroke(null);

        if (tooltips) {
            PieToolTipGenerator tooltipGenerator = new StandardPieItemLabelGenerator();
            PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
            pp.setToolTipGenerator(tooltipGenerator);
        }

        if (urls) {
View Full Code Here

TOP

Related Classes of org.jfree.chart.labels.StandardPieItemLabelGenerator

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.