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


Java ChartFactory類代碼示例

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


ChartFactory類屬於org.achartengine包,在下文中一共展示了ChartFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: onPostExecute

import org.achartengine.ChartFactory; //導入依賴的package包/類
@Override
protected void onPostExecute(Boolean b) {
	//now run on UI thread
	// possible on back pressed by the time of the task so handle if not view
	if (getView()!=null) {
 	if ( getView().findViewById(R.id.chart_container)!=null) { 
  	LinearLayout chartContainer = (LinearLayout) getView().findViewById(R.id.chart_container);
  	mChartView=ChartFactory.getPieChartView(ReportFragment.this.getActivity(), series, renderer);	        	
  	chartContainer.removeAllViews();
  	chartContainer.addView(mChartView);   	        		
      viewingPieChart=true;	
  	getView().findViewById(android.R.id.list).setVisibility(View.GONE);        		
  	getView().findViewById(R.id.chart_container).setVisibility(View.VISIBLE);	         		       		
      getActivity().supportInvalidateOptionsMenu();
      mChartView.zoomOut();
 	}
	}
    getActivity().setProgressBarIndeterminateVisibility(false);	     		
    long t=System.currentTimeMillis();
    Log.d("Financisto", "Load time = " + (t - t0) + " ms");
}
 
開發者ID:emmanuel-florent,項目名稱:flowzr-android-black,代碼行數:22,代碼來源:ReportFragment.java

示例3: renderGraph

import org.achartengine.ChartFactory; //導入依賴的package包/類
private void renderGraph() {
    mSeries = new XYSeries("Vols/FreqBin");
    div10 = new XYSeries("div10");
    mSeries.add(3,4);
    mRenderer = new XYSeriesRenderer();
    div10Renderer = new XYSeriesRenderer();
    div10Renderer.setColor(root.getResources().getColor(R.color.red));
    dataset.addSeries(mSeries);
    dataset.addSeries(div10);
    renderer.addSeriesRenderer(mRenderer);
    renderer.addSeriesRenderer(div10Renderer);
    renderer.setPanEnabled(false);
    renderer.setZoomEnabled(false);
    mChart = ChartFactory.getLineChartView(getActivity(), dataset, renderer);

    ((LinearLayout)root.findViewById(R.id.chart)).addView(mChart);
}
 
開發者ID:jasper-lu,項目名稱:Doppler-Android-Demo,代碼行數:18,代碼來源:GraphFragment.java

示例4: execute

import org.achartengine.ChartFactory; //導入依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  String[] titles = new String[] { "2008", "2007" };
  List<double[]> values = new ArrayList<double[]>();
  values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
      12600, 14000 });
  values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
      11600, 13500 });
  int[] colors = new int[] { Color.BLUE, Color.CYAN };
  XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
  setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
      12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
  ((XYSeriesRenderer) renderer.getSeriesRendererAt(0)).setDisplayChartValues(true);
  ((XYSeriesRenderer) renderer.getSeriesRendererAt(1)).setDisplayChartValues(true);
  renderer.setXLabels(12);
  renderer.setYLabels(10);
  renderer.setXLabelsAlign(Align.LEFT);
  renderer.setYLabelsAlign(Align.LEFT);
  renderer.setPanEnabled(true, false);
  // renderer.setZoomEnabled(false);
  renderer.setZoomRate(1.1f);
  renderer.setBarSpacing(0.5f);
  return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
      Type.STACKED);
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:31,代碼來源:SalesStackedBarChart.java

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

示例6: execute

import org.achartengine.ChartFactory; //導入依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  List<double[]> values = new ArrayList<double[]>();
  values.add(new double[] { 12, 14, 11, 10, 19 });
  values.add(new double[] { 10, 9, 14, 20, 11 });
  List<String[]> titles = new ArrayList<String[]>();
  titles.add(new String[] { "P1", "P2", "P3", "P4", "P5" });
  titles.add(new String[] { "Project1", "Project2", "Project3", "Project4", "Project5" });
  int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };

  DefaultRenderer renderer = buildCategoryRenderer(colors);
  renderer.setApplyBackgroundColor(true);
  renderer.setBackgroundColor(Color.rgb(222, 222, 200));
  renderer.setLabelsColor(Color.GRAY);
  return ChartFactory.getDoughnutChartIntent(context,
      buildMultipleCategoryDataset("Project budget", titles, values), renderer,
      "Doughnut chart demo");
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:24,代碼來源:BudgetDoughnutChart.java

示例7: onListItemClick

import org.achartengine.ChartFactory; //導入依賴的package包/類
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  super.onListItemClick(l, v, position, id);
  switch (position) {
  case 0:
    Intent intent = ChartFactory.getLineChartIntent(this, getDemoDataset(), getDemoRenderer());
    startActivity(intent);
    break;
  case 1:
    intent = ChartFactory.getScatterChartIntent(this, getDemoDataset(), getDemoRenderer());
    startActivity(intent);
    break;
  case 2:
    intent = ChartFactory.getTimeChartIntent(this, getDateDemoDataset(), getDemoRenderer(), null);
    startActivity(intent);
    break;
  case 3:
    XYMultipleSeriesRenderer renderer = getBarDemoRenderer();
    setChartSettings(renderer);
    intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT);
    startActivity(intent);
    break;
  }
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:25,代碼來源:GeneratedChartDemo.java

示例8: onResume

import org.achartengine.ChartFactory; //導入依賴的package包/類
@Override
public void onResume()
{
	super.onResume();
       LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
       if (mChart == null) {
           initChart();
           //addSampleData();
           mChart = ChartFactory.getCubeLineChartView(this, mDataset, mRenderer, 0.3f);
           layout.addView(mChart);
       } else {
           mChart.repaint();
       }
   
	trigger();
	
	
	
}
 
開發者ID:gskielian,項目名稱:Android_Digital-Voltage-Meter_HW-App,代碼行數:20,代碼來源:MainActivity.java

示例9: execute

import org.achartengine.ChartFactory; //導入依賴的package包/類
public GraphicalView execute(Context context){ 

	int[] colors = new int[]{Color.GREEN, Color.LTGRAY, Color.BLUE, Color.RED, Color.DKGRAY, Color.MAGENTA}; 
	DefaultRenderer renderer = buildCategoryRenderer(colors); 
	CategorySeries categorySeries = new CategorySeries("Resolution Ratio Chart");
	
	// Calculating normalization coefficient
	double valueSum = 0;
	for(int i = 0;i < value.length;i++){
		valueSum += value[i];
	}
	
	// Adding data to Series
	for(int i = 0;i < Playbackquality.length;i++){
		categorySeries.add(Playbackquality[i], value[i]/valueSum); 
	}
	
	return ChartFactory.getPieChartView(context, categorySeries, renderer);          
}
 
開發者ID:leftdal,項目名稱:youslow,代碼行數:20,代碼來源:PieChart.java

示例10: onCreateView

import org.achartengine.ChartFactory; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
	View v = inflater.inflate(R.layout.fragment_food_sources, parent, false);
	
	TextView mNutrientNameField = (TextView)v.findViewById(R.id.sources_for_nutrient);
	mNutrientNameField.setText("Sources for: \n" + mNutrient.getName());
	
	LinearLayout chart_holder = (LinearLayout) v.findViewById(R.id.chart);
	if (mNutrient.getSources().size() == 0) {
		TextView no_data = new TextView(getActivity());
		no_data.setText("No data found");
		chart_holder.addView(no_data);
	} else {
        if (mChart == null) {
            addSampleData();
            mChart = ChartFactory.getPieChartView(getActivity(), mDataset, mRenderer);
            chart_holder.addView(mChart);
        } else {
            mChart.repaint();
        }
	}
	return v;
}
 
開發者ID:alixander,項目名稱:NutriHawk,代碼行數:24,代碼來源:FoodSourcesFragment.java

示例11: updateChart

import org.achartengine.ChartFactory; //導入依賴的package包/類
private void updateChart() {
    XYMultipleSeriesDataset data = new XYMultipleSeriesDataset();
    CategorySeries correctSeries = new CategorySeries("Correct");
    CategorySeries wrongSeries = new CategorySeries("Wrong");

    int correct = mPlayStats.getNumberCorrect(mCard);
    int wrong = mPlayStats.getNumberWrong(mCard);

    mStatsLabel.setText(correct + " Correct, " + wrong + " Wrong");

    correctSeries.add("Correct", correct);
    wrongSeries.add("Wrong", wrong);

    data.addSeries(correctSeries.toXYSeries());
    data.addSeries(wrongSeries.toXYSeries());

    barRenderer.setYAxisMax(Math.max(correct, wrong));

    mBarChartView = ChartFactory.getBarChartView(getContext(), data, barRenderer, BarChart.Type.DEFAULT);

    mChartLayout.removeAllViews();
    mChartLayout.addView(mBarChartView);
}
 
開發者ID:PhaniGaddipati,項目名稱:Stacks-Flashcards,代碼行數:24,代碼來源:StatsCardView.java

示例12: createChart

import org.achartengine.ChartFactory; //導入依賴的package包/類
private GraphicalView createChart(Context context, ResponseGetDeviceInfo deviceInfo) {
   int[] colors = new int[] { context.getResources().getColor(R.color.darkRed),
   		context.getResources().getColor(R.color.verdeOscuro)}; 
   DefaultRenderer renderer = buildCategoryRenderer(colors);
   renderer.setZoomButtonsVisible(true);
   renderer.setZoomEnabled(true);
   renderer.setChartTitleTextSize(20);
   	    
   renderer.setLabelsColor(Color.BLACK);
   
   CategorySeries categorySeries = new CategorySeries("");
   try {
   	//Title in the graph
    renderer.setChartTitle(deviceInfo.getAccessPath() + " ("+deviceInfo.getSizeHuman()+")"); //It is the drive name
    
    long usedInNumeric = deviceInfo.getSize() - deviceInfo.getFreeDiskSpace();
    //TODO i18n words 'used' and 'free' 
    categorySeries.add("Used " + deviceInfo.getUsedDiskSpaceHuman(), usedInNumeric);
    categorySeries.add("Free " + deviceInfo.getFreeDiskSpaceHuman(), deviceInfo.getFreeDiskSpace());
   } catch (Exception e) {
   	showToastError(R.string.error_parsing_data);
}
   return ChartFactory.getPieChartView(context, categorySeries, renderer);	
  }
 
開發者ID:vikingbrain,項目名稱:droidedmediatank,代碼行數:25,代碼來源:DiskUsageActivity.java

示例13: execute

import org.achartengine.ChartFactory; //導入依賴的package包/類
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  String[] titles = new String[] { "2008", "2007" };
  List<double[]> values = new ArrayList<double[]>();
  values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
      12600, 14000 });
  values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
      11600, 13500 });
  int[] colors = new int[] { Color.BLUE, Color.CYAN };
  XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
  setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
      12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
  renderer.getSeriesRendererAt(0).setDisplayChartValues(true);
  renderer.getSeriesRendererAt(1).setDisplayChartValues(true);
  renderer.setXLabels(12);
  renderer.setYLabels(10);
  renderer.setXLabelsAlign(Align.LEFT);
  renderer.setYLabelsAlign(Align.LEFT);
  renderer.setPanEnabled(true, false);
  // renderer.setZoomEnabled(false);
  renderer.setZoomRate(1.1f);
  renderer.setBarSpacing(0.5f);
  return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
      Type.STACKED);
}
 
開發者ID:SamKnows,項目名稱:skandroid-core,代碼行數:31,代碼來源:SalesStackedBarChart.java

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

示例15: onCreateView

import org.achartengine.ChartFactory; //導入依賴的package包/類
@Override
public View onCreateView(final LayoutInflater inflater,
		final ViewGroup container, final Bundle savedInstanceState) {
	Log.d(TAG, "onCreateView");

	if (Configuration.ORIENTATION_PORTRAIT == getResources()
			.getConfiguration().orientation) {
		mRenderer.setYLabels(15);
	}

	final LinearLayout view = (LinearLayout) inflater.inflate(
			R.layout.fragment_daymode_chart, container, false);
	mChartView = ChartFactory.getTimeChartView(getActivity(), mDataset,
			mRenderer, TIME);
	mChartView.addZoomListener(mZoomListener, true, false);
	view.addView(mChartView, new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.WRAP_CONTENT));
	return view;
}
 
開發者ID:moguai2k,項目名稱:ProjektWerkstatt13,代碼行數:20,代碼來源:DaymodeFragment.java


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