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


Java SimpleSeriesRenderer.setColor方法代码示例

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


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

示例1: buildBarRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Builds a bar multiple series renderer to use the provided colors.
 * 
 * @param colors
 *            the series renderers colors
 * @return the bar multiple series renderer
 */
protected XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
	XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
	renderer.setAxisTitleTextSize(16);
	renderer.setChartTitleTextSize(20);
	renderer.setLabelsTextSize(15);
	renderer.setLegendTextSize(15);

	int length = colors.length;
	for (int i = 0; i < length; i++) {
		SimpleSeriesRenderer r = new SimpleSeriesRenderer();
		r.setColor(colors[i]);
		renderer.addSeriesRenderer(r);
	}
	return renderer;
}
 
开发者ID:jhmgbl,项目名称:learnforandroidfragAS,代码行数:23,代码来源:AbstractDemoChart.java

示例2: buildCategoryRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
protected DefaultRenderer buildCategoryRenderer(int[] colors){ 
    DefaultRenderer renderer = new DefaultRenderer();
    renderer.setBackgroundColor(Color.BLACK);
    renderer.setApplyBackgroundColor(true);
    renderer.setLabelsColor(Color.WHITE);
    renderer.setDisplayValues(true);
    renderer.setPanEnabled(false);
    renderer.setZoomEnabled(false);
    renderer.setInScroll(true);
    renderer.setChartTitle(chartTitle);
    
    // Changing font size
    renderer.setLabelsTextSize(26);
    renderer.setLegendTextSize(26);
    renderer.setLegendHeight(50);
    renderer.setChartTitleTextSize(28);
    
    for (int color : colors) { 
        SimpleSeriesRenderer r = new SimpleSeriesRenderer(); 
        r.setColor(color); 
        r.setChartValuesFormat(NumberFormat.getPercentInstance());             
        renderer.addSeriesRenderer(r); 
    }    
    
    return renderer; 
}
 
开发者ID:leftdal,项目名称:youslow,代码行数:27,代码来源:PieChart.java

示例3: RenderChart

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
static void RenderChart() {
	// Render chart responsibility is handled here. First the previous
	// value are cleared.
	// mRenderer.removeAllRenderers();

	int total = mSeries.getItemCount();
	for (int i = total - 1; i > -1; i--) {
		mSeries.set(0, NAME_LIST[i] + "B-" + VALUES[i] + "ms", VALUES[i]);
	}

	// The new values are added to the chart engine.
	for (int i = 0; i < VALUES.length; i++) {
		mSeries.add(NAME_LIST[i] + "B-" + VALUES[i] + "ms", VALUES[i]);
		SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
		renderer.setColor(COLORS[(mSeries.getItemCount() - 1)
				% COLORS.length]);
		mRenderer.addSeriesRenderer(renderer);
	}

	// The chart view is updated.
	if (mChartView != null) {
		mChartView.repaint();
	}

}
 
开发者ID:fahadzafar,项目名称:PubNubTest,代码行数:26,代码来源:MainActivity.java

示例4: addSeries

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
private void addSeries(CategorySeries series, DefaultRenderer renderer, String name, BigDecimal expense, long total, int color) {
    long amount = expense.longValue();
    if (amount != 0 && total != 0) {
        long percentage = 100*Math.abs(amount)/total;
        series.add((amount > 0 ? "+" : "-") + name + "(" + percentage + "%)", percentage);
        SimpleSeriesRenderer r = new SimpleSeriesRenderer();
        r.setColor(color);
        renderer.addSeriesRenderer(r);
    }
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:11,代码来源:ReportActivity.java

示例5: getDonutRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
public DefaultRenderer getDonutRenderer(int[] colors, int b) {

		DefaultRenderer renderer = new DefaultRenderer();

		renderer.setLabelsTextSize(15);
		renderer.setLegendTextSize(15);
		renderer.setMargins(new int[] { 20, 30, 15, 0 });

		renderer.setApplyBackgroundColor(true);

		renderer.setBackgroundColor(b);

		Log.d("colors", "" + colors[0]);
		for (int color : colors) {
			SimpleSeriesRenderer r = new SimpleSeriesRenderer();
			r.setColor(color);
			renderer.addSeriesRenderer(r);
		}

		renderer.setLabelsColor(Color.GRAY);

		renderer.setZoomEnabled(false);
		renderer.setZoomButtonsVisible(false);
		renderer.setShowLabels(false);
		renderer.setPanEnabled(false);
		renderer.setShowLegend(false);
		renderer.setApplyBackgroundColor(false);
		renderer.setMargins(new int[] { 0, 0, 0, 0 });
		renderer.setInScroll(true);
		return renderer;

	}
 
开发者ID:asimiqbalmalik,项目名称:DemoDoughnutChartWithTextInside,代码行数:33,代码来源:MainActivity.java

示例6: buildCategoryRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Builds a category renderer to use the provided colors.
 * 
 * @param colors the colors
 * @return the category renderer
 */
protected DefaultRenderer buildCategoryRenderer(int[] colors) {
  DefaultRenderer renderer = new DefaultRenderer();
  renderer.setLabelsTextSize(15);
  renderer.setLegendTextSize(15);
  renderer.setMargins(new int[] { 20, 30, 15, 0 });
  for (int color : colors) {
    SimpleSeriesRenderer r = new SimpleSeriesRenderer();
    r.setColor(color);
    renderer.addSeriesRenderer(r);
  }
  return renderer;
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:19,代码来源:AbstractDemoChart.java

示例7: buildBarRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Builds a bar multiple series renderer to use the provided colors.
 * 
 * @param colors the series renderers colors
 * @return the bar multiple series renderer
 */
protected XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
  XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
  renderer.setAxisTitleTextSize(16);
  renderer.setChartTitleTextSize(20);
  renderer.setLabelsTextSize(15);
  renderer.setLegendTextSize(15);
  int length = colors.length;
  for (int i = 0; i < length; i++) {
    SimpleSeriesRenderer r = new SimpleSeriesRenderer();
    r.setColor(colors[i]);
    renderer.addSeriesRenderer(r);
  }
  return renderer;
}
 
开发者ID:jaerith,项目名称:BibliophilePlus_Android,代码行数:21,代码来源:ChartActivityBase.java

示例8: buildCategoryRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Builds a category renderer to use the provided colors.
 * 
 * @param colors
 *            the colors
 * @return the category renderer
 */
protected DefaultRenderer buildCategoryRenderer(int[] colors) {
	DefaultRenderer renderer = new DefaultRenderer();
	renderer.setLabelsTextSize(15);
	renderer.setLegendTextSize(15);
	renderer.setMargins(new int[] { 20, 30, 15, 0 });
	for (int color : colors) {
		SimpleSeriesRenderer r = new SimpleSeriesRenderer();
		r.setColor(color);
		renderer.addSeriesRenderer(r);
	}
	return renderer;
}
 
开发者ID:jhmgbl,项目名称:learnforandroidfragAS,代码行数:20,代码来源:AbstractDemoChart.java

示例9: addSampleData

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
private void addSampleData() {
for (int i = 0; i < mNutrient.getSources().size(); i++) {
	mDataset.add(mNutrient.getSources().get(i), 1);
}
  	int []colors = new int[]{Color.MAGENTA, Color.WHITE, Color.GREEN, Color.CYAN, Color.GRAY, Color.BLUE, Color.RED, Color.YELLOW};
  	for (int i = 0; i < mNutrient.getSources().size(); i++) {
  		SimpleSeriesRenderer r = new SimpleSeriesRenderer();
          r.setColor(colors[i]);
          r.setDisplayBoundingPoints(true);
          r.setDisplayChartValuesDistance(15);
          r.setDisplayChartValues(true);
          r.setChartValuesTextSize(30);
          mRenderer.addSeriesRenderer(r);
  	}
  }
 
开发者ID:alixander,项目名称:NutriHawk,代码行数:16,代码来源:FoodSourcesFragment.java

示例10: updatePieChart

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的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

示例11: buildCategoryRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Builds a category renderer to use the provided colors.
 * @param colors the colors
 * @return the category renderer
 */
protected DefaultRenderer buildCategoryRenderer(int[] colors) {
  DefaultRenderer renderer = new DefaultRenderer();
  renderer.setLabelsTextSize(15);
  renderer.setLegendTextSize(15);
  renderer.setMargins(new int[] { 20, 30, 15, 0 });
  for (int color : colors) {
    SimpleSeriesRenderer r = new SimpleSeriesRenderer();
    r.setColor(color);
    renderer.addSeriesRenderer(r);
  }
  return renderer;
}
 
开发者ID:vikingbrain,项目名称:droidedmediatank,代码行数:18,代码来源:DiskUsageActivity.java

示例12: buildBarRenderer

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
protected XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    int length = colors.length;
    for (int i = 0; i < length; i++) {
        SimpleSeriesRenderer r = new SimpleSeriesRenderer();
        r.setColor(colors[i]);
        renderer.addSeriesRenderer(r);
    }
    return renderer;
}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:11,代码来源:StackedBarChart.java

示例13: update

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的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

示例14: onAsyncTaskResultSuccess

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
@Override
public void onAsyncTaskResultSuccess(String taskId, Bundle resultData) {
	for (SimpleSeriesRenderer simpleRenderer : renderer.getSeriesRenderers()) {
		renderer.removeSeriesRenderer(simpleRenderer);
	}

	dataSet.clear();
	catPercentageAdapter.clear();
	catPercentageAdapter.setNotifyOnChange(false);

	String currencyCode = resultData.getString(KEY_CURRENCY);
	CurrencyUnit currency;

	if (currencyCode == null) {
		currency = CurrencyUnit.EUR;
	} else {
		currency = CurrencyUnit.getInstance(currencyCode);
	}
	Category[] categories = (Category[])
			resultData.getParcelableArray(KEY_CATEGORIES);
	double[] values = resultData.getDoubleArray(KEY_VALUES);
	double totalValue = resultData.getDouble(KEY_TOTALVALUE);

	for (int i = 0; i < categories.length; i++) {
		Category category = categories[i];
		double categoryTotalValue = values[i];
		int color = colors[(categories.length - i - 1) % colors.length];
		dataSet.add(category.getName(), categoryTotalValue);
		catPercentageAdapter.add(new CategoryPercentageInfo(category,
				Money.of(currency, categoryTotalValue, RoundingMode.HALF_EVEN), categoryTotalValue / totalValue,
				color));
		SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();
		seriesRenderer.setColor(color);
		renderer.addSeriesRenderer(seriesRenderer);
	}

	catPercentageAdapter.sort(
			new CategoryPercentageInfo.PercentageComparator(true));
	catPercentageAdapter.notifyDataSetChanged();

	if (chartView != null) {
		chartView.repaint();
	}
	categoryStatsTask = null;
	Utils.allowOrientationChanges(getActivity());
}
 
开发者ID:AlexJF,项目名称:TrackMyMoney,代码行数:47,代码来源:ImmedTransactionStatsFragment.java

示例15: update

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的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


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