本文整理汇总了Java中org.achartengine.model.CategorySeries.add方法的典型用法代码示例。如果您正苦于以下问题:Java CategorySeries.add方法的具体用法?Java CategorySeries.add怎么用?Java CategorySeries.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.model.CategorySeries
的用法示例。
在下文中一共展示了CategorySeries.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例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: updatePieChart
import org.achartengine.model.CategorySeries; //导入方法依赖的package包/类
private void updatePieChart() {
DefaultRenderer pieRenderer = new DefaultRenderer();
SimpleSeriesRenderer correctRenderer = new SimpleSeriesRenderer();
SimpleSeriesRenderer wrongRenderer = new SimpleSeriesRenderer();
correctRenderer.setColor(correctColor);
wrongRenderer.setColor(wrongColor);
pieRenderer.addSeriesRenderer(correctRenderer);
pieRenderer.addSeriesRenderer(wrongRenderer);
if (!Themes.get(getContext()).isThemeDark()) {
pieRenderer.setLabelsColor(Color.DKGRAY);
} else {
pieRenderer.setLabelsColor(Color.WHITE);
}
pieRenderer.setLabelsTextSize(spToPixels(14));
pieRenderer.setShowLegend(false);
pieRenderer.setZoomEnabled(false);
pieRenderer.setPanEnabled(false);
pieRenderer.setChartTitleTextSize(spToPixels(20));
pieRenderer.setStartAngle(45);
pieRenderer.setScale(1.1f);
CategorySeries data = new CategorySeries("Overview");
data.add(playStats.getTotalCorrect() + " Correct", playStats.getTotalCorrect());
data.add(playStats.getTotalWrong() + " Wrong", playStats.getTotalWrong());
pieChartView = ChartFactory.getPieChartView(getContext(), data, pieRenderer);
pieLayout.removeAllViews();
pieLayout.addView(pieChartView);
}
示例11: buildBarDataset
import org.achartengine.model.CategorySeries; //导入方法依赖的package包/类
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;
}