本文整理汇总了Java中org.achartengine.renderer.DefaultRenderer类的典型用法代码示例。如果您正苦于以下问题:Java DefaultRenderer类的具体用法?Java DefaultRenderer怎么用?Java DefaultRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultRenderer类属于org.achartengine.renderer包,在下文中一共展示了DefaultRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPieChart
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
private Intent createPieChart() {
DefaultRenderer renderer = new DefaultRenderer();
renderer.setLabelsTextSize(getResources().getDimension(R.dimen.report_labels_text_size));
renderer.setLegendTextSize(getResources().getDimension(R.dimen.report_legend_text_size));
renderer.setMargins(new int[] { 0, 0, 0, 0 });
ReportData report = currentReport.getReportForChart(db, WhereFilter.copyOf(filter));
CategorySeries series = new CategorySeries("AAA");
long total = Math.abs(report.total.amount)+Math.abs(report.total.balance);
int[] colors = generateColors(2*report.units.size());
int i = 0;
for (GraphUnit unit : report.units) {
addSeries(series, renderer, unit.name, unit.getIncomeExpense().income, total, colors[i++]);
addSeries(series, renderer, unit.name, unit.getIncomeExpense().expense, total, colors[i++]);
}
renderer.setZoomButtonsVisible(true);
renderer.setZoomEnabled(true);
renderer.setChartTitleTextSize(20);
return ChartFactory.getPieChartIntent(ReportActivity.this, series, renderer, getString(R.string.report));
}
示例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(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;
}
示例3: execute
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 12, 14, 11, 10, 19 });
values.add(new double[] { 10, 9, 14, 20, 11 });
List<String[]> titles = new ArrayList<String[]>();
titles.add(new String[] { "P1", "P2", "P3", "P4", "P5" });
titles.add(new String[] { "Project1", "Project2", "Project3", "Project4", "Project5" });
int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };
DefaultRenderer renderer = buildCategoryRenderer(colors);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.rgb(222, 222, 200));
renderer.setLabelsColor(Color.GRAY);
return ChartFactory.getDoughnutChartIntent(context,
buildMultipleCategoryDataset("Project budget", titles, values), renderer,
"Doughnut chart demo");
}
示例4: drawBackground
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
protected void drawBackground(DefaultRenderer defaultrenderer, Canvas canvas, int i, int j, int k, int l, Paint paint,
boolean flag, int i1)
{
if (defaultrenderer.isApplyBackgroundColor() || flag)
{
if (flag)
{
paint.setColor(i1);
} else
{
paint.setColor(defaultrenderer.getBackgroundColor());
}
paint.setStyle(android.graphics.Paint.Style.FILL);
canvas.drawRect(i, j, i + k, j + l, paint);
}
}
示例5: getExceed
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
protected boolean getExceed(float f, DefaultRenderer defaultrenderer, int i, int j)
{
boolean flag;
if (f > (float)i)
{
flag = true;
} else
{
flag = false;
}
if (isVertical(defaultrenderer))
{
return f > (float)j;
} else
{
return flag;
}
}
示例6: execute
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
public GraphicalView execute(Context context){
int[] colors = new int[]{Color.GREEN, Color.LTGRAY, Color.BLUE, Color.RED, Color.DKGRAY, Color.MAGENTA};
DefaultRenderer renderer = buildCategoryRenderer(colors);
CategorySeries categorySeries = new CategorySeries("Resolution Ratio Chart");
// Calculating normalization coefficient
double valueSum = 0;
for(int i = 0;i < value.length;i++){
valueSum += value[i];
}
// Adding data to Series
for(int i = 0;i < Playbackquality.length;i++){
categorySeries.add(Playbackquality[i], value[i]/valueSum);
}
return ChartFactory.getPieChartView(context, categorySeries, renderer);
}
示例7: buildCategoryRenderer
import org.achartengine.renderer.DefaultRenderer; //导入依赖的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;
}
示例8: createChart
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
private GraphicalView createChart(Context context, ResponseGetDeviceInfo deviceInfo) {
int[] colors = new int[] { context.getResources().getColor(R.color.darkRed),
context.getResources().getColor(R.color.verdeOscuro)};
DefaultRenderer renderer = buildCategoryRenderer(colors);
renderer.setZoomButtonsVisible(true);
renderer.setZoomEnabled(true);
renderer.setChartTitleTextSize(20);
renderer.setLabelsColor(Color.BLACK);
CategorySeries categorySeries = new CategorySeries("");
try {
//Title in the graph
renderer.setChartTitle(deviceInfo.getAccessPath() + " ("+deviceInfo.getSizeHuman()+")"); //It is the drive name
long usedInNumeric = deviceInfo.getSize() - deviceInfo.getFreeDiskSpace();
//TODO i18n words 'used' and 'free'
categorySeries.add("Used " + deviceInfo.getUsedDiskSpaceHuman(), usedInNumeric);
categorySeries.add("Free " + deviceInfo.getFreeDiskSpaceHuman(), deviceInfo.getFreeDiskSpace());
} catch (Exception e) {
showToastError(R.string.error_parsing_data);
}
return ChartFactory.getPieChartView(context, categorySeries, renderer);
}
示例9: 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;
}
示例10: execute
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 12, 14, 11, 10, 19 });
values.add(new double[] { 10, 9, 14, 20, 11 });
List<String[]> titles = new ArrayList<String[]>();
titles.add(new String[] { "P1", "P2", "P3", "P4", "P5" });
titles.add(new String[] { "Project1", "Project2", "Project3", "Project4", "Project5" });
int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN };
DefaultRenderer renderer = buildCategoryRenderer(colors);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.rgb(222, 222, 200));
renderer.setLabelsColor(Color.GRAY);
return ChartFactory.getDoughnutChartIntent(context,
buildMultipleCategoryDataset("Project budget", titles, values), renderer,
"Doughnut chart demo");
}
示例11: getLegendSize
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
/**
* Calculates the current legend size.
*
* @param renderer the renderer
* @param defaultHeight the default height
* @param extraHeight the added extra height
* @return the legend size
*/
protected int getLegendSize(DefaultRenderer renderer, int defaultHeight, float extraHeight) {
int legendSize = renderer.getLegendHeight();
if (renderer.isShowLegend() && legendSize == 0) {
legendSize = defaultHeight;
}
if (!renderer.isShowLegend() && renderer.isShowLabels()) {
legendSize = (int) (renderer.getLabelsTextSize() * 4 / 3 + extraHeight);
}
return legendSize;
}
示例12: addSeries
import org.achartengine.renderer.DefaultRenderer; //导入依赖的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);
}
}
示例13: getDonutRenderer
import org.achartengine.renderer.DefaultRenderer; //导入依赖的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;
}
示例14: onCreate
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.paydata);
SysApplication.getInstance().addActivity(this); // �����ٶ��������this
time = new Time("GMT+8");
time.setToNow();
defaultMonth = time.month + 1;// ����Ĭ���·�
defaultYear = time.year;
beforet = (Button) findViewById(R.id.pbefore);
aftert = (Button) findViewById(R.id.pafter);
anytime = (Button) findViewById(R.id.panytime);
year = (Spinner) findViewById(R.id.pyear);
month = (Spinner) findViewById(R.id.pmonth);
day = (Spinner) findViewById(R.id.pday);
yeare = (Spinner) findViewById(R.id.pyeare);
monthe = (Spinner) findViewById(R.id.pmonthe);
daye = (Spinner) findViewById(R.id.pdaye);
piechart = (LinearLayout) findViewById(R.id.pchart);
nodata = (TextView) findViewById(R.id.nodata);
pdataselect = (LinearLayout) findViewById(R.id.pdataselect);
mSeries = new CategorySeries("");
mRenderer = new DefaultRenderer();// PieChart����Ҫ�����
yearlist = new ArrayList<String>(); // ��������б� spinner
payDAO = new PayDAO(PayData.this);
KindDatap = new ArrayList<KindData>();
ptypeDAO = new PtypeDAO(PayData.this);
// ������
for (int i = 0; i <= 10; i++) {
yearlist.add(String.valueOf(defaultYear - i));
}
adapter = new ArrayAdapter<String>(PayData.this,
android.R.layout.simple_spinner_item, yearlist);
year.setAdapter((SpinnerAdapter) adapter);
yeare.setAdapter((SpinnerAdapter) adapter);
}
示例15: onCreate
import org.achartengine.renderer.DefaultRenderer; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.incomedata);
SysApplication.getInstance().addActivity(this); // �����ٶ��������this
time = new Time("GMT+8");
time.setToNow();
defaultMonth=time.month+1;//����Ĭ���·�
defaultYear=time.year;
beforet=(Button)findViewById(R.id.ibefore);
aftert=(Button)findViewById(R.id.iafter);
anytime=(Button)findViewById(R.id.ianytime);
year=(Spinner)findViewById(R.id.iyear);
month=(Spinner)findViewById(R.id.imonth);
day=(Spinner)findViewById(R.id.iday);
yeare=(Spinner)findViewById(R.id.iyeare);
monthe=(Spinner)findViewById(R.id.imonthe);
daye=(Spinner)findViewById(R.id.idaye);
nodata=(TextView)findViewById(R.id.nodata);
idataselect=(LinearLayout)findViewById(R.id.idataselect);
piechart=(LinearLayout)findViewById(R.id.ichart);
mSeries = new CategorySeries("");
mRenderer = new DefaultRenderer();// PieChart����Ҫ�����
yearlist=new ArrayList<String>(); //��������б� spinner
itypeDAO=new ItypeDAO(IncomeData.this);
//������
for(int i=0;i<=10;i++){
yearlist.add(String.valueOf(defaultYear-i));
}
adapter=new ArrayAdapter<String>(IncomeData.this,android.R.layout.simple_spinner_item,yearlist);
year.setAdapter((SpinnerAdapter) adapter);
yeare.setAdapter((SpinnerAdapter) adapter);
}