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


Java SimpleSeriesRenderer.isGradientEnabled方法代码示例

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


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

示例1: drawBar

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Draws a bar.
 * 
 * @param canvas the canvas
 * @param xMin the X axis minimum
 * @param yMin the Y axis minimum
 * @param xMax the X axis maximum
 * @param yMax the Y axis maximum
 * @param scale the scale index
 * @param seriesIndex the current series index
 * @param paint the paint
 */
private void drawBar(Canvas canvas, float xMin, float yMin, float xMax, float yMax, int scale,
    int seriesIndex, Paint paint) {
  // Fix negative bars issue in Android 4.2
  float temp;
  if (xMin > xMax) {
    temp = xMin;
    xMin = xMax;
    xMax = temp;
  }
  if (yMin > yMax) {
    temp = yMin;
    yMin = yMax;
    yMax = temp;
  }

  SimpleSeriesRenderer renderer = mRenderer.getSeriesRendererAt(seriesIndex);
  if (renderer.isGradientEnabled()) {
    float minY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStopValue() }, scale)[1];
    float maxY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStartValue() },
        scale)[1];
    float gradientMinY = Math.max(minY, Math.min(yMin, yMax));
    float gradientMaxY = Math.min(maxY, Math.max(yMin, yMax));
    int gradientMinColor = renderer.getGradientStopColor();
    int gradientMaxColor = renderer.getGradientStartColor();
    int gradientStartColor = gradientMaxColor;
    int gradientStopColor = gradientMinColor;

    if (yMin < minY) {
      paint.setColor(gradientMinColor);
      canvas.drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax),
          Math.round(gradientMinY), paint);
    } else {
      gradientStopColor = getGradientPartialColor(gradientMinColor, gradientMaxColor,
          (maxY - gradientMinY) / (maxY - minY));
    }
    if (yMax > maxY) {
      paint.setColor(gradientMaxColor);
      canvas.drawRect(Math.round(xMin), Math.round(gradientMaxY), Math.round(xMax),
          Math.round(yMax), paint);
    } else {
      gradientStartColor = getGradientPartialColor(gradientMaxColor, gradientMinColor,
          (gradientMaxY - minY) / (maxY - minY));
    }
    GradientDrawable gradient = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {
        gradientStartColor, gradientStopColor });
    gradient.setBounds(Math.round(xMin), Math.round(gradientMinY), Math.round(xMax),
        Math.round(gradientMaxY));
    gradient.draw(canvas);
  } else {
    if (Math.abs(yMin - yMax) < 1) {
      if (yMin < yMax) {
        yMax = yMin + 1;
      } else {
        yMax = yMin - 1;
      }
    }
    canvas
        .drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax), Math.round(yMax), paint);
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:73,代码来源:BarChart.java

示例2: drawBar

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Draws a bar.
 * 
 * @param canvas the canvas
 * @param xMin the X axis minimum
 * @param yMin the Y axis minimum
 * @param xMax the X axis maximum
 * @param yMax the Y axis maximum
 * @param scale the scale index
 * @param seriesIndex the current series index
 * @param paint the paint
 */
protected void drawBar(Canvas canvas, float xMin, float yMin, float xMax, float yMax, int scale,
    int seriesIndex, Paint paint) {
  // Fix negative bars issue in Android 4.2
  float temp;
  if (xMin > xMax) {
    temp = xMin;
    xMin = xMax;
    xMax = temp;
  }
  if (yMin > yMax) {
    temp = yMin;
    yMin = yMax;
    yMax = temp;
  }

  SimpleSeriesRenderer renderer = mRenderer.getSeriesRendererAt(seriesIndex);
  if (renderer.isGradientEnabled()) {
    float minY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStopValue() }, scale)[1];
    float maxY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStartValue() },
        scale)[1];
    float gradientMinY = Math.max(minY, Math.min(yMin, yMax));
    float gradientMaxY = Math.min(maxY, Math.max(yMin, yMax));
    int gradientMinColor = renderer.getGradientStopColor();
    int gradientMaxColor = renderer.getGradientStartColor();
    int gradientStartColor = gradientMaxColor;
    int gradientStopColor = gradientMinColor;

    if (yMin < minY) {
      paint.setColor(gradientMinColor);
      canvas.drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax),
          Math.round(gradientMinY), paint);
    } else {
      gradientStopColor = getGradientPartialColor(gradientMinColor, gradientMaxColor,
          (maxY - gradientMinY) / (maxY - minY));
    }
    if (yMax > maxY) {
      paint.setColor(gradientMaxColor);
      canvas.drawRect(Math.round(xMin), Math.round(gradientMaxY), Math.round(xMax),
          Math.round(yMax), paint);
    } else {
      gradientStartColor = getGradientPartialColor(gradientMaxColor, gradientMinColor,
          (gradientMaxY - minY) / (maxY - minY));
    }
    GradientDrawable gradient = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {
        gradientStartColor, gradientStopColor });
    gradient.setBounds(Math.round(xMin), Math.round(gradientMinY), Math.round(xMax),
        Math.round(gradientMaxY));
    gradient.draw(canvas);
  } else {
    if (Math.abs(yMin - yMax) < 1) {
      if (yMin < yMax) {
        yMax = yMin + 1;
      } else {
        yMax = yMin - 1;
      }
    }
    canvas
        .drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax), Math.round(yMax), paint);
  }
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:73,代码来源:BarChart.java

示例3: a

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
private void a(Canvas canvas, float f, float f1, float f2, float f3, int i, int j, 
        Paint paint)
{
    SimpleSeriesRenderer simpleseriesrenderer = mRenderer.getSeriesRendererAt(j);
    if (simpleseriesrenderer.isGradientEnabled())
    {
        double ad[] = new double[2];
        ad[0] = 0.0D;
        ad[1] = simpleseriesrenderer.getGradientStopValue();
        float f4 = (float)toScreenPoint(ad, i)[1];
        double ad1[] = new double[2];
        ad1[0] = 0.0D;
        ad1[1] = simpleseriesrenderer.getGradientStartValue();
        float f5 = (float)toScreenPoint(ad1, i)[1];
        float f6 = Math.max(f4, Math.min(f1, f3));
        float f7 = Math.min(f5, Math.max(f1, f3));
        int k = simpleseriesrenderer.getGradientStopColor();
        int l = simpleseriesrenderer.getGradientStartColor();
        int i1;
        int j1;
        GradientDrawable gradientdrawable;
        if (f1 < f4)
        {
            paint.setColor(k);
            canvas.drawRect(Math.round(f), Math.round(f1), Math.round(f2), Math.round(f6), paint);
            i1 = k;
        } else
        {
            i1 = a(k, l, (f5 - f6) / (f5 - f4));
        }
        if (f3 > f5)
        {
            paint.setColor(l);
            canvas.drawRect(Math.round(f), Math.round(f7), Math.round(f2), Math.round(f3), paint);
            j1 = l;
        } else
        {
            j1 = a(l, k, (f7 - f4) / (f5 - f4));
        }
        gradientdrawable = new GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation.BOTTOM_TOP, new int[] {
            j1, i1
        });
        gradientdrawable.setBounds(Math.round(f), Math.round(f6), Math.round(f2), Math.round(f7));
        gradientdrawable.draw(canvas);
        return;
    }
    if (Math.abs(f1 - f3) < 1.0F)
    {
        if (f1 < f3)
        {
            f3 = f1 + 1.0F;
        } else
        {
            f3 = f1 - 1.0F;
        }
    }
    canvas.drawRect(Math.round(f), Math.round(f1), Math.round(f2), Math.round(f3), paint);
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:59,代码来源:BarChart.java

示例4: drawBar

import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
 * Draws a bar.
 * 
 * @param canvas the canvas
 * @param xMin the X axis minimum
 * @param yMin the Y axis minimum
 * @param xMax the X axis maximum
 * @param yMax the Y axis maximum
 * @param scale the scale index
 * @param seriesIndex the current series index
 * @param paint the paint
 */
private void drawBar(Canvas canvas, float xMin, float yMin, float xMax, float yMax, int scale,
    int seriesIndex, Paint paint) {
  SimpleSeriesRenderer renderer = mRenderer.getSeriesRendererAt(seriesIndex);
  if (renderer.isGradientEnabled()) {
    float minY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStopValue() }, scale)[1];
    float maxY = (float) toScreenPoint(new double[] { 0, renderer.getGradientStartValue() },
        scale)[1];
    float gradientMinY = Math.max(minY, Math.min(yMin, yMax));
    float gradientMaxY = Math.min(maxY, Math.max(yMin, yMax));
    int gradientMinColor = renderer.getGradientStopColor();
    int gradientMaxColor = renderer.getGradientStartColor();
    int gradientStartColor = gradientMaxColor;
    int gradientStopColor = gradientMinColor;

    if (yMin < minY) {
      paint.setColor(gradientMinColor);
      canvas.drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax),
          Math.round(gradientMinY), paint);
    } else {
      gradientStopColor = getGradientPartialColor(gradientMinColor, gradientMaxColor,
          (maxY - gradientMinY) / (maxY - minY));
    }
    if (yMax > maxY) {
      paint.setColor(gradientMaxColor);
      canvas.drawRect(Math.round(xMin), Math.round(gradientMaxY), Math.round(xMax),
          Math.round(yMax), paint);
    } else {
      gradientStartColor = getGradientPartialColor(gradientMaxColor, gradientMinColor,
          (gradientMaxY - minY) / (maxY - minY));
    }
    GradientDrawable gradient = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {
        gradientStartColor, gradientStopColor });
    gradient.setBounds(Math.round(xMin), Math.round(gradientMinY), Math.round(xMax),
        Math.round(gradientMaxY));
    gradient.draw(canvas);
  } else {
    if (Math.abs(yMin - yMax) < 1) {
      if (yMin < yMax) {
        yMax = yMin + 1;
      } else {
        yMax = yMin - 1;
      }
    }
    canvas
        .drawRect(Math.round(xMin), Math.round(yMin), Math.round(xMax), Math.round(yMax), paint);
  }
}
 
开发者ID:InQBarna,项目名称:AChartEngine,代码行数:60,代码来源:BarChart.java


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