當前位置: 首頁>>代碼示例>>Java>>正文


Java LegendTitle.setMargin方法代碼示例

本文整理匯總了Java中org.jfree.chart.title.LegendTitle.setMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java LegendTitle.setMargin方法的具體用法?Java LegendTitle.setMargin怎麽用?Java LegendTitle.setMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.title.LegendTitle的用法示例。


在下文中一共展示了LegendTitle.setMargin方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
public static LegendTitle createLegend() {
  final LegendItemCollection legendItems = new LegendItemCollection();
  FontRenderContext frc = new FontRenderContext(null, true, true);
  Font legenfont = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
  GlyphVector gv = legenfont.createGlyphVector(frc, new char[] {'I', 'I'});
  Shape shape = gv.getVisualBounds();
  Rectangle2D bounds = shape.getBounds2D();
  {
    LegendItem li = new LegendItem("Standard error", null, null, null,
        new ErrorIndicator(bounds), new BasicStroke(), ErrorIndicator.ERROR_INDICATOR_COLOR);
    li.setLabelFont(legenfont);
    legendItems.add(li);
  }
  LegendTitle legend = new LegendTitle(new LegendItemSource() {
    @Override
    public LegendItemCollection getLegendItems() {
      return legendItems;
    }});
  legend.setPosition(RectangleEdge.BOTTOM);
  legend.setMargin(new RectangleInsets(0,30,0,0));
  legend.setPadding(RectangleInsets.ZERO_INSETS);
  legend.setLegendItemGraphicPadding(new RectangleInsets(0,20,0,0));
  legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
  return legend;
}
 
開發者ID:uq-eresearch,項目名稱:aorra,代碼行數:26,代碼來源:ErrorIndicatorLegend.java

示例2: setLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void setLegend(JFreeChart chart, Plot plot, Font font) {
	if(!showlegend) return;
		
		
	Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor;
	if(font==null)font=getFont();
	
	
	
	LegendTitle legend = legendMultiLine?
       		new LegendTitle(plot,new ColumnArrangement(), new ColumnArrangement()):
       		new LegendTitle(plot);
       legend.setBackgroundPaint(bg);
       legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
       legend.setFrame(new LineBorder());
       legend.setPosition(RectangleEdge.BOTTOM);
       legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
       
       legend.setWidth(chartwidth-20);// geht nicht
       legend.setItemFont(font);
	legend.setItemPaint(foregroundcolor);

	//RectangleInsets labelPadding;
	legend.setItemLabelPadding(new RectangleInsets(2,2,2,2));
	legend.setBorder(0,0,0,0); 
	legend.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
	legend.setLegendItemGraphicPadding(new RectangleInsets(8,10,0,0));
	chart.addLegend(legend);
	
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:31,代碼來源:Chart.java

示例3: createBarChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private static JFreeChart createBarChart(ADCDataset dataset) {
    AutoSubCategoryAxis categoryAxis = new AutoSubCategoryAxis(dataset);
    categoryAxis.setCategoryLabelPositionOffset(0);
    categoryAxis.setLabel(dataset.get(Attribute.X_AXIS_LABEL));
    CategoryDataset fixedDataset = categoryAxis.getFixedDataset();
    PartitionedNumberAxis vAxis = new PartitionedNumberAxis(
        dataset.get(Attribute.Y_AXIS_LABEL));
    CategoryPlot plot = new CategoryPlot(fixedDataset,
            categoryAxis, vAxis, new Renderer(fixedDataset));
    plot.setOrientation(PlotOrientation.VERTICAL);
    JFreeChart chart = new JFreeChart(dataset.get(Attribute.TITLE),
        JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    final LegendItemCollection items = new LegendItemCollection();
    for(Condition c : Condition.values()) {
        if(c != Condition.NOT_EVALUATED) {
            items.add(new LegendItem(c.getLabel(), null, null, null,
                    new Rectangle2D.Double(-6.0, -6.0, 10.0,10.0), c.getColor()));
        }
    }
    LegendTitle legend = new LegendTitle(new LegendItemSource() {
        @Override
        public LegendItemCollection getLegendItems() {
            return items;
        }});
    legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
    legend.setBackgroundPaint(Color.white);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addLegend(legend);
    new StandardChartTheme("JFree").apply(chart);
    return chart;
}
 
開發者ID:uq-eresearch,項目名稱:aorra,代碼行數:32,代碼來源:PSIIMaxHeq.java

示例4: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The 
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.  
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range 
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title 
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data 
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should   
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot, 
                  boolean createLegend) {

    if (plot == null) {
        throw new NullPointerException("Null 'plot' argument.");
    }

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the 
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING, 
            RenderingHints.VALUE_ANTIALIAS_ON);

    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;
    
    this.plot = plot;
    plot.addChangeListener(this);

    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);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:72,代碼來源:JFreeChart.java

示例5: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    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) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:75,代碼來源:JFreeChart.java

示例6: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The
 * {@code createLegend} argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param titleFont  the font for displaying the chart title
 *                   ({@code null} permitted).
 * @param plot  controller of the visual representation of the data
 *              ({@code null} not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    Args.nullNotPermitted(plot, "plot");
    this.id = null;
    plot.setChart(this);
    
    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.BLACK;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    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.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) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:75,代碼來源:JFreeChart.java

示例7: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    if (plot == null) {
        throw new NullPointerException("Null 'plot' argument.");
    }

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);

    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    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) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:73,代碼來源:JFreeChart.java

示例8: setLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void setLegend(JFreeChart chart, boolean bShowLegend, Font font, Color foregroundColor, Color backgroundColor, cfCHARTLEGENDData legendData) throws cfmRunTimeException {
	LegendTitle legend = new LegendTitle(chart.getPlot());
	legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));

	// If a CFCHARTLEGEND tag was used then use it's attributes to configure the
	// legend
	if (legendData != null) {
		// A CFCHARTLEGEND tag is present so use its attributes to configure the
		// legend
		legend.setItemFont(getFont(legendData.getFont(), legendData.getFontBold(), legendData.getFontItalic(), legendData.getFontSize()));
		legend.setItemPaint(convertStringToColor(legendData.getLabelColor()));
		legend.setBackgroundPaint(convertStringToColor(legendData.getBackgroundColor()));

		String pos = legendData.getPosition();
		if (pos.equals("top"))
			legend.setPosition(RectangleEdge.TOP);
		else if (pos.equals("bottom"))
			legend.setPosition(RectangleEdge.BOTTOM);
		else if (pos.equals("left"))
			legend.setPosition(RectangleEdge.LEFT);
		else if (pos.equals("right"))
			legend.setPosition(RectangleEdge.RIGHT);

		if (!legendData.getShowBorder())
			legend.setBorder(BlockBorder.NONE);
		else
			legend.setBorder(new BlockBorder());
	} else {
		// A CFCHARTLEGEND tag is NOT present so use the attributes from the
		// CFCHART tag to configure the legend
		if (!bShowLegend)
			return;

		legend.setItemFont(font);
		legend.setItemPaint(foregroundColor);
		legend.setBackgroundPaint(backgroundColor);

		// By default CFMX 7 places the legend at the top with no border
		legend.setPosition(RectangleEdge.TOP);
		legend.setBorder(BlockBorder.NONE);
	}

	// Add the legend to the chart
	chart.addSubtitle(legend);
}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:46,代碼來源:cfCHART.java

示例9: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The 
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.  
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range 
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title 
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data 
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should   
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot, 
                  boolean createLegend) {

    if (plot == null) {
        throw new NullPointerException("Null 'plot' argument.");
    }

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the 
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING, 
            RenderingHints.VALUE_ANTIALIAS_ON);

    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;
    
    this.plot = plot;
    plot.addChangeListener(this);

    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.setBorder(new BlockBorder());
        legend.setBackgroundPaint(Color.white);
        legend.setPosition(RectangleEdge.BOTTOM);
        this.subtitles.add(legend);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:opensim-org,項目名稱:opensim-gui,代碼行數:72,代碼來源:JFreeChart.java

示例10: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot. The <code>createLegend</code> argument specifies whether or
 * not a legend should be added to the chart. <br>
 * <br>
 * Note that the {@link ChartFactory} class contains a range of static methods that will return ready-made charts,
 * and often this is a more convenient way to create charts than using this constructor.
 * 
 * @param title the chart title (<code>null</code> permitted).
 * @param titleFont the font for displaying the chart title (<code>null</code> permitted).
 * @param plot controller of the visual representation of the data (<code>null</code> not permitted).
 * @param createLegend a flag indicating whether or not a legend should be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot, boolean createLegend) {

	ParamChecks.nullNotPermitted(plot, "plot");

	// create storage for listeners...
	this.progressListeners = new EventListenerList();
	this.changeListeners = new EventListenerList();
	this.notify = true; // default is to notify listeners when the
						// chart changes

	this.renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	this.borderVisible = false;
	this.borderStroke = new BasicStroke(1.0f);
	this.borderPaint = Color.black;

	this.padding = RectangleInsets.ZERO_INSETS;

	this.plot = plot;
	plot.addChangeListener(this);

	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) {
			titleFont = DEFAULT_TITLE_FONT;
		}
		this.title = new TextTitle(title, titleFont);
		this.title.addChangeListener(this);
	}

	this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

	this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
	this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
	this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:hongliangpan,項目名稱:manydesigns.cn,代碼行數:63,代碼來源:JFreeChart.java

示例11: createPanel

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new monitor panel.
 *
 * @return the monitor panel
 */
public JPanel createPanel() {

    JPanel mainPanel = new JPanel(new BorderLayout());
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
    this.datasets = new TimeSeriesCollection[4];
    this.datasets[0] = addSubPlot(plot, "#Tiles");
    this.datasets[1] = addSubPlot(plot, "#Hits");
    this.datasets[2] = addSubPlot(plot, "#Misses");
    this.datasets[3] = addSubPlot(plot, "Mem (kB)");

    JFreeChart chart = new JFreeChart(plot);
    LegendTitle legend = (LegendTitle) chart.getSubtitle(0);
    legend.setPosition(RectangleEdge.RIGHT);
    legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4));
    chart.setBorderPaint(Color.black);
    chart.setBorderVisible(true);
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0);  // 60 seconds

    textarea = new JTextArea();
    tableModel = new TileCacheTableModel();
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 470));
    chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    tabbedPane = new JTabbedPane();
    tabbedPane.add(CACHE_INFO_TAB, new JScrollPane(textarea));
    tabbedPane.add(CACHE_CHART_TAB, chartPanel);
    tabbedPane.add(IMAGES_TAB, new JScrollPane(new JTable(tableModel)));
    tabbedPane.setSelectedIndex(0);

    mainPanel.add(tabbedPane);

    return mainPanel;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:48,代碼來源:TileCacheMonitor.java

示例12: JFreeChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);

    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    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) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
開發者ID:pablopatarca,項目名稱:proyecto-teoria-control-utn-frro,代碼行數:71,代碼來源:JFreeChart.java


注:本文中的org.jfree.chart.title.LegendTitle.setMargin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。