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


Java SimpleSeriesRenderer类代码示例

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


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

示例1: execute

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

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

示例3: drawSeries

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
public void drawSeries(Canvas canvas, Paint paint, List list, SimpleSeriesRenderer simpleseriesrenderer, float f, int i, int j)
{
    int k = mDataset.getSeriesCount();
    int l = list.size();
    paint.setColor(simpleseriesrenderer.getColor());
    paint.setStyle(android.graphics.Paint.Style.FILL);
    float f1 = getHalfDiffX(list, l, k);
    byte byte0 = 0;
    if (j > 0)
    {
        byte0 = 2;
    }
    for (int i1 = byte0; i1 < l; i1 += 4)
    {
        if (list.size() > i1 + 3)
        {
            drawBar(canvas, ((Float)list.get(i1)).floatValue(), ((Float)list.get(i1 + 1)).floatValue(), ((Float)list.get(i1 + 2)).floatValue(), ((Float)list.get(i1 + 3)).floatValue(), f1, k, i, paint);
        }
    }

    paint.setColor(simpleseriesrenderer.getColor());
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:23,代码来源:RangeBarChart.java

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

示例5: execute

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

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

示例7: drawSeries

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
/**
 * The graphical representation of a series.
 * 
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series
 * @param seriesRenderer the series renderer
 * @param yAxisValue the minimum value of the y axis
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
    SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) {
  int seriesNr = mDataset.getSeriesCount();
  int length = points.size();
  paint.setColor(seriesRenderer.getColor());
  paint.setStyle(Style.FILL);
  float halfDiffX = getHalfDiffX(points, length, seriesNr);
  int start = 0;
  if (startIndex > 0) {
    start = 2;
  }
  for (int i = start; i < length; i += 4) {
    if (points.size() > i + 3) {
      float xMin = points.get(i);
      float yMin = points.get(i + 1);
      // xMin = xMax
      float xMax = points.get(i + 2);
      float yMax = points.get(i + 3);
      drawBar(canvas, xMin, yMin, xMax, yMax, halfDiffX, seriesNr, seriesIndex, paint);
    }
  }
  paint.setColor(seriesRenderer.getColor());
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:35,代码来源:RangeBarChart.java

示例8: drawSeries

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
/**
 * The graphical representation of a series.
 * 
 * @param canvas the canvas to paint to
 * @param top the highest pixel to draw series.
 * @param bottom the lowest pixel to draw series.
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series
 * @param seriesRenderer the series renderer
 * @param yAxisValue the minimum value of the y axis
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
@Override
public void drawSeries(Canvas canvas, int top, int bottom, Paint paint, List<Float> points,
    SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) {
  int seriesNr = mDataset.getSeriesCount();
  int length = points.size();
  paint.setColor(seriesRenderer.getColor());
  paint.setStyle(Style.FILL);
  float halfDiffX = getHalfDiffX(points, length, seriesNr);
  for (int i = 0; i < length; i += 2) {
    float x = points.get(i);
    float y = points.get(i + 1);
    drawBar(canvas, x, yAxisValue, x, y, halfDiffX, seriesNr, seriesIndex, paint);
  }
  paint.setColor(seriesRenderer.getColor());
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:29,代码来源:BarChart.java

示例9: drawChartValuesText

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
/**
 * The graphical representation of the series values as text.
 * 
 * @param canvas the canvas to paint to
 * @param series the series to be painted
 * @param renderer the series renderer
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
protected void drawChartValuesText(Canvas canvas, XYSeries series, SimpleSeriesRenderer renderer,
    Paint paint, List<Float> points, int seriesIndex, int startIndex) {
  int seriesNr = mDataset.getSeriesCount();
  int length = points.size();
  float halfDiffX = getHalfDiffX(points, length, seriesNr);
  for (int i = 0; i < length; i += 2) {
    int index = startIndex + i / 2;
    double value = series.getY(index);
    if (!isNullValue(value)) {
      float x = points.get(i);
      if (mType == Type.DEFAULT) {
        x += seriesIndex * 2 * halfDiffX - (seriesNr - 1.5f) * halfDiffX;
      }
      if (value >= 0) {
        drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
            - renderer.getChartValuesSpacing(), paint, 0);
      } else {
        drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
            + renderer.getChartValuesTextSize() + renderer.getChartValuesSpacing() - 3, paint, 0);
      }
    }
  }
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:35,代码来源:BarChart.java

示例10: drawLegendShape

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
/**
 * The graphical representation of the legend shape.
 * 
 * @param canvas the canvas to paint to
 * @param renderer the series renderer
 * @param x the x value of the point the shape should be drawn at
 * @param y the y value of the point the shape should be drawn at
 * @param seriesIndex the series index
 * @param paint the paint to be used for drawing
 */
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y,
    int seriesIndex, Paint paint) {
  if (((XYSeriesRenderer) renderer).isFillPoints()) {
    paint.setStyle(Style.FILL);
  } else {
    paint.setStyle(Style.STROKE);
  }
  switch (((XYSeriesRenderer) renderer).getPointStyle()) {
  case X:
    drawX(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case CIRCLE:
    drawCircle(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case TRIANGLE:
    drawTriangle(canvas, paint, new float[6], x + SHAPE_WIDTH, y);
    break;
  case SQUARE:
    drawSquare(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case DIAMOND:
    drawDiamond(canvas, paint, new float[8], x + SHAPE_WIDTH, y);
    break;
  case POINT:
    canvas.drawPoint(x + SHAPE_WIDTH, y, paint);
    break;
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:39,代码来源:ScatterChart.java

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

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

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

示例14: onCreate

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.xy_chart);
  mValue = (EditText) findViewById(R.id.xValue);
  mRenderer.setZoomButtonsVisible(true);
  mRenderer.setStartAngle(180);
  mRenderer.setDisplayValues(true);

  mAdd = (Button) findViewById(R.id.add);
  mAdd.setEnabled(true);
  mValue.setEnabled(true);

  mAdd.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
      double value = 0;
      try {
        value = Double.parseDouble(mValue.getText().toString());
      } catch (NumberFormatException e) {
        mValue.requestFocus();
        return;
      }
      mValue.setText("");
      mValue.requestFocus();
      mSeries.add("Series " + (mSeries.getItemCount() + 1), value);
      SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
      renderer.setColor(COLORS[(mSeries.getItemCount() - 1) % COLORS.length]);
      mRenderer.addSeriesRenderer(renderer);
      mChartView.repaint();
    }
  });
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:33,代码来源:PieChartBuilder.java

示例15: drawLegendShape

import org.achartengine.renderer.SimpleSeriesRenderer; //导入依赖的package包/类
/**
 * The graphical representation of the legend shape.
 * 
 * @param canvas the canvas to paint to
 * @param renderer the series renderer
 * @param x the x value of the point the shape should be drawn at
 * @param y the y value of the point the shape should be drawn at
 * @param seriesIndex the series index
 * @param paint the paint to be used for drawing
 */
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y,
    int seriesIndex, Paint paint) {
  float oldWidth = paint.getStrokeWidth();
  paint.setStrokeWidth(((XYSeriesRenderer) renderer).getLineWidth());
  canvas.drawLine(x, y, x + SHAPE_WIDTH, y, paint);
  paint.setStrokeWidth(oldWidth);
  if (isRenderPoints(renderer)) {
    pointsChart.drawLegendShape(canvas, renderer, x + 5, y, seriesIndex, paint);
  }
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:21,代码来源:LineChart.java


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