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


Java PiePlot.setDirection方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.PiePlot.setDirection方法的典型用法代码示例。如果您正苦于以下问题:Java PiePlot.setDirection方法的具体用法?Java PiePlot.setDirection怎么用?Java PiePlot.setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.PiePlot的用法示例。


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

示例1: createPieChartPage

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 * Creates the PieChart page.
 */
void createPieChartPage() {
	result = new DefaultPieDataset();  

	 JFreeChart chart = ChartFactory.createPieChart("Design Decisions", result, true, true, false);  
	 PiePlot plot = (PiePlot) chart.getPlot();  
	  plot.setStartAngle(290);  
	  plot.setDirection(Rotation.CLOCKWISE);  
	  plot.setForegroundAlpha(0.5f);
	 
	Composite composite = new Composite(getContainer(), SWT.NONE);
	FillLayout layout = new FillLayout();
	composite.setLayout(layout);
	new ChartComposite(composite, SWT.NONE, chart, true);
	int index = addPage(composite);
	setPageText(index, "Graph");

	
}
 
开发者ID:germanattanasio,项目名称:traceability-assistant-eclipse-plugins,代码行数:22,代码来源:DXMIEditor.java

示例2: setResults

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 * Sets the new results for display.
 *
 * @param prediction Float array corresponding to the classifier prediction.
 * @param classifierName String that is the classifier name.
 * @param classColors Color array representing the class color.
 * @param classNames String array representing the class names.
 */
public void setResults(float[] prediction, String classifierName,
        Color[] classColors, String[] classNames) {
    int numClasses = classNames.length;
    DefaultPieDataset pieData = new DefaultPieDataset();
    for (int cIndex = 0; cIndex < numClasses; cIndex++) {
        pieData.setValue(classNames[cIndex], prediction[cIndex]);
    }
    JFreeChart chart = ChartFactory.createPieChart3D(classifierName
            + " prediction", pieData, true, true, false);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    PieRenderer prend = new PieRenderer(classColors);
    prend.setColor(plot, pieData);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(140, 140));
    resultChartPanel.removeAll();
    resultChartPanel.add(chartPanel);
    resultChartPanel.revalidate();
    resultChartPanel.repaint();
}
 
开发者ID:datapoet,项目名称:hubminer,代码行数:30,代码来源:ClassifierResultPanel.java

示例3: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Secured({"ROLE_ADMIN","ROLE_SURVEY_ADMIN"})
private JFreeChart createChart(PieDataset pieDataset, String title) {
try{
	JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false,true,false);

	chart.setBackgroundPaint(null);//this line necessary for transparency of background
       final ChartPanel chartPanel = new ChartPanel(chart);
       chartPanel.setOpaque(false); //this line necessary for transparency of background
       chartPanel.setBackground(new Color(0, 0, 0, 0)); //this line necessary for transparency of background
       
	PiePlot plot = (PiePlot) chart.getPlot();
	
	//Color[] colors = {new Color(170, 195, 217, 255),new Color(246, 140, 31, 255),new Color(204, 204, 204, 255),new Color(231, 238, 144, 255),new Color(51, 51, 51, 255),new Color(101, 125, 151, 255),new Color(0, 102, 255, 255)}; 
	//PieRenderer renderer = new PieRenderer(colors); 
	//renderer.setColor(plot, pieDataset);
	
	
	PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0}:{1}%"); 
	plot.setLabelGenerator(generator);
	
	plot.setStartAngle(270);
	plot.setDirection(Rotation.CLOCKWISE);
	
	return chart;
} catch (Exception e) {
	log.error(e.getMessage(),e);
	throw (new RuntimeException(e));
}
}
 
开发者ID:JD-Software,项目名称:JDeSurvey,代码行数:30,代码来源:StatisticsController.java

示例4: createPieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
public static JFreeChart createPieChart(DefaultPieDataset dataset, String title, boolean is3D) {
        JFreeChart chart = null;
        if (is3D) {
            chart = ChartFactory.createPieChart3D(title, // 图表标题
                    dataset, // 数据集
                    true, // 是否显示图例
                    true, // 是否显示工具提示
                    true // 是否生成URL
            );
        } else {
            chart = ChartFactory.createPieChart(title, // 图表标题
                    dataset, // 数据集
                    true, // 是否显示图例
                    true, // 是否显示工具提示
                    true // 是否生成URL
            );
        }
// 设置标题字体==为了防止中文乱码:必须设置字体
        chart.setTitle(new TextTitle(title, new Font("黑体", Font.ITALIC, 22)));
// 设置图例的字体==为了防止中文乱码:必须设置字体
        chart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 12));
// 获取饼图的Plot对象(实际图表)
        PiePlot plot = (PiePlot) chart.getPlot();
// 图形边框颜色
        plot.setBaseSectionOutlinePaint(Color.GRAY);
// 图形边框粗细
        plot.setBaseSectionOutlineStroke(new BasicStroke(0.0f));
// 设置饼状图的绘制方向,可以按顺时针方向绘制,也可以按逆时针方向绘制
        plot.setDirection(Rotation.ANTICLOCKWISE);
// 设置绘制角度(图形旋转角度)
        plot.setStartAngle(70);
// 设置突出显示的数据块
// plot.setExplodePercent("One", 0.1D);
// 设置背景色透明度
        plot.setBackgroundAlpha(0.7F);
// 设置前景色透明度
        plot.setForegroundAlpha(0.65F);
// 设置区块标签的字体==为了防止中文乱码:必须设置字体
        plot.setLabelFont(new Font("宋体", Font.PLAIN, 12));
// 扇区分离显示,对3D图不起效
        if (is3D)
            plot.setExplodePercent(dataset.getKey(3), 0.1D);
// 图例显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
                "{0}:{1}\r\n({2})", NumberFormat.getNumberInstance(),
                new DecimalFormat("0.00%")));
// 图例显示百分比
// plot.setLegendLabelGenerator(new
// StandardPieSectionLabelGenerator("{0}={1}({2})"));
// 指定显示的饼图为:圆形(true) 还是椭圆形(false)
        plot.setCircular(true);
// 没有数据的时候显示的内容
        plot.setNoDataMessage("找不到可用数据...");
// 设置鼠标悬停提示
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
// 设置热点链接
// plot.setURLGenerator(new StandardPieURLGenerator("detail.jsp"));

        return chart;
    }
 
开发者ID:glameyzhou,项目名称:scaffold,代码行数:61,代码来源:JFreeChartFactory.java

示例5: setResults

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 * Sets the data to be shown.
 *
 * @param occurrenceProfile Double array that is the neighbor occurrence
 * profile of this visual word.
 * @param codebookIndex Integer that is the index of this visual word.
 * @param classColors Color[] of class colors.
 * @param classNames String[] of class names.
 */
public void setResults(double[] occurrenceProfile, int codebookIndex,
        Color[] classColors, String[] classNames) {
    int numClasses = Math.min(classNames.length, occurrenceProfile.length);
    this.codebookIndex = codebookIndex;
    this.occurrenceProfile = occurrenceProfile;
    DefaultPieDataset pieData = new DefaultPieDataset();
    for (int cIndex = 0; cIndex < numClasses; cIndex++) {
        pieData.setValue(classNames[cIndex], occurrenceProfile[cIndex]);
    }
    JFreeChart chart = ChartFactory.createPieChart3D("codebook vect "
            + codebookIndex, pieData, true, true, false);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    PieRenderer prend = new PieRenderer(classColors);
    prend.setColor(plot, pieData);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(140, 140));
    chartPanel.setVisible(true);
    chartPanel.revalidate();
    chartPanel.repaint();
    JPanel jp = new JPanel();
    jp.setPreferredSize(new Dimension(140, 140));
    jp.setMinimumSize(new Dimension(140, 140));
    jp.setMaximumSize(new Dimension(140, 140));
    jp.setSize(new Dimension(140, 140));
    jp.setLayout(new FlowLayout());
    jp.add(chartPanel);
    jp.setVisible(true);
    jp.validate();
    jp.repaint();

    JFrame frame = new JFrame();
    frame.setBackground(Color.WHITE);
    frame.setUndecorated(true);
    frame.getContentPane().add(jp);
    frame.pack();
    BufferedImage bi = new BufferedImage(jp.getWidth(), jp.getHeight(),
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics = bi.createGraphics();
    jp.print(graphics);
    graphics.dispose();
    frame.dispose();
    imPanel.removeAll();
    imPanel.setImage(bi);
    imPanel.setVisible(true);
    imPanel.revalidate();
    imPanel.repaint();
}
 
开发者ID:datapoet,项目名称:hubminer,代码行数:59,代码来源:CodebookVectorProfilePanel.java

示例6: getPieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 * Creates a Pie Chart based on map.
 *
 * @return the Pie Chart generated.
 */
public JFreeChart getPieChart(Map<String, Double> pieValues) {
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (String key : pieValues.keySet()) {
        dataset.setValue(key, pieValues.get(key));
    }

    JFreeChart chart = ChartFactory.createPieChart3D(
            null,  // chart title
            dataset, // data
            true,    // include legend
            true,
            false
    );

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(false);
    chart.setBorderPaint(null);


    PiePlot plot = (PiePlot)chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(true);
    plot.setLabelGap(0.02);
    plot.setOutlinePaint(null);
    plot.setLabelLinksVisible(false);

    plot.setLabelGenerator(null);

    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}"));


    plot.setStartAngle(270);
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setForegroundAlpha(0.60f);
    plot.setInteriorGap(0.33);

    return chart;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:47,代码来源:GraphEngine.java


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