当前位置: 首页>>代码示例>>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;未经允许,请勿转载。