本文整理汇总了Java中org.achartengine.renderer.DefaultRenderer.setScale方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultRenderer.setScale方法的具体用法?Java DefaultRenderer.setScale怎么用?Java DefaultRenderer.setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.renderer.DefaultRenderer
的用法示例。
在下文中一共展示了DefaultRenderer.setScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePieChart
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的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);
}
示例2: DefaultPieChart
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
public DefaultPieChart()
{
mRenderer = new DefaultRenderer();
mSeries = new CategorySeries("");
mRenderer.setBackgroundColor(Color.BLACK);
mRenderer.setApplyBackgroundColor(false);
mRenderer.setExternalZoomEnabled(false);
mRenderer.setZoomEnabled(false);
mRenderer.setInScroll(false);
mRenderer.setShowLabels(false);
mRenderer.setShowLegend(false);
mRenderer.setZoomButtonsVisible(false);
mRenderer.setPanEnabled(false);
mRenderer.setClickEnabled(false);
mRenderer.setScale(Charting.PIE_CHART_SCALE);
mRenderer.setLabelsColor(Color.BLACK);
mRenderer.setStartAngle(90);
mRenderer.setMargins(WebLogicMonitor.getInstance().getResources().getIntArray(R.array.chart_margins));
// mRenderer.setBackgroundColor(WebLogicMonitor.getInstance().getResources().getColor(R.color.chart_background));
// mRenderer.setChartTitleTextSize(WebLogicMonitor.getInstance().getResources().getDimension(R.dimen.entity_chart_title_size));
// mRenderer.setLabelsTextSize(WebLogicMonitor.getInstance().getResources().getDimension(R.dimen.entity_chart_label_size));
// mRenderer.setLegendHeight((int) WebLogicMonitor.getInstance().getResources().getDimension(R.dimen.entity_chart_legend_height));
// mRenderer.setLegendTextSize(WebLogicMonitor.getInstance().getResources().getDimension(R.dimen.entity_chart_legend_text_size));
}
示例3: apply
import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
/**
* Apply the tool.
*/
public void apply() {
if (mChart instanceof XYChart) {
if (((XYChart) mChart).getDataset() == null) {
return;
}
int scales = mRenderer.getScalesCount();
if (mRenderer.isInitialRangeSet()) {
for (int i = 0; i < scales; i++) {
if (mRenderer.isInitialRangeSet(i)) {
mRenderer.setRange(mRenderer.getInitialRange(i), i);
}
}
} else {
XYSeries[] series = ((XYChart) mChart).getDataset().getSeries();
double[] range = null;
int length = series.length;
if (length > 0) {
for (int i = 0; i < scales; i++) {
range = new double[] { MathHelper.NULL_VALUE, -MathHelper.NULL_VALUE,
MathHelper.NULL_VALUE, -MathHelper.NULL_VALUE };
for (int j = 0; j < length; j++) {
if (i == series[j].getScaleNumber()) {
range[0] = Math.min(range[0], series[j].getMinX());
range[1] = Math.max(range[1], series[j].getMaxX());
range[2] = Math.min(range[2], series[j].getMinY());
range[3] = Math.max(range[3], series[j].getMaxY());
}
}
double marginX = Math.abs(range[1] - range[0]) / 40;
double marginY = Math.abs(range[3] - range[2]) / 40;
mRenderer.setRange(new double[] { range[0] - marginX, range[1] + marginX,
range[2] - marginY, range[3] + marginY }, i);
}
}
}
} else {
DefaultRenderer renderer = ((RoundChart) mChart).getRenderer();
renderer.setScale(renderer.getOriginalScale());
}
}