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


Java ChartFactory.getPieChartIntent方法代碼示例

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


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

示例1: createPieChart

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
private Intent createPieChart() {
    DefaultRenderer renderer = new DefaultRenderer();
    renderer.setLabelsTextSize(getResources().getDimension(R.dimen.report_labels_text_size));
    renderer.setLegendTextSize(getResources().getDimension(R.dimen.report_legend_text_size));
    renderer.setMargins(new int[] { 0, 0, 0, 0 });
    ReportData report = currentReport.getReportForChart(db, WhereFilter.copyOf(filter));
    CategorySeries series = new CategorySeries("AAA");
    long total = Math.abs(report.total.amount)+Math.abs(report.total.balance);
    int[] colors = generateColors(2*report.units.size());
    int i = 0;
    for (GraphUnit unit : report.units) {
        addSeries(series, renderer, unit.name, unit.getIncomeExpense().income, total, colors[i++]);
        addSeries(series, renderer, unit.name, unit.getIncomeExpense().expense, total, colors[i++]);
    }
    renderer.setZoomButtonsVisible(true);
    renderer.setZoomEnabled(true);
    renderer.setChartTitleTextSize(20);
    return ChartFactory.getPieChartIntent(ReportActivity.this, series, renderer, getString(R.string.report));
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:20,代碼來源:ReportActivity.java

示例2: execute

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  double[] values = new double[] { 12, 14, 11, 10, 19 };
  int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };
  DefaultRenderer renderer = buildCategoryRenderer(colors);
  renderer.setZoomButtonsVisible(true);
  renderer.setZoomEnabled(true);
  renderer.setChartTitleTextSize(20);
  renderer.setDisplayValues(true);
  renderer.setShowLabels(true);
  SimpleSeriesRenderer r = renderer.getSeriesRendererAt(0);
  r.setGradientEnabled(true);
  r.setGradientStart(0, Color.BLUE);
  r.setGradientStop(0, Color.GREEN);
  r.setHighlighted(true);
  Intent intent = ChartFactory.getPieChartIntent(context,
      buildCategoryDataset("Project budget", values), renderer, "Budget");
  return intent;
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:25,代碼來源:BudgetPieChart.java

示例3: execute

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  double[] values = new double[] { 12, 14, 11, 10, 19 };
  int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };
  DefaultRenderer renderer = buildCategoryRenderer(colors);
  renderer.setZoomButtonsVisible(true);
  renderer.setZoomEnabled(true);
  renderer.setChartTitleTextSize(20);
  renderer.setDisplayValues(true);
  renderer.setShowLabels(false);
  SimpleSeriesRenderer r = renderer.getSeriesRendererAt(0);
  r.setGradientEnabled(true);
  r.setGradientStart(0, Color.BLUE);
  r.setGradientStop(0, Color.GREEN);
  r.setHighlighted(true);
  Intent intent = ChartFactory.getPieChartIntent(context,
      buildCategoryDataset("Project budget", values), renderer, "Budget");
  return intent;
}
 
開發者ID:SamKnows,項目名稱:skandroid-core,代碼行數:25,代碼來源:BudgetPieChart.java

示例4: execute

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
/**
    * This method will generate the correct Android Intent class for pie chart generation, which
    * which will then be used by the caller to call "startActivity()" in order to actually create
    * the pie chart (via the listening third-party library).
    * 
    * @param context     The context of the current application
    * @param screenTitle The title of the pie chart
    * @param statTitles  The respective name of each pie chart section 
    * @param statValues  The respective percentage of each pie chart section
    * @return The Intent that's used to actually create the pie chart.
    */
   public Intent execute(Context context, String screenTitle, String[] statTitles, double[] statValues) {
	
	String[] titles = null;
    double[] values = null;
    int[]    colors = null;
    
    if (statValues != null) {
        values = statValues;
        titles = statTitles;
    }
    else {
    	values = new double[] { 12, 14, 11, 10, 19 };
    	titles = new String[] { "Alpha", "Beta", "Charlie", "Delta", "Epsilon" };
    }
    
    if (values.length == 1)
    	colors = new int[] { Color.BLUE };
    else if (values.length == 2)
        colors = new int[] { Color.BLUE, Color.GREEN };
    else if (values.length == 3)
        colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA };
    else if (values.length == 4)
        colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, };
    else if (values.length == 5)
        colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };
    else if (values.length == 6)
    	colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN
    		                 , Color.LTGRAY };
    else if (values.length == 7)
    	colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN
                                , Color.LTGRAY, Color.RED };
    else if (values.length == 8)
    	colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN
                                , Color.LTGRAY, Color.RED, Color.GRAY };
    else if (values.length == 9)
    	colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN
                                , Color.LTGRAY, Color.RED, Color.GRAY, Color.DKGRAY };
    else
    	colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN
                                , Color.LTGRAY, Color.RED, Color.GRAY, Color.DKGRAY, Color.rgb(128, 255, 0) };
    
    DefaultRenderer renderer = buildCategoryRenderer(colors);
    
    renderer.setZoomButtonsVisible(false);
    renderer.setZoomEnabled(true);
    
    renderer.setBackgroundColor( Color.BLACK );	    
    renderer.setApplyBackgroundColor(true);
    
    renderer.setChartTitle(screenTitle);
    renderer.setChartTitleTextSize(22);
    	    
    return ChartFactory.getPieChartIntent(context, 
    		                              buildCategoryDataset("Statistics Breakdown", values, titles),
                                          renderer, 
                                          screenTitle);
}
 
開發者ID:jaerith,項目名稱:BibliophilePlus_Android,代碼行數:69,代碼來源:ChartStatsActivity.java


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