本文整理汇总了Java中org.achartengine.renderer.DefaultRenderer.getSeriesRendererAt方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultRenderer.getSeriesRendererAt方法的具体用法?Java DefaultRenderer.getSeriesRendererAt怎么用?Java DefaultRenderer.getSeriesRendererAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.renderer.DefaultRenderer
的用法示例。
在下文中一共展示了DefaultRenderer.getSeriesRendererAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的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;
}
示例2: execute
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的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;
}
示例3: drawLegend
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
/**
* Draws the chart legend.
*
* @param canvas the canvas to paint to
* @param renderer the series renderer
* @param titles the titles to go to the legend
* @param left the left X value of the area to draw to
* @param right the right X value of the area to draw to
* @param y the y value of the area to draw to
* @param width the width of the area to draw to
* @param height the height of the area to draw to
* @param legendSize the legend size
* @param paint the paint to be used for drawing
* @param calculate if only calculating the legend size
*
* @return the legend height
*/
protected int drawLegend(Canvas canvas, DefaultRenderer renderer, String[] titles, int left,
int right, int y, int width, int height, int legendSize, Paint paint, boolean calculate) {
float size = 32;
if (renderer.isShowLegend()) {
float currentX = left;
float currentY = y + height - legendSize + size;
paint.setTextAlign(Align.LEFT);
paint.setTextSize(renderer.getLegendTextSize());
int sLength = Math.min(titles.length, renderer.getSeriesRendererCount());
for (int i = 0; i < sLength; i++) {
SimpleSeriesRenderer r = renderer.getSeriesRendererAt(i);
final float lineSize = getLegendShapeWidth(i);
if (r.isShowLegendItem()) {
String text = titles[i];
if (titles.length == renderer.getSeriesRendererCount()) {
paint.setColor(r.getColor());
} else {
paint.setColor(Color.LTGRAY);
}
float[] widths = new float[text.length()];
paint.getTextWidths(text, widths);
float sum = 0;
for (float value : widths) {
sum += value;
}
float extraSize = lineSize + 10 + sum;
float currentWidth = currentX + extraSize;
if (i > 0 && getExceed(currentWidth, renderer, right, width)) {
currentX = left;
currentY += renderer.getLegendTextSize();
size += renderer.getLegendTextSize();
currentWidth = currentX + extraSize;
}
if (getExceed(currentWidth, renderer, right, width)) {
float maxWidth = right - currentX - lineSize - 10;
if (isVertical(renderer)) {
maxWidth = width - currentX - lineSize - 10;
}
int nr = paint.breakText(text, true, maxWidth, widths);
text = text.substring(0, nr) + "...";
}
if (!calculate) {
drawLegendShape(canvas, r, currentX, currentY, i, paint);
drawString(canvas, text, currentX + lineSize + 5, currentY + 5, paint);
}
currentX += extraSize;
}
}
}
return Math.round(size + renderer.getLegendTextSize());
}
示例4: drawLegend
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
protected int drawLegend(Canvas canvas, DefaultRenderer defaultrenderer, String as[], int i, int j, int k, int l,
int i1, int j1, Paint paint, boolean flag)
{
float f = 32F;
if (defaultrenderer.isShowLegend())
{
float f1 = i;
float f2 = f + (float)((k + i1) - j1);
paint.setTextAlign(android.graphics.Paint.Align.LEFT);
paint.setTextSize(defaultrenderer.getLegendTextSize());
int k1 = Math.min(as.length, defaultrenderer.getSeriesRendererCount());
int l1 = 0;
while (l1 < k1)
{
SimpleSeriesRenderer simpleseriesrenderer = defaultrenderer.getSeriesRendererAt(l1);
float f3 = getLegendShapeWidth(l1);
float f4;
if (simpleseriesrenderer.isShowLegendItem())
{
String s = as[l1];
float af[];
float f5;
int i2;
if (as.length == defaultrenderer.getSeriesRendererCount())
{
paint.setColor(simpleseriesrenderer.getColor());
} else
{
paint.setColor(0xffcccccc);
}
af = new float[s.length()];
paint.getTextWidths(s, af);
f5 = 0.0F;
i2 = af.length;
for (int j2 = 0; j2 < i2; j2++)
{
f5 += af[j2];
}
float f6 = f5 + (10F + f3);
float f7 = f1 + f6;
if (l1 > 0 && getExceed(f7, defaultrenderer, j, l))
{
f1 = i;
f2 += defaultrenderer.getLegendTextSize();
float f9 = f + defaultrenderer.getLegendTextSize();
f7 = f1 + f6;
f4 = f9;
} else
{
f4 = f;
}
if (getExceed(f7, defaultrenderer, j, l))
{
float f8 = (float)j - f1 - f3 - 10F;
if (isVertical(defaultrenderer))
{
f8 = (float)l - f1 - f3 - 10F;
}
int k2 = paint.breakText(s, true, f8, af);
s = (new StringBuilder()).append(s.substring(0, k2)).append("...").toString();
}
if (!flag)
{
drawLegendShape(canvas, simpleseriesrenderer, f1, f2, l1, paint);
drawString(canvas, s, 5F + (f1 + f3), f2 + 5F, paint);
}
f1 += f6;
} else
{
f4 = f;
}
l1++;
f = f4;
}
}
return Math.round(f + defaultrenderer.getLegendTextSize());
}