当前位置: 首页>>代码示例>>Java>>正文


Java LegendTitle类代码示例

本文整理汇总了Java中org.jfree.chart.title.LegendTitle的典型用法代码示例。如果您正苦于以下问题:Java LegendTitle类的具体用法?Java LegendTitle怎么用?Java LegendTitle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LegendTitle类属于org.jfree.chart.title包,在下文中一共展示了LegendTitle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportAsImage

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Exports the current chart as an image.
 * @param width The width of the image
 * @param height The height of the image
 * @param hideLegend If true, the image will not contain the legend
 * @return The image
 */
public BufferedImage exportAsImage(int width, int height, boolean hideLegend){
	
	LegendTitle legend = null;
	if(hideLegend){
		// Remove legend while exporting the image
		legend = this.chartPanel.getChart().getLegend();
		this.chartPanel.getChart().removeLegend();
	}
	
	BufferedImage thumb = this.chartPanel.getChart().createBufferedImage(width, height, 600, 400, null);
	
	if(hideLegend){
		// If the legend was removed, add it after exporting the image 
		this.chartPanel.getChart().addLegend(legend);
	}
	return thumb;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:25,代码来源:ChartTab.java

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

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

示例4: getLegend

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Returns the nth legend for a chart, or <code>null</code>.
 * 
 * @param index  the legend index (zero-based).
 * 
 * @return The legend (possibly <code>null</code>).
 * 
 * @see #addLegend(LegendTitle)
 */
public LegendTitle getLegend(int index) {
    int seen = 0;
    Iterator iterator = this.subtitles.iterator();
    while (iterator.hasNext()) {
        Title subtitle = (Title) iterator.next();
        if (subtitle instanceof LegendTitle) {
            if (seen == index) {
                return (LegendTitle) subtitle;
            }
            else {
                seen++;   
            }
        }
    }
    return null;        
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:JFreeChart.java

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

示例6: getLegend

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Returns the nth legend for a chart, or <code>null</code>.
 *
 * @param index  the legend index (zero-based).
 *
 * @return The legend (possibly <code>null</code>).
 *
 * @see #addLegend(LegendTitle)
 */
public LegendTitle getLegend(int index) {
    int seen = 0;
    Iterator iterator = this.subtitles.iterator();
    while (iterator.hasNext()) {
        Title subtitle = (Title) iterator.next();
        if (subtitle instanceof LegendTitle) {
            if (seen == index) {
                return (LegendTitle) subtitle;
            }
            else {
                seen++;
            }
        }
    }
    return null;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:26,代码来源:JFreeChart.java

示例7: getLegend

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Returns the nth legend for a chart, or {@code null}.
 *
 * @param index  the legend index (zero-based).
 *
 * @return The legend (possibly {@code null}).
 *
 * @see #addLegend(LegendTitle)
 */
public LegendTitle getLegend(int index) {
    int seen = 0;
    Iterator iterator = this.subtitles.iterator();
    while (iterator.hasNext()) {
        Title subtitle = (Title) iterator.next();
        if (subtitle instanceof LegendTitle) {
            if (seen == index) {
                return (LegendTitle) subtitle;
            }
            else {
                seen++;
            }
        }
    }
    return null;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:26,代码来源:JFreeChart.java

示例8: fillChart

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
private void fillChart(String title, List<String> names, 
		List<String> colors, List<Float> values) throws Exception {
	DefaultPieDataset data=new DefaultPieDataset();
	for (int ix=0; ix<names.size(); ix++) {
		data.setValue( names.get(ix), values.get(ix) );
	}
       this.chart=ChartFactory.createPieChart3D(
       		title, 
       		data, 
       		true,
       		true, 
       		false);
       LegendTitle legend=this.chart.getLegend();
       legend.setItemFont(new Font("", Font.TRUETYPE_FONT, 9) );
       PiePlot plot=(PiePlot)this.chart.getPlot();
       plot.setCircular(true);
       plot.setBackgroundAlpha(0.9f);       
       plot.setForegroundAlpha(0.5f);
       plot.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
       this.setPlotColor( plot, names, colors );
       this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9) ) ); 		
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:23,代码来源:CommonPieChartAction.java

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

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

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

示例12: getLegend

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Returns the nth legend for a chart, or <code>null</code>.
 * 
 * @param index  the legend index (zero-based).
 * 
 * @return The legend (possibly <code>null</code>).
 */
public LegendTitle getLegend(int index) {
    int seen = 0;
    Iterator iterator = this.subtitles.iterator();
    while (iterator.hasNext()) {
        Title subtitle = (Title) iterator.next();
        if (subtitle instanceof LegendTitle) {
            if (seen == index) {
                return (LegendTitle) subtitle;
            }
            else {
                seen++;   
            }
        }
    }
    return null;        
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:24,代码来源:JFreeChart.java

示例13: getLegend

import org.jfree.chart.title.LegendTitle; //导入依赖的package包/类
/**
 * Returns the nth legend for a chart, or <code>null</code>.
 * 
 * @param index the legend index (zero-based).
 * @return The legend (possibly <code>null</code>).
 * @see #addLegend(LegendTitle)
 */
public LegendTitle getLegend(int index) {
	int seen = 0;
	Iterator iterator = this.subtitles.iterator();
	while (iterator.hasNext()) {
		Title subtitle = (Title) iterator.next();
		if (subtitle instanceof LegendTitle) {
			if (seen == index) {
				return (LegendTitle) subtitle;
			} else {
				seen++;
			}
		}
	}
	return null;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:23,代码来源:JFreeChart.java

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

示例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-5,代码行数:31,代码来源:JFreeChartPlotEngine.java


注:本文中的org.jfree.chart.title.LegendTitle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。