Package org.jfree.chart.title

Examples of org.jfree.chart.title.LegendTitle


public class LegendPanel extends JPanel {
 
  private LegendTitle legend;
 
  public LegendPanel(LegendItemSource source) {
    this.legend = new LegendTitle(source);
        legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
        legend.setFrame(new LineBorder());
        legend.setBackgroundPaint(Color.white);
        legend.setPosition(RectangleEdge.BOTTOM);       
    setPreferredSize(new Dimension(1024, 35));
View Full Code Here


    //gets first legend in the list
    public LegendTitle getLegend()
    {
      //i need to find the legend now.
      LegendTitle legend = null;
      List subTitles = chart.getSubtitles();
      Iterator iter = subTitles.iterator();
      while (iter.hasNext())
      {
        Object o = iter.next();
View Full Code Here

      chart.setBorderVisible(borderVisible);;
      chart.getPlot().setOutlineVisible(plotBorderVisible);;

            if (showLegend) {
                LegendTitle legend = this.getLegend();
                switch (legendAnchor)
                {
                    case TaglibConstants.ANCHOR_NORTH :
                        legend.setPosition(RectangleEdge.TOP);
                        break;
                    case TaglibConstants.ANCHOR_WEST :
            legend.setPosition(RectangleEdge.LEFT);
                        break;
                    case TaglibConstants.ANCHOR_EAST :
            legend.setPosition(RectangleEdge.RIGHT);
                        break;
                    default :
            legend.setPosition(RectangleEdge.BOTTOM);
                }
            } else {
              this.removeLegend();
            }
View Full Code Here

            TextTitle tt = (TextTitle) title;
            tt.setFont(this.largeFont);
            tt.setPaint(this.subtitlePaint);
        }
        else if (title instanceof LegendTitle) {
            LegendTitle lt = (LegendTitle) title;
            if (lt.getBackgroundPaint() != null) {
                lt.setBackgroundPaint(this.legendBackgroundPaint);
            }
            lt.setItemFont(this.regularFont);
            lt.setItemPaint(this.legendItemPaint);
            if (lt.getWrapper() != null) {
                applyToBlockContainer(lt.getWrapper());
            }
        }
        else if (title instanceof PaintScaleLegend) {
            PaintScaleLegend psl = (PaintScaleLegend) title;
            psl.setBackgroundPaint(this.legendBackgroundPaint);
View Full Code Here

        // return a new chart containing the overlaid plot...
        JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
                JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
        chart.setBackgroundPaint(Color.white);
        LegendTitle legend = new LegendTitle(cplot);
        chart.addSubtitle(legend);
        return chart;
    }
View Full Code Here

        }
        catch (Exception e) {
            e.printStackTrace();
        }
        assertEquals(c1, c2);
        LegendTitle lt2 = c2.getLegend();
        assertTrue(lt2.getSources()[0] == c2.getPlot());
    }
View Full Code Here

        DefaultPieDataset dataset = new DefaultPieDataset();
        JFreeChart chart = ChartFactory.createPieChart("title", dataset, true,
                false, false);
        chart.addChangeListener(this);
        this.lastChartChangeEvent = null;
        LegendTitle legend = chart.getLegend();
        legend.setPosition(RectangleEdge.TOP);
        assertNotNull(this.lastChartChangeEvent);
    }
View Full Code Here

        this.subtitles = new ArrayList();

        // create a legend, if requested...
        if (createLegend) {
            LegendTitle legend = new LegendTitle(this.plot);
            legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
            legend.setFrame(new LineBorder());
            legend.setBackgroundPaint(Color.white);
            legend.setPosition(RectangleEdge.BOTTOM);
            this.subtitles.add(legend);
            legend.addChangeListener(this);
        }

        // add the chart title, if one has been specified...
        if (title != null) {
            if (titleFont == null) {
View Full Code Here

        // return a new chart containing the overlaid plot...
        JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
                JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
        chart.setBackgroundPaint(Color.white);
        LegendTitle legend = new LegendTitle(cplot);
        chart.addSubtitle(legend);
        return chart;
    }
View Full Code Here

        }
        catch (Exception e) {
            e.printStackTrace();
        }
        assertEquals(c1, c2);
        LegendTitle lt2 = c2.getLegend();
        assertTrue(lt2.getSources()[0] == c2.getPlot());
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.title.LegendTitle

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.