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


Java XYSeriesRenderer类代码示例

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


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

示例1: drawSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的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
 */
@Override
public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
    XYSeriesRenderer 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:sdrausty,项目名称:buildAPKsApps,代码行数:36,代码来源:RangeBarChart.java

示例2: drawSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的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
 */
@Override
public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
    XYSeriesRenderer 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:sdrausty,项目名称:buildAPKsApps,代码行数:27,代码来源:BarChart.java

示例3: drawChartValuesText

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的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, XYSeriesRenderer 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:sdrausty,项目名称:buildAPKsApps,代码行数:35,代码来源:BarChart.java

示例4: renderGraph

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

示例5: addAlertSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
private void addAlertSeries() {
		TimeSeries alertSeries = new TimeSeries("Alerts");
		long alertTime = _maxTime - 5000 * 60;
		alertSeries.add(alertTime, Long.MAX_VALUE);
		alertSeries.add(alertTime, Long.MIN_VALUE);

		_dataSet.addSeries(alertSeries);

		// create new renderer for the new series
		XYSeriesRenderer renderer = new XYSeriesRenderer();
		_multipleSeriesRenderer.addSeriesRenderer(renderer);

		renderer.setPointStyle(PointStyle.POINT);
		renderer.setColor(Color.RED);
		renderer.setFillPoints(false);
		renderer.setDisplayChartValues(false);
//		renderer.setDisplayChartValuesDistance(1);
//		renderer.setChartValuesTextSize(30f);
		renderer.setShowLegendItem(false);

	}
 
开发者ID:crownstone,项目名称:fridge-file-app,代码行数:22,代码来源:StatisticsActivity.java

示例6: execute

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

示例7: drawSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的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
 */
@Override
public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
    XYSeriesRenderer 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);

    if (mType == Type.HEAPED && seriesIndex > 0) {
      float lastY = mPreviousSeriesPoints.get(i + 1);
      y = y + (lastY - yAxisValue);
      points.set(i + 1, y);
      drawBar(canvas, x, lastY, x, y, halfDiffX, seriesNr, seriesIndex, paint);
    } else {
      drawBar(canvas, x, yAxisValue, x, y, halfDiffX, seriesNr, seriesIndex, paint);
    }
  }
  paint.setColor(seriesRenderer.getColor());
  mPreviousSeriesPoints = points;
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:36,代码来源:BarChart.java

示例8: addRenderer

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
@Override
public void addRenderer(int series, Activity activity, int color) {
    XYSeriesRenderer mCurrentRenderer = new XYSeriesRenderer();
    mCurrentRenderer.setLineWidth(getDPI(3));
    mCurrentRenderer.setColor(color);
    // Include low and max value
    mCurrentRenderer.setDisplayBoundingPoints(true);
    // we add point markers
    mCurrentRenderer.setPointStyle(PointStyle.CIRCLE);
    mCurrentRenderer.setPointStrokeWidth(getDPI(5));
    mCurrentRenderer.setShowLegendItem(false);

    XYSeries seriesData = new XYSeries("data" + series);
    mSeriesDataSet.add(series, seriesData);

    mRenderer.addSeriesRenderer(series, mCurrentRenderer);
}
 
开发者ID:blackcj,项目名称:GoogleFitExample,代码行数:18,代码来源:MultipleLineGraphs.java

示例9: setRenderer

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
protected void setRenderer(XYMultipleSeriesRenderer renderer, int[] colors,
		PointStyle[] styles) {
	renderer.setAxisTitleTextSize(16);
	renderer.setChartTitleTextSize(20);
	renderer.setLabelsTextSize(15);
	renderer.setLegendTextSize(15);
	renderer.setPointSize(5f);
	renderer.setMargins(new int[] { 20, 30, 15, 20 });
	int length = colors.length;
	for (int i = 0; i < length; i++) {
		XYSeriesRenderer r = new XYSeriesRenderer();
		r.setColor(colors[i]);
		r.setPointStyle(styles[i]);
		renderer.addSeriesRenderer(r);
	}
}
 
开发者ID:jhmgbl,项目名称:learnforandroidfragAS,代码行数:17,代码来源:AbstractDemoChart.java

示例10: getDemoRenderer

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
private XYMultipleSeriesRenderer getDemoRenderer() {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    renderer.setAxisTitleTextSize(HeartRateMonitor.CHART_AXIS_TITLE_SIZE);
    renderer.setChartTitleTextSize(HeartRateMonitor.CHART_TITLE_SIZE);
    renderer.setLabelsTextSize(HeartRateMonitor.CHART_LABELS_TEXT_SIZE);
    renderer.setLegendTextSize(HeartRateMonitor.CHART_LEGEND_TEXT_SIZE);
    renderer.setPointSize(HeartRateMonitor.CHART_POINT_SIZE);
    renderer.setMarginsColor(Color.WHITE);
    renderer.setMargins(new int[]{20, 20, 15, 0});
    XYSeriesRenderer r = new XYSeriesRenderer();
    r.setColor(Color.RED);
    r.setPointStyle(PointStyle.SQUARE);
    r.setFillBelowLine(true);
    r.setFillBelowLineColor(Color.WHITE);
    r.setFillPoints(true);
    renderer.addSeriesRenderer(r);
    return renderer;
}
 
开发者ID:andrew749,项目名称:HeartRateMonitor,代码行数:19,代码来源:DoneActivity.java

示例11: getDemoRenderer

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */

private XYMultipleSeriesRenderer getDemoRenderer() {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    renderer.setAxisTitleTextSize(HeartRateMonitor.CHART_AXIS_TITLE_SIZE);
    renderer.setChartTitleTextSize(HeartRateMonitor.CHART_TITLE_SIZE);
    renderer.setLabelsTextSize(HeartRateMonitor.CHART_LABELS_TEXT_SIZE);
    renderer.setLegendTextSize(HeartRateMonitor.CHART_LEGEND_TEXT_SIZE);
    renderer.setPointSize(HeartRateMonitor.CHART_POINT_SIZE);
    renderer.setMarginsColor(Color.WHITE);
    renderer.setMargins(new int[]{20, 30, 15, 0});
    XYSeriesRenderer r = new XYSeriesRenderer();
    r.setColor(Color.BLUE);
    r.setPointStyle(PointStyle.SQUARE);
    r.setFillBelowLine(true);
    r.setFillBelowLineColor(Color.WHITE);
    r.setFillPoints(true);
    renderer.addSeriesRenderer(r);
    return renderer;
}
 
开发者ID:andrew749,项目名称:HeartRateMonitor,代码行数:23,代码来源:HeartRateMonitor.java

示例12: addSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
private void addSeries(float[] votesarr, int max, XYMultipleSeriesDataset dataSet,
		XYMultipleSeriesRenderer multiRenderer, int i, String text,
		XYSeriesRenderer renderer) {
	XYSeries series = new XYSeries(text);
	
	// Calculate the value in percent
	double votes = votesarr[i] * 100 / max;
       votes = MathUtils.roundToDecimals(votes, 2);
	
       series.add(i+1, votes);
	renderer.setDisplayChartValues(true);
	renderer.setChartValuesTextSize(22);
	dataSet.addSeries(series);
	multiRenderer.addSeriesRenderer(renderer);
	multiRenderer.addXTextLabel(i+1, text);
}
 
开发者ID:brunsen,项目名称:sturesy-android-client,代码行数:17,代码来源:BarChartFactory.java

示例13: getRenderer

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
public XYMultipleSeriesRenderer getRenderer() {
// 新建一个xymultipleseries
    render = new XYMultipleSeriesRenderer();
    render.setAxisTitleTextSize(16); // 设置坐标轴标题文本大小
    render.setChartTitleTextSize(20); // 设置图表标题文本大小
    render.setLabelsTextSize(15); // 设置轴标签文本大小
    render.setLegendTextSize(15); // 设置图例文本大小
    render.setMargins(new int[] {20, 30, 15,0}); // 设置4边留白
    render.setPanEnabled(false, false); // 设置x,y坐标轴不会因用户划动屏幕而移动
    // 设置4边留白透明
    render.setMarginsColor(Color.argb(0,0xff, 0, 0)); 
    render.setBackgroundColor(Color.TRANSPARENT); // 设置背景色透明
    render.setApplyBackgroundColor(true); // 使背景色生效
    render.setXTitle("持续时间");
    render.setYTitle("海拔高度");
    // 设置一个系列的颜色为蓝色
    xyRender = new XYSeriesRenderer();
    xyRender.setColor(Color.BLUE);
    // 往xymultiplerender中增加一个系列
    render.addSeriesRenderer(xyRender);
    return render;
  }
 
开发者ID:Tifosi-M,项目名称:Hi-Top,代码行数:23,代码来源:RecDetailsActivity.java

示例14: drawChartValuesText

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的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, XYSeriesRenderer renderer,
    Paint paint, List<Float> points, int seriesIndex, int startIndex) {
  int seriesNr = mDataset.getSeriesCount();
  float halfDiffX = getHalfDiffX(points, points.size(), seriesNr);
  int start = 0;
  if (startIndex > 0) {
    start = 2;
  }
  for (int i = start; i < points.size(); i += 4) {
    int index = startIndex + i / 2;
    float x = points.get(i);
    if (mType == Type.DEFAULT) {
      x += seriesIndex * 2 * halfDiffX - (seriesNr - 1.5f) * halfDiffX;
    }

    if (!isNullValue(series.getY(index + 1)) && points.size() > i + 3) {
      // draw the maximum value
      drawText(canvas, getLabel(renderer.getChartValuesFormat(), series.getY(index + 1)), x,
          points.get(i + 3) - renderer.getChartValuesSpacing(), paint, 0);
    }
    if (!isNullValue(series.getY(index)) && points.size() > i + 1) {
      // draw the minimum value
      drawText(
          canvas,
          getLabel(renderer.getChartValuesFormat(), series.getY(index)),
          x,
          points.get(i + 1) + renderer.getChartValuesTextSize()
              + renderer.getChartValuesSpacing() - 3, paint, 0);
    }
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:43,代码来源:RangeBarChart.java

示例15: drawSeries

import org.achartengine.renderer.XYSeriesRenderer; //导入依赖的package包/类
@Override
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
    XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
    int startIndex) {
  mCharts[seriesIndex].setScreenR(getScreenR());
  mCharts[seriesIndex].setCalcRange(getCalcRange(mDataset.getSeriesAt(seriesIndex)
      .getScaleNumber()), 0);
  mCharts[seriesIndex].drawSeries(series, canvas, paint, pointsList, seriesRenderer, yAxisValue,
      0, or, startIndex);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:CombinedXYChart.java


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