• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Orientation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawSeries

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


示例2: execute

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  String[] titles = new String[] { "2007", "2008" };
  List<double[]> values = new ArrayList<double[]>();
  values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
      11600, 13500 });
  values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
      12600, 14000 });
  int[] colors = new int[] { Color.CYAN, Color.BLUE };
  XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
  renderer.setOrientation(Orientation.VERTICAL);
  setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
      12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
  renderer.setXLabels(1);
  renderer.setYLabels(10);
  renderer.addXTextLabel(1, "Jan");
  renderer.addXTextLabel(3, "Mar");
  renderer.addXTextLabel(5, "May");
  renderer.addXTextLabel(7, "Jul");
  renderer.addXTextLabel(10, "Oct");
  renderer.addXTextLabel(12, "Dec");
  int length = renderer.getSeriesRendererCount();
  for (int i = 0; i < length; i++) {
    XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
    seriesRenderer.setDisplayChartValues(true);
  }
  return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
      Type.DEFAULT);
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:35,代码来源:SalesBarChart.java


示例3: drawSeries

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Draws the series.
 * 
 * @param series the series
 * @param canvas the canvas
 * @param paint the paint object
 * @param pointsList the points to be rendered
 * @param seriesRenderer the series renderer
 * @param yAxisValue the y axis value in pixels
 * @param seriesIndex the series index
 * @param or the orientation
 * @param startIndex the start index of the rendering points
 */
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
    XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
    int startIndex) {
  BasicStroke stroke = seriesRenderer.getStroke();
  Cap cap = paint.getStrokeCap();
  Join join = paint.getStrokeJoin();
  float miter = paint.getStrokeMiter();
  PathEffect pathEffect = paint.getPathEffect();
  Style style = paint.getStyle();
  if (stroke != null) {
    PathEffect effect = null;
    if (stroke.getIntervals() != null) {
      effect = new DashPathEffect(stroke.getIntervals(), stroke.getPhase());
    }
    setStroke(stroke.getCap(), stroke.getJoin(), stroke.getMiter(), Style.FILL_AND_STROKE,
        effect, paint);
  }
  // float[] points = MathHelper.getFloats(pointsList);
  drawSeries(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
  drawPoints(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
  paint.setTextSize(seriesRenderer.getChartValuesTextSize());
  if (or == Orientation.HORIZONTAL) {
    paint.setTextAlign(Align.CENTER);
  } else {
    paint.setTextAlign(Align.LEFT);
  }
  if (seriesRenderer.isDisplayChartValues()) {
    paint.setTextAlign(seriesRenderer.getChartValuesTextAlign());
    drawChartValuesText(canvas, series, seriesRenderer, paint, pointsList, seriesIndex,
        startIndex);
  }
  if (stroke != null) {
    setStroke(cap, join, miter, style, pathEffect, paint);
  }
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:49,代码来源:XYChart.java


示例4: drawSeries

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


示例5: execute

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Executes the chart demo.
 * 
 * @param context the context
 * @return the built intent
 */
public Intent execute(Context context) {
  String[] titles = new String[] { "2007", "2008" };
  List<double[]> values = new ArrayList<double[]>();
  values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
      11600, 13500 });
  values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
      12600, 14000 });
  int[] colors = new int[] { Color.CYAN, Color.BLUE };
  XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
  renderer.setOrientation(Orientation.VERTICAL);
  setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
      12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
  renderer.setXLabels(1);
  renderer.setYLabels(10);
  renderer.addXTextLabel(1, "Jan");
  renderer.addXTextLabel(3, "Mar");
  renderer.addXTextLabel(5, "May");
  renderer.addXTextLabel(7, "Jul");
  renderer.addXTextLabel(10, "Oct");
  renderer.addXTextLabel(12, "Dec");
  int length = renderer.getSeriesRendererCount();
  for (int i = 0; i < length; i++) {
    SimpleSeriesRenderer seriesRenderer = renderer.getSeriesRendererAt(i);
    seriesRenderer.setDisplayChartValues(true);
  }
  return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
      Type.DEFAULT);
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:35,代码来源:SalesBarChart.java


示例6: StackedBarChart

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
public StackedBarChart(int[] colors, double xValuesEdge, float maxChartValues, float maxValue,
        String[] xTitles, Orientation orientantion, float barWidth, int[] margins,
        float labelsTextSize, int xLabelColor) {
    renderer = buildBarRenderer(colors);
    setChartSettings(renderer, xValuesEdge, maxChartValues + xValuesEdge, 0, maxValue,
            Color.GRAY, Color.LTGRAY, xTitles, orientantion, barWidth, margins, labelsTextSize,
            xLabelColor);

}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:10,代码来源:StackedBarChart.java


示例7: setChartSettings

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
protected void setChartSettings(XYMultipleSeriesRenderer renderer, double xMin, double xMax,
        double yMin, double yMax, int axesColor, int labelsColor, String[] xTitles,
        Orientation orientation, float width, int[] margins, float labelsTextSize,
        int xLabelColor) {
    renderer.setXAxisMin(xMin);
    renderer.setXAxisMax(xMax);
    renderer.setYAxisMin(yMin);
    renderer.setYAxisMax(yMax);
    renderer.setAxesColor(axesColor);
    renderer.setLabelsColor(labelsColor);
    renderer.setMarginsColor(Color.WHITE);
    renderer.setShowLegend(false);
    renderer.setXLabels(0);

    if (xTitles != null) {
        for (int i = 0; i < xTitles.length; i++) {
            renderer.addXTextLabel(i + 1, xTitles[i]);
        }
    }

    renderer.setXLabelsAlign(Align.CENTER);
    renderer.setPanEnabled(false, false);
    renderer.setZoomRate(1.1f);
    renderer.setBarSpacing(0.5f);
    renderer.setLabelsTextSize(24);
    renderer.setYLabels(0);
    renderer.setShowCustomTextGrid(false);
    renderer.setClickEnabled(true);
    renderer.setOrientation(orientation);
    renderer.setBarWidth(width);
    renderer.setMargins(margins);
    renderer.setShowAxes(false);
    renderer.setLabelsTextSize(labelsTextSize);
    renderer.setXLabelsColor(xLabelColor);
}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:36,代码来源:StackedBarChart.java


示例8: drawSeries

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
@Override
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
    SimpleSeriesRenderer 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:InQBarna,项目名称:AChartEngine,代码行数:11,代码来源:CombinedXYChart.java


示例9: drawYLabels

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * The graphical representation of the labels on the Y axis.
 * 
 * @param allYLabels the Y labels values
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param maxScaleNumber the maximum scale number
 * @param left the left value of the labels area
 * @param right the right value of the labels area
 * @param bottom the bottom value of the labels area
 * @param yPixelsPerUnit the amount of pixels per one unit in the chart labels
 * @param minY the minimum value on the Y axis in the chart
 */
protected void drawYLabels(Map<Integer, List<Double>> allYLabels, Canvas canvas, Paint paint,
    int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY) {
  Orientation or = mRenderer.getOrientation();
  boolean showGridX = mRenderer.isShowGridX();
  boolean showLabels = mRenderer.isShowLabels();
  boolean showTickMarks = mRenderer.isShowTickMarks();
  for (int i = 0; i < maxScaleNumber; i++) {
    paint.setTextAlign(mRenderer.getYLabelsAlign(i));
    List<Double> yLabels = allYLabels.get(i);
    int length = yLabels.size();
    for (int j = 0; j < length; j++) {
      double label = yLabels.get(j);
      Align axisAlign = mRenderer.getYAxisAlign(i);
      boolean textLabel = mRenderer.getYTextLabel(label, i) != null;
      float yLabel = (float) (bottom - yPixelsPerUnit[i] * (label - minY[i]));
      if (or == Orientation.HORIZONTAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (axisAlign == Align.LEFT) {
            if (showTickMarks) {
              canvas.drawLine(left + getLabelLinePos(axisAlign), yLabel, left, yLabel, paint);
            }
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                left - mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          } else {
            if (showTickMarks) {
              canvas.drawLine(right, yLabel, right + getLabelLinePos(axisAlign), yLabel, paint);
            }
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                right + mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          }
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor(i));
          canvas.drawLine(left, yLabel, right, yLabel, paint);
        }
      } else if (or == Orientation.VERTICAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (showTickMarks) {
            canvas.drawLine(right - getLabelLinePos(axisAlign), yLabel, right, yLabel, paint);
          }
          drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
              right + 10 + mRenderer.getYLabelsPadding(),
              yLabel - mRenderer.getYLabelsVerticalPadding(), paint, mRenderer.getYLabelsAngle());
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor(i));
          if (showTickMarks) {
            canvas.drawLine(right, yLabel, left, yLabel, paint);
          }
        }
      }
    }
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:74,代码来源:XYChart.java


示例10: drawSeries

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Draws the series.
 * 
 * @param series the series
 * @param canvas the canvas
 * @param paint the paint object
 * @param pointsList the points to be rendered
 * @param seriesRenderer the series renderer
 * @param yAxisValue the y axis value in pixels
 * @param seriesIndex the series index
 * @param or the orientation
 * @param startIndex the start index of the rendering points
 */
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
    XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
    int startIndex) {
  BasicStroke stroke = seriesRenderer.getStroke();
  Cap cap = paint.getStrokeCap();
  Join join = paint.getStrokeJoin();
  float miter = paint.getStrokeMiter();
  PathEffect pathEffect = paint.getPathEffect();
  Style style = paint.getStyle();
  if (stroke != null) {
    PathEffect effect = null;
    if (stroke.getIntervals() != null) {
      effect = new DashPathEffect(stroke.getIntervals(), stroke.getPhase());
    }
    setStroke(stroke.getCap(), stroke.getJoin(), stroke.getMiter(), Style.FILL_AND_STROKE,
        effect, paint);
  }
  // float[] points = MathHelper.getFloats(pointsList);
  drawSeries(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
  if (isRenderPoints(seriesRenderer)) {
    ScatterChart pointsChart = getPointsChart();
    if (pointsChart != null) {
      pointsChart.drawSeries(canvas, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex,
          startIndex);
    }
  }
  paint.setTextSize(seriesRenderer.getChartValuesTextSize());
  if (or == Orientation.HORIZONTAL) {
    paint.setTextAlign(Align.CENTER);
  } else {
    paint.setTextAlign(Align.LEFT);
  }
  if (seriesRenderer.isDisplayChartValues()) {
    paint.setTextAlign(seriesRenderer.getChartValuesTextAlign());
    drawChartValuesText(canvas, series, seriesRenderer, paint, pointsList, seriesIndex,
        startIndex);
  }
  if (stroke != null) {
    setStroke(cap, join, miter, style, pathEffect, paint);
  }
}
 
开发者ID:jrieke,项目名称:ioiometer,代码行数:55,代码来源:XYChart.java


示例11: drawYLabels

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * The graphical representation of the labels on the Y axis.
 * 
 * @param allYLabels the Y labels values
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param maxScaleNumber the maximum scale number
 * @param left the left value of the labels area
 * @param right the right value of the labels area
 * @param bottom the bottom value of the labels area
 * @param yPixelsPerUnit the amount of pixels per one unit in the chart labels
 * @param minY the minimum value on the Y axis in the chart
 */
protected void drawYLabels(Map<Integer, List<Double>> allYLabels, Canvas canvas, Paint paint,
    int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY) {
  Orientation or = mRenderer.getOrientation();
  boolean showGridX = mRenderer.isShowGridX();
  boolean showLabels = mRenderer.isShowLabels();
  for (int i = 0; i < maxScaleNumber; i++) {
    paint.setTextAlign(mRenderer.getYLabelsAlign(i));
    List<Double> yLabels = allYLabels.get(i);
    int length = yLabels.size();
    for (int j = 0; j < length; j++) {
      double label = yLabels.get(j);
      Align axisAlign = mRenderer.getYAxisAlign(i);
      boolean textLabel = mRenderer.getYTextLabel(label, i) != null;
      float yLabel = (float) (bottom - yPixelsPerUnit[i] * (label - minY[i]));
      if (or == Orientation.HORIZONTAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (axisAlign == Align.LEFT) {
            canvas.drawLine(left + getLabelLinePos(axisAlign), yLabel, left, yLabel, paint);
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                left - mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          } else {
            canvas.drawLine(right, yLabel, right + getLabelLinePos(axisAlign), yLabel, paint);
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                right + mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          }
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor(i));
          canvas.drawLine(left, yLabel, right, yLabel, paint);
        }
      } else if (or == Orientation.VERTICAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          canvas.drawLine(right - getLabelLinePos(axisAlign), yLabel, right, yLabel, paint);
          drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
              right + 10 + mRenderer.getYLabelsPadding(),
              yLabel - mRenderer.getYLabelsVerticalPadding(), paint, mRenderer.getYLabelsAngle());
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor(i));
          canvas.drawLine(right, yLabel, left, yLabel, paint);
        }
      }
    }
  }
}
 
开发者ID:jrieke,项目名称:ioiometer,代码行数:65,代码来源:XYChart.java


示例12: drawYLabels

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * The graphical representation of the labels on the Y axis.
 *
 * @param allYLabels the Y labels values
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param maxScaleNumber the maximum scale number
 * @param left the left value of the labels area
 * @param right the right value of the labels area
 * @param bottom the bottom value of the labels area
 * @param yPixelsPerUnit the amount of pixels per one unit in the chart labels
 * @param minY the minimum value on the Y axis in the chart
 */
protected void drawYLabels(Map<Integer, List<Double>> allYLabels, Canvas canvas, Paint paint,
    int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY) {
  Orientation or = mRenderer.getOrientation();
  boolean showGridX = mRenderer.isShowGridX();
  if (showGridX) {
    mGridPaint.setStyle(Style.STROKE);
    mGridPaint.setStrokeWidth(mRenderer.getGridLineWidth());
  }
  boolean showYLabels = mRenderer.isShowYLabels();
  boolean showTickMarks = mRenderer.isShowTickMarks();
  for (int i = 0; i < maxScaleNumber; i++) {
    paint.setTextAlign(mRenderer.getYLabelsAlign(i));
    List<Double> yLabels = allYLabels.get(i);
    int length = yLabels.size();
    for (int j = 0; j < length; j++) {
      double label = yLabels.get(j);
      Align axisAlign = mRenderer.getYAxisAlign(i);
      boolean textLabel = mRenderer.getYTextLabel(label, i) != null;
      float yLabel = (float) (bottom - yPixelsPerUnit[i] * (label - minY[i]));
      if (or == Orientation.HORIZONTAL) {
        if (showYLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (axisAlign == Align.LEFT) {
            if (showTickMarks) {
              canvas.drawLine(left + getLabelLinePos(axisAlign), yLabel, left, yLabel, paint);
            }
            drawText(canvas, getLabel(mRenderer.getYLabelFormat(i), label),
                left - mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          } else {
            if (showTickMarks) {
              canvas.drawLine(right, yLabel, right + getLabelLinePos(axisAlign), yLabel, paint);
            }
            drawText(canvas, getLabel(mRenderer.getYLabelFormat(i), label),
                right + mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          }
        }
        if (showGridX) {
          mGridPaint.setColor(mRenderer.getGridColor(i));
          canvas.drawLine(left, yLabel, right, yLabel, mGridPaint);
        }
      } else if (or == Orientation.VERTICAL) {
        if (showYLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (showTickMarks) {
            canvas.drawLine(right - getLabelLinePos(axisAlign), yLabel, right, yLabel, paint);
          }
          drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
              right + 10 + mRenderer.getYLabelsPadding(),
              yLabel - mRenderer.getYLabelsVerticalPadding(), paint, mRenderer.getYLabelsAngle());
        }
        if (showGridX) {
          mGridPaint.setColor(mRenderer.getGridColor(i));
          if (showTickMarks) {
            canvas.drawLine(right, yLabel, left, yLabel, mGridPaint);
          }
        }
      }
    }
  }
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:78,代码来源:XYChart.java


示例13: setupChart

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
private void setupChart(Context context) {
    tvDetailChartDate.setText(mTopChartLabel);

    this.setupTransactionsPercentageByCategory(mCategoryTotals);
    mCategoryPercentageByDayAdapter = new CategoryPercentageByDayAdapter(this.getActivity(),
            mTransactionsPercentageByCategory);
    gvDetailChartLabel.setNumColumns(mTransactionsPercentageByCategory.size());
    gvDetailChartLabel.setAdapter(mCategoryPercentageByDayAdapter);

    int[] colors = new int[mCategoryTotals.size()];
    float maxValue = mMaxValue.floatValue();
    String[] xTitles = null;

    List<double[]> values = new ArrayList<double[]>();
    String[] titles = new String[mCategoryTotals.size()];

    for (int i = 0; i < mCategoryTotals.size(); i++) {
        CategoryTotal c = mCategoryTotals.get(i);

        double current = c.getCategoryTotal().doubleValue();
        double previous = (i == 0) ? 0 : values.get(i - 1)[0];

        colors[i] = Color.parseColor(c.getCategoryColor());
        titles[i] = c.getCategoryName();
        values.add(new double[] {
            current + previous
        });
    }

    Collections.reverse(values);
    ArrayUtils.reverse(colors);

    int[] margins = new int[] {
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_top),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_left),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_bottom),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_right)
    };
    
    float labelsTextSize = getResources().getDimension(
            R.dimen.transaction_chart_labels_text_size);
    
    int xLabelColor = getResources().getColor(R.color.dashboard_cash_spent_chart_xlabel_text);

    StackedBarChart barChart = new StackedBarChart(colors, X_VALUES_EDGE, MAX_CHART_VALUES,
            maxValue, xTitles, Orientation.VERTICAL, 300f, margins, labelsTextSize, xLabelColor);
    mGraphicalView = barChart.getChartView(context, titles, values);
    rlTransactionsDetailChart.addView(mGraphicalView);
}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:50,代码来源:DailyTransactionsDetailChartFragment.java


示例14: setupChart

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
private void setupChart(Context context, RelativeLayout rlStackedBarChart, BigDecimal maxValue,
        List<List<CategoryTotal>> data, List<String> xLabels) {
    List<Category> categories = new CategoryDao().getAll();
    List<double[]> values = new ArrayList<double[]>();

    for (int i = 0; i < categories.size(); i++) {
        values.add(new double[MAX_CHART_VALUES]);
    }

    for (int i = 0; i < categories.size(); i++) {
        Category c = categories.get(i);

        for (int j = 0; j < data.size(); j++) {
            List<CategoryTotal> categoriesByDay = data.get(j);

            for (CategoryTotal map : categoriesByDay) {
                String categoryName = map.getCategoryName();

                if (categoryName.equals(c.getName())) {
                    double[] v = values.get(i);
                    BigDecimal total = map.getCategoryTotal();
                    v[j] = total.doubleValue();
                }
            }

        }
    }

    for (int i = 0; i < values.size(); i++) {
        double[] previous = (i == 0) ? new double[MAX_CHART_VALUES] : values.get(i - 1);
        double[] current = values.get(i);

        for (int j = 0; j < current.length; j++) {
            current[j] = current[j] + previous[j];
        }
    }

    Collections.reverse(values);
    Collections.reverse(categories);

    String[] categoriesTitles = new String[categories.size()];
    int[] categoriesColors = new int[categories.size()];

    for (int i = 0; i < categories.size(); i++) {
        Category category = categories.get(i);
        categoriesColors[i] = Color.parseColor(category.getColor());
        categoriesTitles[i] = category.getName();
    }

    String[] xTitles = xLabels.toArray(new String[xLabels.size()]);

    int[] margins = new int[] {
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_top),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_left),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_bottom),
            getResources().getDimensionPixelOffset(R.dimen.transaction_chart_margin_right)
    };

    float labelsTextSize = getResources().getDimension(
            R.dimen.transaction_chart_labels_text_size);

    int xLabelColor = getResources().getColor(R.color.dashboard_cash_spent_chart_xlabel_text);

    StackedBarChart barChart = new StackedBarChart(categoriesColors, X_VALUES_EDGE,
            MAX_CHART_VALUES, maxValue.floatValue(), xTitles, Orientation.HORIZONTAL, 50f,
            margins, labelsTextSize, xLabelColor);
    mGraphicalView = barChart.getChartView(context, categoriesTitles, values);

    mGraphicalView.setOnClickListener(chartClickListener);

    rlStackedBarChart.addView(mGraphicalView);
}
 
开发者ID:CodePath-MAF,项目名称:AndroidClient,代码行数:73,代码来源:DailyTransactionsChartFragment.java


示例15: execute

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
@Override
	public Intent execute(Context context) {
		String[] titles = new String[] {"candle"};
	    List<double[]> x = new ArrayList<double[]>();
	    x.add(timestamp);
//	    for (int i = 0; i < titles.length; i++) {
//	      x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 });
//	    }
	   // List<double[]> values = new ArrayList<double[]>();
//	    values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2,
//	        13.9 });
//	    values.add(new double[] { 10, 10, 12, 15, 20, 24, 26, 26, 23, 18, 14, 11 });
//	    values.add(new double[] { 5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6 });
//	    values.add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 });
	   // values.add(open);
	    //values.add(close);
	    //values.add(high);
	    //values.add(high);
	    
	    int[] colors = new int[] {Color.RED };
	    PointStyle[] styles = new PointStyle[] {PointStyle.POINT};
	    XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
	    renderer.setOrientation(Orientation.HORIZONTAL);
	    int length = renderer.getSeriesRendererCount();
	    for (int i = 0; i < length; i++) {
	      ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true);
	    }
	    setChartSettings(renderer, "Candle Stick", "Time", "stockprize",1325648758000f, 1325671305000f, 2800, 2900,Color.LTGRAY, Color.LTGRAY);
	    renderer.setXLabels(12);
	    renderer.setYLabels(10);
	    renderer.setShowGrid(true);
	    renderer.setXLabelsAlign(Align.RIGHT);
	    renderer.setYLabelsAlign(Align.LEFT);
	    renderer.setShowLegend(false);
	   // renderer.setZoomButtonsVisible(false);
	   // renderer.setYAxisAlign(Align.RIGHT, 1);
	    renderer.setZoomButtonsVisible(true);
	    renderer.setPanLimits(new double[] { 1325648758000f, 1325671305000f, 2800, 2800 });
	    renderer.setZoomLimits(new double[] { 1325648758000f, 1325671305000f, 2800, 2800 });

	    XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
	   // XYSeries series = dataset.getSeriesAt(0);
	   // series.addAnnotation("Vacation", 6, 30);
	    Intent intent = ChartFactory.getCandleStickChartIntent(context, dataset, renderer,
	        "Candle Stick");
	    return intent;
	}
 
开发者ID:nasif,项目名称:android-trade-chart,代码行数:48,代码来源:CandleStickChartDemo.java


示例16: drawSeries

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Draws the series.
 * 
 * @param series the series
 * @param canvas the canvas
 * @param paint the paint object
 * @param pointsList the points to be rendered
 * @param seriesRenderer the series renderer
 * @param yAxisValue the y axis value in pixels
 * @param seriesIndex the series index
 * @param or the orientation
 * @param startIndex the start index of the rendering points
 */
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
    SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
    int startIndex) {
  BasicStroke stroke = seriesRenderer.getStroke();
  Cap cap = paint.getStrokeCap();
  Join join = paint.getStrokeJoin();
  float miter = paint.getStrokeMiter();
  PathEffect pathEffect = paint.getPathEffect();
  Style style = paint.getStyle();
  if (stroke != null) {
    PathEffect effect = null;
    if (stroke.getIntervals() != null) {
      effect = new DashPathEffect(stroke.getIntervals(), stroke.getPhase());
    }
    setStroke(stroke.getCap(), stroke.getJoin(), stroke.getMiter(), Style.FILL_AND_STROKE,
        effect, paint);
  }
  // float[] points = MathHelper.getFloats(pointsList);
  drawSeries(canvas, mScreenR.top, mScreenR.bottom, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex, startIndex);
  if (isRenderPoints(seriesRenderer)) {
    ScatterChart pointsChart = getPointsChart();
    if (pointsChart != null) {
      pointsChart.drawSeries(canvas, mScreenR.top, mScreenR.bottom, paint, pointsList, seriesRenderer, yAxisValue, seriesIndex,
          startIndex);
    }
  }
  paint.setTextSize(seriesRenderer.getChartValuesTextSize());
  if (or == Orientation.HORIZONTAL) {
    paint.setTextAlign(Align.CENTER);
  } else {
    paint.setTextAlign(Align.LEFT);
  }
  if (seriesRenderer.isDisplayChartValues()) {
    paint.setTextAlign(seriesRenderer.getChartValuesTextAlign());
    drawChartValuesText(canvas, series, seriesRenderer, paint, pointsList, seriesIndex,
        startIndex);
  }
  if (stroke != null) {
    setStroke(cap, join, miter, style, pathEffect, paint);
  }
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:55,代码来源:XYChart.java


示例17: drawYLabels

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * The graphical representation of the labels on the Y axis.
 * 
 * @param allYLabels the Y labels values
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param maxScaleNumber the maximum scale number
 * @param left the left value of the labels area
 * @param right the right value of the labels area
 * @param bottom the bottom value of the labels area
 * @param yPixelsPerUnit the amount of pixels per one unit in the chart labels
 * @param minY the minimum value on the Y axis in the chart
 */
protected void drawYLabels(Map<Integer, List<Double>> allYLabels, Canvas canvas, Paint paint,
    int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY) {
  Orientation or = mRenderer.getOrientation();
  boolean showGridX = mRenderer.isShowGridX();
  boolean showLabels = mRenderer.isShowLabels();
  for (int i = 0; i < maxScaleNumber; i++) {
    paint.setTextAlign(mRenderer.getYLabelsAlign(i));
    List<Double> yLabels = allYLabels.get(i);
    int length = yLabels.size();
    for (int j = 0; j < length; j++) {
      double label = yLabels.get(j);
      Align axisAlign = mRenderer.getYAxisAlign(i);
      boolean textLabel = mRenderer.getYTextLabel(label, i) != null;
      float yLabel = (float) (bottom - yPixelsPerUnit[i] * (label - minY[i]));
      if (or == Orientation.HORIZONTAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          if (axisAlign == Align.LEFT) {
            canvas.drawLine(left + getLabelLinePos(axisAlign), yLabel, left, yLabel, paint);
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                left - mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          } else {
            canvas.drawLine(right, yLabel, right + getLabelLinePos(axisAlign), yLabel, paint);
            drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
                right + mRenderer.getYLabelsPadding(),
                yLabel - mRenderer.getYLabelsVerticalPadding(), paint,
                mRenderer.getYLabelsAngle());
          }
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor());
          canvas.drawLine(left, yLabel, right, yLabel, paint);
        }
      } else if (or == Orientation.VERTICAL) {
        if (showLabels && !textLabel) {
          paint.setColor(mRenderer.getYLabelsColor(i));
          canvas.drawLine(right - getLabelLinePos(axisAlign), yLabel, right, yLabel, paint);
          drawText(canvas, getLabel(mRenderer.getLabelFormat(), label),
              right + 10 + mRenderer.getYLabelsPadding(), yLabel - 2, paint,
              mRenderer.getYLabelsAngle());
        }
        if (showGridX) {
          paint.setColor(mRenderer.getGridColor());
          canvas.drawLine(right, yLabel, left, yLabel, paint);
        }
      }
    }
  }
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:65,代码来源:XYChart.java


示例18: isVertical

import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation; //导入依赖的package包/类
/**
 * Checks if the current chart is rendered as vertical.
 * 
 * @param renderer the renderer
 * @return if the chart is rendered as a vertical one
 */
public boolean isVertical(DefaultRenderer renderer) {
  return renderer instanceof XYMultipleSeriesRenderer
      && ((XYMultipleSeriesRenderer) renderer).getOrientation() == Orientation.VERTICAL;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:AbstractChart.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DateRenderer类代码示例发布时间:2022-05-23
下一篇:
Java LazyLinker类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap