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


Java ChartFactory.getPieChartView方法代碼示例

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


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

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

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

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

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

示例5: onResume

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@Override
protected void onResume() {
  super.onResume();
  if (mChartView == null) {
    LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
    mChartView = ChartFactory.getPieChartView(this, mSeries, mRenderer);
    mRenderer.setClickEnabled(true);
    mChartView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
        if (seriesSelection == null) {
          Toast.makeText(PieChartBuilder.this, "No chart element selected", Toast.LENGTH_SHORT)
              .show();
        } else {
          for (int i = 0; i < mSeries.getItemCount(); i++) {
            mRenderer.getSeriesRendererAt(i).setHighlighted(i == seriesSelection.getPointIndex());
          }
          mChartView.repaint();
          Toast.makeText(
              PieChartBuilder.this,
              "Chart data point index " + seriesSelection.getPointIndex() + " selected"
                  + " point value=" + seriesSelection.getValue(), Toast.LENGTH_SHORT).show();
        }
      }
    });
    layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.FILL_PARENT));
  } else {
    mChartView.repaint();
  }
}
 
開發者ID:ddanny,項目名稱:achartengine,代碼行數:33,代碼來源:PieChartBuilder.java

示例6: updatePieChart

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
private void updatePieChart() {
    DefaultRenderer pieRenderer = new DefaultRenderer();
    SimpleSeriesRenderer correctRenderer = new SimpleSeriesRenderer();
    SimpleSeriesRenderer wrongRenderer = new SimpleSeriesRenderer();

    correctRenderer.setColor(correctColor);
    wrongRenderer.setColor(wrongColor);

    pieRenderer.addSeriesRenderer(correctRenderer);
    pieRenderer.addSeriesRenderer(wrongRenderer);
    if (!Themes.get(getContext()).isThemeDark()) {
        pieRenderer.setLabelsColor(Color.DKGRAY);
    } else {
        pieRenderer.setLabelsColor(Color.WHITE);
    }
    pieRenderer.setLabelsTextSize(spToPixels(14));
    pieRenderer.setShowLegend(false);
    pieRenderer.setZoomEnabled(false);
    pieRenderer.setPanEnabled(false);
    pieRenderer.setChartTitleTextSize(spToPixels(20));
    pieRenderer.setStartAngle(45);
    pieRenderer.setScale(1.1f);

    CategorySeries data = new CategorySeries("Overview");
    data.add(playStats.getTotalCorrect() + " Correct", playStats.getTotalCorrect());
    data.add(playStats.getTotalWrong() + " Wrong", playStats.getTotalWrong());

    pieChartView = ChartFactory.getPieChartView(getContext(), data, pieRenderer);
    pieLayout.removeAllViews();
    pieLayout.addView(pieChartView);
}
 
開發者ID:PhaniGaddipati,項目名稱:Stacks-Flashcards,代碼行數:32,代碼來源:StatsPieView.java

示例7: onResume

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@Override
protected void onResume() {
	super.onResume();
	if (mChartView == null) {
		LinearLayout layout = (LinearLayout) findViewById(R.id.chart_cnvs_chart);
		mChartView = ChartFactory.getPieChartView(this, mSeries, mRenderer);
		mRenderer.setClickEnabled(true);
		mRenderer.setSelectableBuffer(10);

		mChartView.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Button btnSendData = (Button) findViewById(R.id.btn_sendData);
				btnSendData.setEnabled(true);
				TextView userMessage = (TextView) findViewById(R.id.txtMessage);
				userMessage
						.setText("Program assumes internet connectivity exists.");
			}
		});

		layout.addView(mChartView, new LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	} else {
		mChartView.repaint();
	}

}
 
開發者ID:fahadzafar,項目名稱:PubNubTest,代碼行數:28,代碼來源:MainActivity.java

示例8: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Server pServer)
{

  Resources r = getActivity().getResources();
  int[] COLORS = new int[]{
      r.getColor(R.color.cpu_free),
      r.getColor(R.color.cpu_used)};

  String[] NAME_LIST = new String[]{
      getActivity().getString(R.string.unused_cpu),
      getActivity().getString(R.string.jvm_cpu)};

  updateLegend(NAME_LIST, COLORS);

  TextView cpuHeader = (TextView) getActivity().findViewById(R.id.cpu_chart_header);
  if (cpuHeader != null)
    cpuHeader.setText(getActivity().getString(R.string.jvm_cpu) + " - " + percentFormat.format(pServer.getJvmProcessorLoad() * 100) + "% " + getActivity().getString(R.string.load));

  double[] VALUES = new double[]{1.0 - pServer.getJvmProcessorLoad(), pServer.getJvmProcessorLoad()};

  mRenderer.setChartTitle(getActivity().getString(R.string.jvm_cpu));

  for (int i = 0; i < VALUES.length; i++)
  {
    mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
    SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
    renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
    mRenderer.addSeriesRenderer(renderer);
  }

  GraphicalView pieChartView = ChartFactory.getPieChartView(getActivity(), mSeries, mRenderer);

  LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.cpu_chart_graphic);
  if (layout != null)
    layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

  pieChartView.repaint();
}
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:39,代碼來源:JVMCPUPieChart.java

示例9: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Application pApp)
  {

    TextView healthHeader = (TextView) getActivity().findViewById(R.id.app_target_state_chart_header);
    healthHeader.setText(getActivity().getString(R.string.application_target_state));

    HashMap<TargetState, Integer> countMap = new HashMap<TargetState, Integer>(7);

    for (ApplicationTargetState instance : pApp.getTargetStates())
    {
      TargetState state = instance.getState();

      if (state == null || state.toString().equals("null"))
      {
        state = TargetState.STATE_UNKNOWN;
      }

      Integer theCount = countMap.get(state);

      if (theCount == null)
      {
        theCount = 0;
      }

      countMap.put(state, ++theCount);
    }

    List<Integer> valueList = new ArrayList<Integer>(countMap.size());
    List<Integer> colorList = new ArrayList<Integer>(countMap.size());
    List<String> nameList = new ArrayList<String>(countMap.size());

    for (Map.Entry<TargetState, Integer> entry : countMap.entrySet())
    {
      colorList.add(getActivity().getResources().getColor(entry.getKey().getColorID()));
//      colorList.add(activity.getResources().getColor(STATE_COLOR_MAP.get(entry.getKey())));
      valueList.add(entry.getValue());
      nameList.add(entry.getKey().toString());
    }

    Integer[] VALUES = valueList.toArray(new Integer[valueList.size()]);
    Integer[] COLORS = colorList.toArray(new Integer[valueList.size()]);
    String[] NAME_LIST = nameList.toArray(new String[valueList.size()]);

    updateLegend(NAME_LIST, COLORS, R.id.app_target_state_chart_legend);

    for (int i = 0; i < VALUES.length; i++)
    {
      mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
      SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
      renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
      mRenderer.addSeriesRenderer(renderer);
    }

    GraphicalView pieChartView = ChartFactory.getPieChartView(getActivity(), mSeries, mRenderer);

    LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.app_target_state_chart_graphic);
    layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    pieChartView.repaint();
  }
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:61,代碼來源:ApplicationTargetStatePieChart.java

示例10: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Activity activity, Datasource pDatasource)
{

  TextView healthHeader = (TextView) activity.findViewById(R.id.instance_chart_header);
  if (healthHeader != null)
    healthHeader.setText(activity.getString(R.string.datasource_instance_state));

  HashMap<DatasourceInstanceState, Integer> countMap = new HashMap<DatasourceInstanceState, Integer>(7);

  for (DatasourceInstance instance : pDatasource.getInstances())
  {
    DatasourceInstanceState health = instance.getState();

    if (health == null || health.toString().equals("null"))
    {
      health = DatasourceInstanceState.Unknown;
    }

    Integer theCount = countMap.get(health);

    if (theCount == null)
    {
      theCount = 0;
    }

    countMap.put(health, ++theCount);
  }

  List<Integer> valueList = new ArrayList<Integer>(countMap.size());
  List<Integer> colorList = new ArrayList<Integer>(countMap.size());
  List<String> nameList = new ArrayList<String>(countMap.size());

  for (Map.Entry<DatasourceInstanceState, Integer> entry : countMap.entrySet())
  {
    colorList.add(activity.getResources().getColor(entry.getKey().getColorID()));
    valueList.add(entry.getValue());
    nameList.add(entry.getKey().toString());
  }

  Integer[] VALUES = valueList.toArray(new Integer[valueList.size()]);
  Integer[] COLORS = colorList.toArray(new Integer[valueList.size()]);
  String[] NAME_LIST = nameList.toArray(new String[valueList.size()]);

  updateLegend(NAME_LIST, COLORS, R.id.ds_instance_state_chart_legend);

  for (int i = 0; i < VALUES.length; i++)
  {
    mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
    SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
    renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
    mRenderer.addSeriesRenderer(renderer);
  }

  GraphicalView pieChartView = ChartFactory.getPieChartView(activity, mSeries, mRenderer);

  LinearLayout layout = (LinearLayout) activity.findViewById(R.id.ds_instance_state_chart_graphic);
  layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

  pieChartView.repaint();
}
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:61,代碼來源:DatasourceInstancePieChart.java

示例11: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Server pServer)
{

  double pctFree = pServer.getPercentHeapUnallocated();
  double pctAllocUsed = pServer.getPercentHeapCurrentUsed();
  double pctAllocUnused = pServer.getPercentHeapCurrentFree();

  TextView heapHeader = (TextView) getActivity().findViewById(R.id.heap_chart_header);

  if (heapHeader != null)
    heapHeader.setText(getActivity().getString(R.string.jvm_heap) + " - " + percentFormat.format(pctAllocUsed * 100) + "% " + getActivity().getString(R.string.used));

  String[]
      NAME_LIST = new String[]{
      getActivity().getString(R.string.heap_unallocated),
      getActivity().getString(R.string.heap_allocated_free),
      getActivity().getString(R.string.heap_allocated_used)};

  double[] VALUES = new double[]{pctFree, pctAllocUnused, pctAllocUsed};
  Resources r = getActivity().getResources();
  Integer[] COLORS = new Integer[]{
      r.getColor(R.color.heap_unused),
      r.getColor(R.color.heap_alloc_unused),
      r.getColor(R.color.heap_alloc_used)};

  updateLegend(NAME_LIST, COLORS, R.id.heap_chart_legend);

  mRenderer.setChartTitle(getActivity().getString(R.string.jvm_heap));

  for (int i = 0; i < VALUES.length; i++)
  {
    mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
    SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
    renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
    mRenderer.addSeriesRenderer(renderer);
  }

  GraphicalView pieChartView = ChartFactory.getPieChartView(getActivity(), mSeries, mRenderer);

  LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.heap_chart_graphic);
  if (layout != null)
    layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

  pieChartView.repaint();
}
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:46,代碼來源:JVMHeapPieChart.java

示例12: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Cluster pCluster)
{

  TextView healthHeader = (TextView) getActivity().findViewById(R.id.server_state_chart_header);
  healthHeader.setText(getActivity().getString(R.string.server_state));

  HashMap<ServerState, Integer> countMap = new HashMap<ServerState, Integer>(7);

  for (ClusterServer server : pCluster.getServers())
  {
    if (server.getState() == null || server.getState().toString().equals("null"))
    {
      continue;
    }
    Integer theCount = countMap.get(server.getState());

    if (theCount == null)
    {
      theCount = 0;
    }

    countMap.put(server.getState(), ++theCount);
  }

  List<Integer> valueList = new ArrayList<Integer>(countMap.size());
  List<Integer> colorList = new ArrayList<Integer>(countMap.size());
  List<String> nameList = new ArrayList<String>(countMap.size());

  for (Map.Entry<ServerState, Integer> entry : countMap.entrySet())
  {
    colorList.add(getActivity().getResources().getColor(entry.getKey().getColorID()));
    valueList.add(entry.getValue());
    nameList.add(entry.getKey().toString());
  }

  Integer[] VALUES = valueList.toArray(new Integer[valueList.size()]);
  Integer[] COLORS = colorList.toArray(new Integer[valueList.size()]);
  String[] NAME_LIST = nameList.toArray(new String[valueList.size()]);

  updateLegend(NAME_LIST, COLORS);

  mRenderer.setChartTitle(getActivity().getString(R.string.jvm_cpu));

  for (int i = 0; i < VALUES.length; i++)
  {
    mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
    SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
    renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
    mRenderer.addSeriesRenderer(renderer);
  }

  GraphicalView pieChartView = ChartFactory.getPieChartView(getActivity(), mSeries, mRenderer);

  LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.server_state_chart_graphic);
  layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

  pieChartView.repaint();
}
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:59,代碼來源:ClusterServerStatePieChart.java

示例13: update

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void update(Cluster pCluster)
{

  TextView healthHeader = (TextView) getActivity().findViewById(R.id.server_health_chart_header);
  healthHeader.setText(getActivity().getString(R.string.server_health));

  HashMap<ServerHealth, Integer> countMap = new HashMap<ServerHealth, Integer>(7);

  for (ClusterServer server : pCluster.getServers())
  {
    ServerHealth health = server.getHealth();

    if (health == null || health.toString().equals("null"))
    {
      health = ServerHealth.UNKNOWN;
    }

    Integer theCount = countMap.get(health);

    if (theCount == null)
    {
      theCount = 0;
    }

    countMap.put(health, ++theCount);
  }

  List<Integer> valueList = new ArrayList<Integer>(countMap.size());
  List<Integer> colorList = new ArrayList<Integer>(countMap.size());
  List<String> nameList = new ArrayList<String>(countMap.size());

  for (Map.Entry<ServerHealth, Integer> entry : countMap.entrySet())
  {
    colorList.add(getActivity().getResources().getColor(entry.getKey().getColorID()));
    valueList.add(entry.getValue());
    nameList.add(entry.getKey().toString());
  }

  Integer[] VALUES = valueList.toArray(new Integer[valueList.size()]);
  Integer[] COLORS = colorList.toArray(new Integer[valueList.size()]);
  String[] NAME_LIST = nameList.toArray(new String[valueList.size()]);

  updateLegend(NAME_LIST, COLORS, R.id.server_health_chart_legend);

  for (int i = 0; i < VALUES.length; i++)
  {
    mSeries.add(NAME_LIST[i] + " " + VALUES[i], VALUES[i]);
    SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
    renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
    mRenderer.addSeriesRenderer(renderer);
  }

  GraphicalView pieChartView = ChartFactory.getPieChartView(getActivity(), mSeries, mRenderer);

  LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.server_health_chart_graphic);
  layout.addView(pieChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

  pieChartView.repaint();
}
 
開發者ID:jeffreyawest,項目名稱:android-weblogic-monitor,代碼行數:60,代碼來源:ClusterServerHealthPieChart.java


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