/**
* Copyright (C) 2009, 2010 SC 4ViewSoft SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.achartengine.chartdemo.demo.chart;
import java.util.Date;
import java.util.List;
import org.achartengine.chart.PointStyle;
import org.achartengine.model.CategorySeries;
import org.achartengine.model.MultipleCategorySeries;
import org.achartengine.model.TimeSeries;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;
import org.achartengine.renderer.DefaultRenderer;
import org.achartengine.renderer.SimpleSeriesRenderer;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;
/**
* An abstract class for the demo charts to extend.
*/
public abstract class AbstractDemoChart implements IChart {
/**
* Builds an XY multiple dataset using the provided values.
*
* @param titles the series titles
* @param xValues the values for the X axis
* @param yValues the values for the Y axis
* @return the XY multiple dataset
*/
protected XYMultipleSeriesDataset buildDataset(String[] titles, List<double[]> xValues,
List<double[]> yValues) {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
int length = titles.length;
for (int i = 0; i < length; i++) {
XYSeries series = new XYSeries(titles[i]);
double[] xV = xValues.get(i);
double[] yV = yValues.get(i);
int seriesLength = xV.length;
for (int k = 0; k < seriesLength; k++) {
series.add(xV[k], yV[k]);
}
dataset.addSeries(series);
}
return dataset;
}
/**
* Builds an XY multiple series renderer.
*
* @param colors the series rendering colors
* @param styles the series point styles
* @return the XY multiple series renderers
*/
protected XYMultipleSeriesRenderer buildRenderer(int[] colors, PointStyle[] styles) {
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setAxisTitleTextSize(16);
renderer.setChartTitleTextSize(20);
renderer.setLabelsTextSize(15);
renderer.setLegendTextSize(15);
renderer.setPointSize(5f);
renderer.setMargins(new int[] { 20, 30, 15, 0 });
int length = colors.length;
for (int i = 0; i < length; i++) {
XYSeriesRenderer r = new XYSeriesRenderer();
r.setColor(colors[i]);
r.setPointStyle(styles[i]);
renderer.addSeriesRenderer(r);
}
return renderer;
}
/**
* Sets a few of the series renderer settings.
*
* @param renderer the renderer to set the properties to
* @param title the chart title
* @param xTitle the title for the X axis
* @param yTitle the title for the Y axis
* @param xMin the minimum value on the X axis
* @param xMax the maximum value on the X axis
* @param yMin the minimum value on the Y axis
* @param yMax the maximum value on the Y axis
* @param axesColor the axes color
* @param labelsColor the labels color
*/
protected void setChartSettings(XYMultipleSeriesRenderer renderer, String title, String xTitle,
String yTitle, double xMin, double xMax, double yMin, double yMax, int axesColor,
int labelsColor) {
renderer.setChartTitle(title);
renderer.setXTitle(xTitle);
renderer.setYTitle(yTitle);
renderer.setXAxisMin(xMin);
renderer.setXAxisMax(xMax);
renderer.setYAxisMin(yMin);
renderer.setYAxisMax(yMax);
renderer.setAxesColor(axesColor);
renderer.setLabelsColor(labelsColor);
}
/**
* Builds an XY multiple time dataset using the provided values.
*
* @param titles the series titles
* @param xValues the values for the X axis
* @param yValues the values for the Y axis
* @return the XY multiple time dataset
*/
protected XYMultipleSeriesDataset buildDateDataset(String[] titles, List<Date[]> xValues,
List<double[]> yValues) {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
int length = titles.length;
for (int i = 0; i < length; i++) {
TimeSeries series = new TimeSeries(titles[i]);
Date[] xV = xValues.get(i);
double[] yV = yValues.get(i);
int seriesLength = xV.length;
for (int k = 0; k < seriesLength; k++) {
series.add(xV[k], yV[k]);
}
dataset.addSeries(series);
}
return dataset;
}
/**
* 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;
}
/**
* Builds a multiple category series using the provided values.
*
* @param titles the series titles
* @param values the values
* @return the category series
*/
protected MultipleCategorySeries buildMultipleCategoryDataset(String title,
List<String[]> titles, List<double[]> values) {
MultipleCategorySeries series = new MultipleCategorySeries(title);
int k = 0;
for (double[] value : values) {
series.add(2007 + k + "", titles.get(k), value);
k++;
}
return series;
}
/**
* Builds a category renderer to use the provided colors.
*
* @param colors the colors
* @return the category renderer
*/
protected DefaultRenderer buildCategoryRenderer(int[] colors) {
DefaultRenderer renderer = new DefaultRenderer();
renderer.setLabelsTextSize(15);
renderer.setLegendTextSize(15);
renderer.setMargins(new int[] { 20, 30, 15, 0 });
for (int color : colors) {
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(color);
renderer.addSeriesRenderer(r);
}
return renderer;
}
/**
* 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;
}
/**
* Builds a bar multiple series renderer to use the provided colors.
*
* @param colors the series renderers colors
* @return the bar multiple series renderer
*/
protected XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setAxisTitleTextSize(16);
renderer.setChartTitleTextSize(20);
renderer.setLabelsTextSize(15);
renderer.setLegendTextSize(15);
int length = colors.length;
for (int i = 0; i < length; i++) {
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(colors[i]);
没有合适的资源?快使用搜索试试~ 我知道了~
图表报表 Android 多种统计图表源码(程序源码).zip
共62个文件
class:27个
java:20个
png:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 67 浏览量
2023-03-17
08:54:37
上传
评论
收藏 264KB ZIP 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
图表报表 Android 多种统计图表源码(程序源码).zip (62个子文件)
StaticChartDemo
lib
achartengine-0.6.0.jar 60KB
.classpath 345B
assets
src
org
achartengine
chartdemo
demo
ChartDemo.java 4KB
GeneratedChartDemo.java 7KB
chart
ProjectStatusBubbleChart.java 3KB
SalesComparisonChart.java 3KB
ScatterChart.java 3KB
SensorValuesChart.java 4KB
TemperatureChart.java 3KB
BudgetDoughnutChart.java 2KB
SalesStackedBarChart.java 3KB
XYChartBuilder.java 5KB
IChart.java 1KB
BudgetPieChart.java 2KB
ProjectStatusChart.java 3KB
SalesBarChart.java 3KB
TrigonometricFunctionsChart.java 3KB
SalesGrowthChart.java 3KB
AverageTemperatureChart.java 3KB
AbstractDemoChart.java 8KB
WeightDialChart.java 3KB
res
drawable-mdpi
icon.png 3KB
drawable-ldpi
icon.png 2KB
values
strings.xml 320B
layout
xy_chart.xml 2KB
drawable
icon.png 3KB
drawable-hdpi
icon.png 4KB
bin
resources.ap_ 15KB
classes.dex 94KB
Achartengine0.6-Demo.apk 64KB
org
achartengine
chartdemo
demo
GeneratedChartDemo.class 8KB
R$string.class 582B
R$layout.class 437B
R$id.class 543B
R$attr.class 379B
R$drawable.class 439B
ChartDemo.class 4KB
chart
XYChartBuilder.class 5KB
BudgetDoughnutChart.class 2KB
BudgetPieChart.class 2KB
SalesGrowthChart.class 3KB
AbstractDemoChart.class 7KB
SalesStackedBarChart.class 3KB
TrigonometricFunctionsChart.class 3KB
AverageTemperatureChart.class 4KB
SalesComparisonChart.class 4KB
IChart.class 365B
ScatterChart.class 3KB
SalesBarChart.class 3KB
SensorValuesChart.class 4KB
WeightDialChart.class 2KB
TemperatureChart.class 3KB
ProjectStatusChart.class 3KB
XYChartBuilder$1.class 2KB
XYChartBuilder$2.class 2KB
ProjectStatusBubbleChart.class 3KB
R.class 622B
proguard.cfg 1KB
default.properties 362B
.project 856B
AndroidManifest.xml 914B
gen
org
achartengine
chartdemo
demo
R.java 1KB
共 62 条
- 1
资源评论
金枝玉叶9
- 粉丝: 195
- 资源: 7637
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 使用C++实现的常见算法
- travel-web-springboot【程序员VIP专用】.zip
- 基于Matlab, ConvergeCase中部分2D结果文件输出至EXCEL中 能力有限,代码和功能极其简陋.zip
- java桌面小程序,主要为游戏.zip学习资源
- Java桌面-坦克大战小游戏.zip程序资源
- java语言做的魔板小游戏.zip
- 初学JAVA制作的坦克大战小游戏,使用JAVA 的GUI模拟2,5D界面.zip
- 公开整理-2024年832个国家级贫困县摘帽情况分省分年统计.xlsx
- 纯js+Jquery实现2048游戏
- 叠罗汉游戏,安卓java实现,自定义Framlayout,属性动画.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功