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


Java PiePlot.setExplodePercent方法代码示例

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


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

示例1: createNewSerie

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
protected void createNewSerie(final IScope scope, final String serieid) {
	// final ChartDataSeries dataserie = chartdataset.getDataSeries(scope,
	// serieid);
	final PiePlot plot = (PiePlot) this.chart.getPlot();

	// final DefaultPieDataset firstdataset = (DefaultPieDataset)
	// plot.getDataset();

	nbseries++;
	IdPosition.put(serieid, nbseries - 1);
	if (getStyle().equals(IKeyword.EXPLODED)) {
		plot.setExplodePercent(serieid, 0.20);
	}

	// System.out.println("new serie"+serieid+" at
	// "+IdPosition.get(serieid)+" jfds "+jfreedataset.size()+" datasc "+"
	// nbse "+nbseries);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:20,代码来源:ChartJFreeChartOutputPie.java

示例2: addDiskUsageObservation

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void addDiskUsageObservation(long usedSize, long availableSize) {
	String usedLabel = "已使用"+usedSize/(1024*1024)+"GB";
	String avaiLabel = "未使用"+availableSize/(1024*1024)+"GB";
	dataset.clear();
	dataset.setValue(avaiLabel, availableSize);
	dataset.setValue(usedLabel, usedSize);

	PiePlot plot = (PiePlot)chart.getPlot();
	plot.setExplodePercent(avaiLabel, 0.05);
	plot.setExplodePercent(usedLabel, 0.05);
	plot.setSectionPaint(avaiLabel, Color.BLUE);
	plot.setSectionPaint(usedLabel, Color.RED);
}
 
开发者ID:uestc-lsu,项目名称:LPCM,代码行数:14,代码来源:PieChart.java

示例3: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
   * Creates a demo chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return A chart.
   */
  protected JFreeChart createChart(PieDataset dataset) {
dataset = null;

      JFreeChart chart = ChartFactory.createPieChart(
         chartTitle,  // chart title
          dataset,                // data
          !legendPanelOn,                // include legend
          true,
          false
      );

      PiePlot plot = (PiePlot) chart.getPlot();
      plot.setNoDataMessage(
          "No data available so we go into this really "
          + "long spiel about what that means and it runs off the end of the "
          + "line but what can you do about that!"
      );
      plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10));
      plot.setNoDataMessagePaint(Color.red);
      for (int i=0; i<pulloutFlag.length; i++){
      	//System.out.println("\""+pulloutFlag[i]+"\"");
      	if (isPullout(i)){
      		Comparable key = dataset.getKey(i);
      		plot.setExplodePercent(key, 0.30);
      	}
      }
      
      if(rotateOn){
      	Rotator rotator = new Rotator(plot);
      	rotator.start();
      }
      
setCategorySummary(dataset);
      return chart;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:43,代码来源:PieChartDemo3.java

示例4: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
protected JFreeChart createChart(PieDataset dataset) {
      // create the chart...
      JFreeChart chart = ChartFactory.createPieChart(
          chartTitle,  // chart title
          dataset,             // dataset
          !legendPanelOn,               // include legend
          true,
          false
      );

      // set the background color for the chart...
      chart.setBackgroundPaint(new Color(222, 222, 255));
      PiePlot plot = (PiePlot) chart.getPlot();
      plot.setBackgroundPaint(Color.white);
      plot.setCircular(true);
      for (int i=0; i<pulloutFlag.length; i++){
      	//System.out.println("\""+pulloutFlag[i]+"\"");
      	if (isPullout(i)){
      		Comparable key = dataset.getKey(i);
      		plot.setExplodePercent(key, 0.30);
      	}
      }
      plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}",
              NumberFormat.getNumberInstance(), 
              NumberFormat.getPercentInstance()));
      plot.setNoDataMessage("No data available");

      if(rotateOn){
      	Rotator rotator = new Rotator(plot);
      	rotator.start();
      }
setCategorySummary(dataset);
return chart;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:35,代码来源:PieChartDemo4.java

示例5: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
     * Creates a chart
     * 
     * @param dataset  the dataset.
     * 
     * @return a chart.
     */
    protected JFreeChart createChart(PieDataset dataset) {
       		JFreeChart chart = ChartFactory.createPieChart(
            chartTitle,  // chart title
            dataset,             // data
            !legendPanelOn,                // include legend
            true,
            false
        );
        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");
     
       PiePlot plot = (PiePlot)chart.getPlot();
        for (int i=0; i<pulloutFlag.length; i++){
        	//System.out.println("\""+pulloutFlag[i]+"\"");
        	if (isPullout(i)){
        		Comparable key = dataset.getKey(i);
        		plot.setExplodePercent(key, 0.30);
        	}
        }
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
		
		setCategorySummary(dataset);
		
		if(rotateOn){
	        	Rotator rotator = new Rotator(plot);
	        	rotator.start();
		}
        return chart;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:40,代码来源:PieChartDemo1.java

示例6: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return A chart.
   */
  protected JFreeChart createChart(PieDataset dataset) {
       JFreeChart chart = ChartFactory.createPieChart(
          chartTitle,  // chart title
          dataset,             // dataset
          !legendPanelOn,                // include legend
          true,
          false
      );
   
   PiePlot plot = (PiePlot) chart.getPlot();
      plot.setNoDataMessage("No data available");
      
      for (int i=0; i<pulloutFlag.length; i++){
      	//System.out.println("\""+pulloutFlag[i]+"\"");
      	if (isPullout(i)){
      		Comparable key = dataset.getKey(i);
      		plot.setExplodePercent(key, 0.30);
      	}
      }
      
      plot.setLegendLabelToolTipGenerator(
          new StandardPieSectionLabelGenerator("Tooltip for legend item {0}")
      );

      if(rotateOn){
      	Rotator rotator = new Rotator(plot);
      	rotator.start();
      }
      
setCategorySummary(dataset);
      return chart;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:40,代码来源:PieChartDemo2.java

示例7: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
     * Creates a chart.
     * 
     * @param dataset  the dataset.
     * 
     * @return a chart.
     */
    protected JFreeChart createChart(PieDataset dataset) {
        
		JFreeChart chart = ChartFactory.createPieChart(
            chartTitle,  // chart title
            dataset,             // data
            !legendPanelOn,                // include legend
            true,
            false
        );
        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");
       
        
        PiePlot plot = (PiePlot) chart.getPlot();
        if (!ThreeDPie){
        	for (int i=0; i<pulloutFlag.length; i++){
        	//System.out.println("SuperPieChart\""+pulloutFlag[i]+"\"");
        		if (pulloutFlag[i].equals("1")){
            		Comparable key = dataset.getKey(i);
            		plot.setExplodePercent(key, 0.30);
            	}
        	}
        }
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
		
        return chart;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:38,代码来源:SuperPieChart.java

示例8: createAndShow

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 *
 * @throws Exception
 */
@Override
public void createAndShow() throws Exception{
    piePlt frameToShow;
    //toShow = toShow.replace(" ","");
    if(!toShow.startsWith("piePlt")||toShow.length()<7)
         return;
  String tt = jc.getInside(toShow.substring(7),'(',')'); 
  String title=null,exploded=null,bf="";
  if(tt.indexOf('{')==-1)
      throw new Exception("piePlot is not defined correctly!");
   String txt=tt.substring(0,tt.indexOf('{'));
   for(int i = 0;i<txt.length();i++){
        if(txt.charAt(i) == ','){
            if(bf.contentEquals(""))
                   throw new Exception("piePlot is not defined correctly!");
             if(bf.indexOf('=')!= -1){
                switch (bf.substring(0,bf.indexOf('=')).toLowerCase().trim()) {
                    case "title":
                        if(title != null)
                            throw new Exception("piePlot is not defined correctly!");
                        title=bf.substring(bf.indexOf('=')+1);
                        bf="";
                        break;
                    default:
                        if(exploded != null)
                            throw new Exception("piePlot is not defined correctly!");
                        exploded=bf;
                        bf="";
                        break;
                }
             }
             else{
                 if(title == null){
                     title=bf;
                     bf="";
                 }else
                 throw new Exception("piePlot is not defined correctly!");
             }
        }
        else
            bf=bf+txt.charAt(i);
   }
   if(tt.endsWith("{"))
      throw new Exception("barPlot is not defined correctly!");
   txt = tt.substring(tt.indexOf('{')+1);
   
   frameToShow = new piePlt(title,jc.getInside(txt,'{','}'));
   ChartPanel chartP = new ChartPanel(frameToShow.getChart());
   chartP.setPreferredSize(new java.awt.Dimension(500, 500));
   chartP.setEnforceFileExtensions(false);
   if(exploded != null){
       PiePlot plot = (PiePlot) frameToShow.getChart().getPlot(); 
        plot.setExplodePercent(exploded.substring(0,exploded.indexOf('=')),
                new Double(jc.eval("2dbl("+jc.eval(exploded.substring(exploded.indexOf('=')+1))+")")) );
     }
   frameToShow.setContentPane(chartP);
   frameToShow.setJMenuBar(barPlt.getMenu(frameToShow.getChart(),frameToShow));
   frameToShow.pack();
    RefineryUtilities.centerFrameOnScreen(frameToShow);
   frameToShow.setVisible(true);
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:66,代码来源:piePlt.java

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

示例10: chartPie

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void chartPie() throws PageException, IOException {
	// do dataset
	DefaultPieDataset dataset = new DefaultPieDataset();
	ChartSeriesBean csb =  _series.get(0);
       
	ChartDataBean cdb;
       
	List datas=csb.getDatas();
	if(sortxaxis)Collections.sort(datas);
       Iterator itt = datas.iterator();
   	while(itt.hasNext()) {
   		cdb=(ChartDataBean) itt.next();
   		dataset.setValue(cdb.getItemAsString(), cdb.getValue());
   	}	
	
   	
       JFreeChart chart = show3d?
       		ChartFactory.createPieChart3D	(title, dataset, false, true, true):
       		ChartFactory.createPieChart		(title, dataset, false, true, true);
       
       Plot p = chart.getPlot();
	PiePlot pp = (PiePlot)p;
       
	Font _font = getFont();
       pp.setLegendLabelGenerator(new PieSectionLegendLabelGeneratorImpl(_font,chartwidth));
       pp.setBaseSectionOutlinePaint(Color.GRAY); // border
       pp.setLegendItemShape(new Rectangle(7,7));
       pp.setLabelFont(new Font(font,0,11));
       pp.setLabelLinkPaint(COLOR_333333);
       pp.setLabelLinkMargin(-0.05);
       pp.setInteriorGap(0.123);
       pp.setLabelGenerator(new PieSectionLabelGeneratorImpl(labelFormat));
       
       
       
       
       databackgroundcolor=backgroundcolor;
       
       setBackground(chart,p);
	setBorder(chart,p);
	setLegend(chart,p,_font);
	set3d(p);
	setFont(chart, _font);
       setTooltip(chart);
       setScale(chart);
       
       // Slice Type and colors
       boolean doSclice=pieslicestyle==PIE_SLICE_STYLE_SLICED;
       Color[] colors = csb.getColorlist();
       Iterator it = csb.getDatas().iterator();
       int count=0;
   	while(it.hasNext()) {
   		cdb=(ChartDataBean) it.next();
           if(doSclice)pp.setExplodePercent(cdb.getItemAsString(), 0.13);
           
           if(count<colors.length){
           	pp.setSectionPaint(cdb.getItemAsString(), colors[count]);
           }
           count++;
   	}
       
       writeOut(chart);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:64,代码来源:Chart.java

示例11: updatePlotter

import org.jfree.chart.plot.PiePlot; //导入方法依赖的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


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