本文整理汇总了Java中org.achartengine.model.CategorySeries类的典型用法代码示例。如果您正苦于以下问题:Java CategorySeries类的具体用法?Java CategorySeries怎么用?Java CategorySeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategorySeries类属于org.achartengine.model包,在下文中一共展示了CategorySeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPieChart
import org.achartengine.model.CategorySeries; //导入依赖的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: buildBarDataset
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
/**
* Builds a bar multiple series dataset using the provided values.
*
* @param titles
* the series titles
* @param values
* the values
* @return the XY multiple bar dataset
*/
protected XYMultipleSeriesDataset buildBarDataset(String[] titles,
List<double[]> values) {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
int length = titles.length;
for (int i = 0; i < length; i++) {
CategorySeries series = new CategorySeries(titles[i]);
double[] v = values.get(i);
int seriesLength = v.length;
for (int k = 0; k < seriesLength; k++) {
series.add(v[k]);
}
dataset.addSeries(series.toXYSeries());
}
return dataset;
}
示例3: execute
import org.achartengine.model.CategorySeries; //导入依赖的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);
}
示例4: updateChart
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
private void updateChart() {
XYMultipleSeriesDataset data = new XYMultipleSeriesDataset();
CategorySeries correctSeries = new CategorySeries("Correct");
CategorySeries wrongSeries = new CategorySeries("Wrong");
int correct = mPlayStats.getNumberCorrect(mCard);
int wrong = mPlayStats.getNumberWrong(mCard);
mStatsLabel.setText(correct + " Correct, " + wrong + " Wrong");
correctSeries.add("Correct", correct);
wrongSeries.add("Wrong", wrong);
data.addSeries(correctSeries.toXYSeries());
data.addSeries(wrongSeries.toXYSeries());
barRenderer.setYAxisMax(Math.max(correct, wrong));
mBarChartView = ChartFactory.getBarChartView(getContext(), data, barRenderer, BarChart.Type.DEFAULT);
mChartLayout.removeAllViews();
mChartLayout.addView(mBarChartView);
}
示例5: createChart
import org.achartengine.model.CategorySeries; //导入依赖的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);
}
示例6: addSeries
import org.achartengine.model.CategorySeries; //导入依赖的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);
}
}
示例7: onCreate
import org.achartengine.model.CategorySeries; //导入依赖的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);
}
示例8: onCreate
import org.achartengine.model.CategorySeries; //导入依赖的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);
}
示例9: buildCategoryDataset
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
/**
* Builds a category series using the provided values.
*
* @param titles the series titles
* @param values the values
* @return the category series
*/
protected CategorySeries buildCategoryDataset(String title, double[] values) {
CategorySeries series = new CategorySeries(title);
int k = 0;
for (double value : values) {
series.add("Project " + ++k, value);
}
return series;
}
示例10: buildBarDataset
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
/**
* Builds a bar multiple series dataset using the provided values.
*
* @param titles the series titles
* @param values the values
* @return the XY multiple bar dataset
*/
protected XYMultipleSeriesDataset buildBarDataset(String[] titles, List<double[]> values) {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
int length = titles.length;
for (int i = 0; i < length; i++) {
CategorySeries series = new CategorySeries(titles[i]);
double[] v = values.get(i);
int seriesLength = v.length;
for (int k = 0; k < seriesLength; k++) {
series.add(v[k]);
}
dataset.addSeries(series.toXYSeries());
}
return dataset;
}
示例11: getBarDemoDataset
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
private XYMultipleSeriesDataset getBarDemoDataset() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
final int nr = 10;
Random r = new Random();
for (int i = 0; i < SERIES_NR; i++) {
CategorySeries series = new CategorySeries("Demo series " + (i + 1));
for (int k = 0; k < nr; k++) {
series.add(100 + r.nextInt() % 100);
}
dataset.addSeries(series.toXYSeries());
}
return dataset;
}
示例12: buildCategoryDataset
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
/**
* Builds a category series using the provided values.
*
* @param titles
* the series titles
* @param values
* the values
* @return the category series
*/
protected CategorySeries buildCategoryDataset(String title, double[] values) {
CategorySeries series = new CategorySeries(title);
int k = 0;
for (double value : values) {
series.add("Project " + ++k, value);
}
return series;
}
示例13: a
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
private static void a(CategorySeries categoryseries, DefaultRenderer defaultrenderer)
{
if (categoryseries == null || defaultrenderer == null || categoryseries.getItemCount() != defaultrenderer.getSeriesRendererCount())
{
throw new IllegalArgumentException("Dataset and renderer should be not null and the dataset number of items should be equal to the number of series renderers");
} else
{
return;
}
}
示例14: getDialChartIntent
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
public static final Intent getDialChartIntent(Context context, CategorySeries categoryseries, DialRenderer dialrenderer, String s)
{
a(categoryseries, dialrenderer);
Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
intent.putExtra("chart", new DialChart(categoryseries, dialrenderer));
intent.putExtra("title", s);
return intent;
}
示例15: getPieChartIntent
import org.achartengine.model.CategorySeries; //导入依赖的package包/类
public static final Intent getPieChartIntent(Context context, CategorySeries categoryseries, DefaultRenderer defaultrenderer, String s)
{
a(categoryseries, defaultrenderer);
Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
intent.putExtra("chart", new PieChart(categoryseries, defaultrenderer));
intent.putExtra("title", s);
return intent;
}