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


Java LegendTitle.setHorizontalAlignment方法代碼示例

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


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

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

示例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:rapidminer,項目名稱:rapidminer-5,代碼行數:20,代碼來源:ROCChartPlotter.java

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

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

示例5: updatePlotter

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
@Override
protected void updatePlotter() {
	int categoryCount = prepareData();
	String maxClassesProperty = ParameterService
			.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
	int maxClasses = 20;
	try {
		if (maxClassesProperty != null) {
			maxClasses = Integer.parseInt(maxClassesProperty);
		}
	} catch (NumberFormatException e) {
		// LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.",
		// LogService.WARNING);
		LogService.getRoot().log(Level.WARNING,
				"com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
	}
	boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

	JFreeChart chart = createChart(this.dataset, createLegend);

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

	// domain axis
	if (axis[INDEX] >= 0) {
		if (!dataTable.isNominal(axis[INDEX])) {
			if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
				DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
				domainAxis.setTimeZone(Tools.getPreferredTimeZone());
				chart.getXYPlot().setDomainAxis(domainAxis);
				if (getRangeForDimension(axis[INDEX]) != null) {
					domainAxis.setRange(getRangeForDimension(axis[INDEX]));
				}
				domainAxis.setLabelFont(LABEL_FONT_BOLD);
				domainAxis.setTickLabelFont(LABEL_FONT);
				domainAxis.setVerticalTickLabels(isLabelRotating());
			}
		} else {
			LinkedHashSet<String> values = new LinkedHashSet<String>();
			for (DataTableRow row : dataTable) {
				String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
				if (stringValue.length() > 40) {
					stringValue = stringValue.substring(0, 40);
				}
				values.add(stringValue);
			}
			ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]),
					values.toArray(new String[values.size()]));
			categoryAxis.setLabelFont(LABEL_FONT_BOLD);
			categoryAxis.setTickLabelFont(LABEL_FONT);
			categoryAxis.setVerticalTickLabels(isLabelRotating());
			chart.getXYPlot().setDomainAxis(categoryAxis);
		}
	}

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

	AbstractChartPanel panel = getPlotterPanel();
	if (panel == null) {
		panel = createPanel(chart);
	} else {
		panel.setChart(chart);
	}

	// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
	panel.getChartRenderingInfo().setEntityCollection(null);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:75,代碼來源:SeriesChartPlotter.java

示例6: createChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private JFreeChart createChart(XYDataset dataset) {
	// create the chart...
	JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
			null,                      // x axis label
			null,                      // y axis label
			dataset,                  // data
			PlotOrientation.VERTICAL, true,                     // include legend
			true,                     // tooltips
			false                     // urls
			);

	chart.setBackgroundPaint(Color.white);

	// get a reference to the plot for further customisation...
	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setBackgroundPaint(Color.WHITE);
	plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
	plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

	ValueAxis valueAxis = plot.getRangeAxis();
	valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	ValueAxis domainAxis = plot.getDomainAxis();
	domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	DeviationRenderer renderer = new DeviationRenderer(true, false);
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	if (dataset.getSeriesCount() == 1) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else if (dataset.getSeriesCount() == 2) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);

		renderer.setSeriesStroke(1, stroke);
		renderer.setSeriesPaint(1, Color.BLUE);
		renderer.setSeriesFillPaint(1, Color.BLUE);
	} else {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);
	plot.setRenderer(renderer);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(PlotterAdapter.LABEL_FONT);
	}
	return chart;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:64,代碼來源:ROCChartPlotter.java

示例7: setChartLegend

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
protected void setChartLegend(JFreeChart jfreeChart, Integer baseFontSize)
{

	//The legend visibility is already taken into account in the jfreeChart object's constructor
	
	LegendTitle legend = jfreeChart.getLegend();
	if (legend != null)
	{
		Font themeLegendFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FONT), getChart().getLegendFont(), baseFontSize);
		legend.setItemFont(themeLegendFont);

		Color legendForecolor = getChart().getOwnLegendColor() != null ? 
				getChart().getOwnLegendColor() :
				(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) != null ? 
						(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) :
						getChart().getLegendColor());
		if (legendForecolor != null)
			legend.setItemPaint(legendForecolor);

		Color legendBackcolor = getChart().getOwnLegendBackgroundColor() != null ? 
				getChart().getOwnLegendBackgroundColor() :
				(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) != null ? 
						(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) :
						getChart().getLegendBackgroundColor());
		if (legendBackcolor != null)
			legend.setBackgroundPaint(legendBackcolor);
		
		BlockFrame frame = (BlockFrame)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FRAME);
		if (frame != null)
			legend.setFrame(frame);
		
		HorizontalAlignment defaultLegendHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_HORIZONTAL_ALIGNMENT);
		if (defaultLegendHAlignment != null)
			legend.setHorizontalAlignment(defaultLegendHAlignment);
		
		VerticalAlignment defaultLegendVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_VERTICAL_ALIGNMENT);
		if (defaultLegendVAlignment != null)
			legend.setVerticalAlignment(defaultLegendVAlignment);
		
		RectangleInsets defaultLegendPadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_PADDING);
		RectangleInsets legendPadding = legend.getPadding() != null ? legend.getPadding() : defaultLegendPadding;
		if (legendPadding != null)
			legend.setPadding(legendPadding);

		RectangleEdge defaultLegendPosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_POSITION);
		if (getEdge(getChart().getLegendPositionValue(), defaultLegendPosition) != null)
			legend.setPosition(getEdge(getChart().getLegendPositionValue(), defaultLegendPosition));
		
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:51,代碼來源:GenericChartTheme.java

示例8: updatePlotter

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
@Override
protected void updatePlotter() {
    int categoryCount = prepareData();
    String maxClassesProperty = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
    int maxClasses = 20;
    try {
        if (maxClassesProperty != null)
            maxClasses = Integer.parseInt(maxClassesProperty);
    } catch (NumberFormatException e) {
        //LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", LogService.WARNING);
        LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
    }
    boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

    JFreeChart chart = createChart(this.dataset, createLegend);

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

    // domain axis
    if (axis[INDEX] >= 0) {
        if (!dataTable.isNominal(axis[INDEX])) {
            if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
                DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
                domainAxis.setTimeZone(Tools.getPreferredTimeZone());
                chart.getXYPlot().setDomainAxis(domainAxis);
                if (getRangeForDimension(axis[INDEX]) != null)
                    domainAxis.setRange(getRangeForDimension(axis[INDEX]));
                domainAxis.setLabelFont(LABEL_FONT_BOLD);
                domainAxis.setTickLabelFont(LABEL_FONT);
                domainAxis.setVerticalTickLabels(isLabelRotating());
            }
        } else {
            LinkedHashSet<String> values = new LinkedHashSet<String>();
            for (DataTableRow row : dataTable) {
                String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
                if (stringValue.length() > 40)
                    stringValue = stringValue.substring(0, 40);
                values.add(stringValue);
            }
            ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]), values.toArray(new String[values.size()]));
            categoryAxis.setLabelFont(LABEL_FONT_BOLD);
            categoryAxis.setTickLabelFont(LABEL_FONT);
            categoryAxis.setVerticalTickLabels(isLabelRotating());
            chart.getXYPlot().setDomainAxis(categoryAxis);
        }
    }

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

    AbstractChartPanel panel = getPlotterPanel();
    if (panel == null) {
        panel = createPanel(chart);
    } else {
        panel.setChart(chart);
    }

    // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
    panel.getChartRenderingInfo().setEntityCollection(null);
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:68,代碼來源:SeriesChartPlotter.java

示例9: updatePlotter

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
public void updatePlotter() {
    int categoryCount = prepareData();
    String maxClassesProperty = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_LEGEND_CLASSLIMIT);
    int maxClasses = 20;
    try {
        if (maxClassesProperty != null)
            maxClasses = Integer.parseInt(maxClassesProperty);
    } catch (NumberFormatException e) {
        //LogService.getGlobal().log("Pie Chart plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", LogService.WARNING);
        LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.AbstractPieChartPlotter.pie_chart_plotter_parsing_error");
    }
    boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

    if (categoryCount <= MAX_CATEGORIES) {
        JFreeChart chart = createChart(pieDataSet, createLegend);

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

        PiePlot plot = (PiePlot) chart.getPlot();

        plot.setBackgroundPaint(Color.WHITE);
        plot.setSectionOutlinesVisible(true);
        plot.setShadowPaint(new Color(104, 104, 104, 100));

        int size = pieDataSet.getKeys().size();
        for (int i = 0; i < size; i++) {
            Comparable key = pieDataSet.getKey(i);
            plot.setSectionPaint(key, getColorProvider().getPointColor(i / (double) (size - 1)));

            boolean explode = false;
            for (String explosionGroup : explodingGroups) {
                if (key.toString().startsWith(explosionGroup) || explosionGroup.startsWith(key.toString())) {
                    explode = true;
                    break;
                }
            }

            if (explode) {
                plot.setExplodePercent(key, this.explodingAmount);
            }
        }

        plot.setLabelFont(LABEL_FONT);
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setOutlinePaint(Color.WHITE);

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

        if (panel instanceof AbstractChartPanel) {
            panel.setChart(chart);
        } else {
            panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN);
            final ChartPanelShiftController controller = new ChartPanelShiftController(panel);
            panel.addMouseListener(controller);
            panel.addMouseMotionListener(controller);
        }

        // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
        panel.getChartRenderingInfo().setEntityCollection(null);
    } else {
        //LogService.getGlobal().logNote("Too many columns (" + categoryCount + "), this chart is only able to plot up to " + MAX_CATEGORIES + " different categories.");
        LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.AbstractPieChartPlotter.too_many_columns", 
        		new Object[] {categoryCount, MAX_CATEGORIES});
    }
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:76,代碼來源:AbstractPieChartPlotter.java

示例10: createChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private JFreeChart createChart(XYDataset dataset) {
      // create the chart...
      JFreeChart chart = ChartFactory.createXYLineChart(
          null,      // chart title
          null,                      // x axis label
          null,                      // y axis label
          dataset,                  // data
          PlotOrientation.VERTICAL,
          true,                     // include legend
          true,                     // tooltips
          false                     // urls
      );

      chart.setBackgroundPaint(Color.white);
     
      // get a reference to the plot for further customisation...
      XYPlot plot = (XYPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.WHITE);
      plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
      plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
      plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
     
      ValueAxis valueAxis = plot.getRangeAxis();
      valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
      valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

      ValueAxis domainAxis = plot.getDomainAxis();
      domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
      domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);
      
      DeviationRenderer renderer = new DeviationRenderer(true, false);
      Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
      if (dataset.getSeriesCount() == 1) {
          renderer.setSeriesStroke(0, stroke);
          renderer.setSeriesPaint(0, Color.RED);
          renderer.setSeriesFillPaint(0, Color.RED);            
      } else if (dataset.getSeriesCount() == 2) {        	
      	renderer.setSeriesStroke(0, stroke);
      	renderer.setSeriesPaint(0, Color.RED);
      	renderer.setSeriesFillPaint(0, Color.RED);
      	
      	renderer.setSeriesStroke(1, stroke);
      	renderer.setSeriesPaint(1, Color.BLUE);
      	renderer.setSeriesFillPaint(1, Color.BLUE);
      } else {
          for (int i = 0; i < dataset.getSeriesCount(); i++) {
              renderer.setSeriesStroke(i, stroke);
              Color color = colorProvider.getPointColor((double)i / (double)(dataset.getSeriesCount() - 1));
              renderer.setSeriesPaint(i, color);
              renderer.setSeriesFillPaint(i, color);
          }
      }
      renderer.setAlpha(0.12f);        
      plot.setRenderer(renderer);
        
// legend settings
LegendTitle legend = chart.getLegend();
if (legend != null) {
	legend.setPosition(RectangleEdge.TOP);
	legend.setFrame(BlockBorder.NONE);
	legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
	legend.setItemFont(PlotterAdapter.LABEL_FONT);
}
      return chart;
  }
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:66,代碼來源:ROCChartPlotter.java

示例11: getPieChart

import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
public String getPieChart(String type , String title , Map hashMap , Date startDate , Date endDate) {
	CHARTS_PATH = "C://" + type + startDate.getTime()+endDate.getTime()+".jpg";
	File file = new File(CHARTS_PATH);
	if(file.exists()){
		file.delete();
	}
	try {
		DefaultPieDataset dataset = new DefaultPieDataset();
		for(Object o : hashMap.keySet()){
			dataset.setValue(String.valueOf(o), Integer.parseInt((String) hashMap.get(o)));
		}
		JFreeChart chart = ChartFactory.createPieChart3D( title,       // 圖表標題
			      dataset,     // 繪圖數據集
			      false,       // 設定是否顯示圖例
			      false,       // 設定是否顯示圖例名稱
			      false);      // 設定是否生成鏈接
		chart.setAntiAlias(false);
		
		PiePlot pieplot = (PiePlot)chart.getPlot();
		pieplot.setLabelFont(new Font("宋體", 0, 15));
        pieplot.setNoDataMessage("NO DATA!");
        pieplot.setCircular(true);
        pieplot.setLabelGap(0.02D);
        pieplot.setBackgroundPaint(new Color(199,237,204));
                pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(
                "{0} {2}",
                NumberFormat.getNumberInstance(),
                new DecimalFormat("0.00%")));
        pieplot.setForegroundAlpha(0.6f);
                
        LegendTitle legendtitle = new LegendTitle(chart.getPlot());
        legendtitle.setWidth(100D);
        BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
       	blockcontainer.setBorder(new BlockBorder(1.0D, 1.0D, 1.0D, 1.0D));
       
       
		LabelBlock labelblock = new LabelBlock("Percent:", new Font("宋體", 1, 16));
		labelblock.setPadding(5D, 5D, 5D, 5D);
		blockcontainer.add(labelblock, RectangleEdge.TOP);
		BlockContainer blockcontainer1 = legendtitle.getItemContainer();
		blockcontainer1.setPadding(2D, 10D, 5D, 2D);
		blockcontainer.add(blockcontainer1);
		legendtitle.setWrapper(blockcontainer);
		legendtitle.setPosition(RectangleEdge.RIGHT);
		legendtitle.setHorizontalAlignment(HorizontalAlignment.LEFT);
		chart.addSubtitle(legendtitle);
		chart.setBackgroundPaint(new Color(199,237,204));
		
		TextTitle pcTitle = chart.getTitle();
		pcTitle.setFont(new Font("漢真廣標", Font.BOLD, 21));
		pcTitle.setPaint(Color.RED);
		
		ChartUtilities.saveChartAsJPEG(file, chart, CHARTS_WIDTH, CHARTS_HEIGHT);
	} catch (Exception e) {
		e.printStackTrace();
	}
	return CHARTS_PATH;
}
 
開發者ID:jbosschina,項目名稱:jcommerce,代碼行數:59,代碼來源:ReportManagerImpl.java


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