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


Java LegendTitle.setPosition方法代碼示例

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


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

示例1: legendPositionChanged

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void legendPositionChanged(LegendPosition legendPosition) {
	JFreeChart chart = getCurrentChart();
	if (chart != null) {
		LegendTitle legend = chart.getLegend();
		RectangleEdge position = legendPosition.getPosition();
		if (legend != null) {
			if (position != null) {
				legend.setPosition(position);
			} else {
				while (chart.getLegend() != null) {
					chart.removeLegend();
				}
			}
		} else {
			if (position != null) {
				resetLegend();
			}
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:21,代碼來源:JFreeChartPlotEngine.java

示例2: paintDeviationChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
public void paintDeviationChart(Graphics graphics, int width, int height) {
	prepareData();

	JFreeChart chart = createChart(this.dataset);

	// set the background color for the chart...
	chart.setBackgroundPaint(Color.white);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
	}

	Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
	chart.draw((Graphics2D) graphics, drawRect);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:20,代碼來源:ROCChartPlotter.java

示例3: updateLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Update legend
 */
private void updateLegend() {
	_chart.removeLegend();
	final LegendTitle legend = new LegendTitle(() -> {
		final LegendItemCollection collection = new LegendItemCollection();
		if (_currentMode == DisplayMode.TIME) {
			collection.add(new LegendItem(Legend.LATENCY.label, null, null, null, new Rectangle(30, 20), Legend.LATENCY.color));
			if (_dnsLookup && _services.isEmbeddedTRAvailable() && !Env.INSTANCE.isUseOSTraceroute()) {
				collection.add(new LegendItem(Legend.DNS.label, null, null, null, new Rectangle(30, 20), Legend.DNS.color));
			}
		} else {
			collection.add(new LegendItem(Legend.DISTANCE.label, Legend.DISTANCE.color));
		}
		return collection;
	});
	legend.setPosition(RectangleEdge.BOTTOM);
	_chart.addLegend(legend);
}
 
開發者ID:leolewis,項目名稱:openvisualtraceroute,代碼行數:21,代碼來源:GanttPanel.java

示例4: styleChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/** 
 * TODO Documentation
 * 
 * @param chart
 * @return
 */
protected JFreeChart styleChart(JFreeChart chart) {
	chart.setBackgroundPaint(Color.white);
       LegendTitle legend = chart.getLegend();
       legend.setPosition(RectangleEdge.RIGHT);
       legend.setVisible(false);

       final CategoryPlot plot = chart.getCategoryPlot();
       plot.setBackgroundPaint(Color.white);
       plot.setRangeGridlinePaint(Color.lightGray);      

       final LineAndShapeRenderer renderer = new LineAndShapeRenderer();
       renderer.setSeriesLinesVisible(0,true);
       renderer.setSeriesShapesVisible(1, true);
       renderer.setBaseLinesVisible(true);
       renderer.setBaseShapesFilled(true);
       plot.setDomainGridlinesVisible(true);
       plot.setDomainGridlinePaint(Color.lightGray);
       plot.setRenderer(renderer);
       // customise the range axis...
       final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
       rangeAxis.setAutoRangeIncludesZero(false);
       rangeAxis.setStandardTickUnits(rangeAxis.getStandardTickUnits());
       
       return chart;
}
 
開發者ID:modsim,項目名稱:vizardous,代碼行數:32,代碼來源:CorrelationChart2D.java

示例5: styleChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * TODO Documentation
 * 
 * @param chart
 * @return
 */
public JFreeChart styleChart(JFreeChart chart) {
	chart.setBackgroundPaint(Color.white);
       LegendTitle legend = chart.getLegend();
       legend.setPosition(RectangleEdge.RIGHT);
       legend.setVisible(false);
       
       XYPlot chartPlot = chart.getXYPlot();
       chartPlot.setBackgroundPaint(Color.white);
       chartPlot.setForegroundAlpha(0.7F);

       XYItemRenderer brRenderer = chartPlot.getRenderer();
       chartPlot.setDomainGridlinesVisible(true);
       chartPlot.setDomainGridlinePaint(Color.GRAY);
       chartPlot.setRangeGridlinePaint(Color.GRAY);
       brRenderer.setSeriesPaint(0, new Color(0,0,139));

       // customise the range axis...
       final ValueAxis domainAxis = chartPlot.getDomainAxis();
       domainAxis.setLowerMargin(0.0);
       
       return chart;
}
 
開發者ID:modsim,項目名稱:vizardous,代碼行數:29,代碼來源:DistributionChart2D.java

示例6: createChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // get a reference to the plot for further customisation...
      SOCRSpiderWebPlot plot = new SOCRSpiderWebPlot(dataset);
      JFreeChart chart = new JFreeChart(
          chartTitle, TextTitle.DEFAULT_FONT, plot, false
      );

LegendTitle legend = new LegendTitle(plot);
      legend.setPosition(RectangleEdge.BOTTOM);

//renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
      chart.addSubtitle(legend);   

  	setCategorySummary(dataset);
  	if (legendPanelOn)
      	chart.removeLegend();
      return chart;
      
  }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:28,代碼來源:SpiderWebChartDemo1.java

示例7: setLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void setLegend(JFreeChart chart) {
    chart.removeLegend();
    final LegendTitle legend = new LegendTitle(new SpectrumLegendItemSource());
    legend.setPosition(RectangleEdge.BOTTOM);
    LineBorder border = new LineBorder(Color.BLACK, new BasicStroke(), new RectangleInsets(2, 2, 2, 2));
    legend.setFrame(border);
    chart.addLegend(legend);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:9,代碼來源:SpectrumTopComponent.java

示例8: createLegendTitles

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
 * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
 * {@link DimensionConfig} s.
 */
private List<LegendTitle> createLegendTitles() {
	List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
	LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();

	LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(
			HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2));
	legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());
	
	RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
	if (position == null) {
		return legendTitles;
	}
	legendTitle.setPosition(position);

	if (legendConfiguration.isShowLegendFrame()) {
		legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
	}
	ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
	wrapper.add(legendTitle.getItemContainer());
	wrapper.setPadding(3, 3, 3, 3);
	legendTitle.setWrapper(wrapper);

	legendTitles.add(legendTitle);
	return legendTitles;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:31,代碼來源:JFreeChartPlotEngine.java

示例9: paintDeviationChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
public void paintDeviationChart(Graphics graphics, int width, int height) {      
    prepareData();
    
    JFreeChart chart = createChart(this.dataset);
    
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    
    // legend settings
    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setPosition(RectangleEdge.TOP);
        legend.setFrame(BlockBorder.NONE);
        legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
    }
    
    Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
    chart.draw((Graphics2D)graphics, drawRect);
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:20,代碼來源:ROCChartPlotter.java

示例10: 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

示例11: createLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private LegendTitle createLegend() {
  final LegendItemCollection legendItems = new LegendItemCollection();
  FontRenderContext frc = new FontRenderContext(null, true, true);
  GlyphVector gv = LEGEND_FONT.createGlyphVector(frc, new char[] {'X'});
  Shape shape = gv.getGlyphVisualBounds(0);
  for(Pair<String, Color> p : getLegend()) {
    LegendItem li = new LegendItem(p.getLeft(), null, null, null, shape, p.getRight());
    li.setLabelFont(LEGEND_FONT);
    legendItems.add(li);
  }
  LegendTitle legend = new LegendTitle(new LegendItemSource() {
    @Override
    public LegendItemCollection getLegendItems() {
      return legendItems;
    }});
  legend.setPosition(RectangleEdge.BOTTOM);
  return legend;
}
 
開發者ID:uq-eresearch,項目名稱:aorra,代碼行數:19,代碼來源:LandPracticeSystems.java

示例12: addLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
protected final void addLegend() {
    if (chart == null) {
        throw new IllegalStateException("initChart() must be called first");
    }

    LegendTitle legend = new LegendTitle(chart.getPlot());
    legend.setItemFont(LEGEND_FONT);
    legend.setBorder(0, 0, 0, 0);
    legend.setBackgroundPaint(Color.WHITE);
    legend.setPosition(RectangleEdge.BOTTOM);

    RectangleInsets padding = new RectangleInsets(5, 5, 5, 5);
    legend.setItemLabelPadding(padding);

    chart.addLegend(legend);
}
 
開發者ID:nmonvisualizer,項目名稱:nmonvisualizer,代碼行數:17,代碼來源:BaseChartBuilder.java

示例13: createLegendTitles

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
 * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
 * {@link DimensionConfig} s.
 */
private List<LegendTitle> createLegendTitles() {
	List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
	LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();

	LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER,
			VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER,
			0, 2));
	legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());

	RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
	if (position == null) {
		return legendTitles;
	}
	legendTitle.setPosition(position);

	if (legendConfiguration.isShowLegendFrame()) {
		legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
	}
	ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
	wrapper.add(legendTitle.getItemContainer());
	wrapper.setPadding(3, 3, 3, 3);
	legendTitle.setWrapper(wrapper);

	legendTitles.add(legendTitle);
	return legendTitles;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:32,代碼來源:JFreeChartPlotEngine.java

示例14: testLegendEvents

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Some checks for the default legend firing change events.
 */
@Test
public void testLegendEvents() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    JFreeChart chart = ChartFactory.createPieChart("title", dataset);
    chart.addChangeListener(this);
    this.lastChartChangeEvent = null;
    LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.TOP);
    assertNotNull(this.lastChartChangeEvent);
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:14,代碼來源:JFreeChartTest.java

示例15: createLegendTitles

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
 * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
 * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
 * {@link DimensionConfig} s.
 */
private List<LegendTitle> createLegendTitles() {
	List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
	LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();

	LegendTitle legendTitle = new SmartLegendTitle(this,
			new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2),
			new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2));
	legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());

	RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
	if (position == null) {
		return legendTitles;
	}
	legendTitle.setPosition(position);

	if (legendConfiguration.isShowLegendFrame()) {
		legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
	}
	ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
	wrapper.add(legendTitle.getItemContainer());
	wrapper.setPadding(3, 3, 3, 3);
	legendTitle.setWrapper(wrapper);

	legendTitles.add(legendTitle);
	return legendTitles;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-studio,代碼行數:32,代碼來源:JFreeChartPlotEngine.java


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