本文整理汇总了Java中org.achartengine.model.XYMultipleSeriesDataset类的典型用法代码示例。如果您正苦于以下问题:Java XYMultipleSeriesDataset类的具体用法?Java XYMultipleSeriesDataset怎么用?Java XYMultipleSeriesDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYMultipleSeriesDataset类属于org.achartengine.model包,在下文中一共展示了XYMultipleSeriesDataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInBackground
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
@Override
protected String doInBackground(XYMultipleSeriesDataset... params) {
StringBuilder sb = new StringBuilder();
XYSeries series[] = params[0].getSeries();
int samples = series[0].getItemCount();
for (int i = 0; i < samples; i++) {
sb.append(i);
sb.append(", ");
sb.append(series[0].getY(i));
if (series.length > 1) {
sb.append(", ");
sb.append(series[1].getY(i));
if (series.length > 2) {
sb.append(", ");
sb.append(series[2].getY(i));
}
}
sb.append("\n");
publishProgress(10000 * i / samples);
}
return sb.toString();
}
示例2: getCombinedXYChartIntent
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* Creates a combined XY chart intent that can be used to start the graphical
* view activity.
*
* @param context the context
* @param dataset the multiple series dataset (cannot be null)
* @param renderer the multiple series renderer (cannot be null)
* @param types the chart types (cannot be null)
* @param activityTitle the graphical chart activity title
* @return a combined XY chart intent
* @throws IllegalArgumentException if dataset is null or renderer is null or
* if a dataset number of items is different than the number of
* series renderers or number of chart types
*/
public static final Intent getCombinedXYChartIntent(Context context,
XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String[] types,
String activityTitle) {
if (dataset == null || renderer == null || types == null
|| dataset.getSeriesCount() != types.length) {
throw new IllegalArgumentException(
"Datasets, renderers and types should be not null and the datasets series count should be equal to the types length");
}
checkParameters(dataset, renderer);
Intent intent = new Intent(context, GraphicalActivity.class);
CombinedXYChart chart = new CombinedXYChart(dataset, renderer, types);
intent.putExtra(CHART, chart);
intent.putExtra(TITLE, activityTitle);
return intent;
}
示例3: DataSetManager
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
public DataSetManager(int numberOfTabs, int numberOfConstellations,
Context context, ColorMap colorMap) {
mDataSetList = new ArrayList[numberOfTabs];
mRendererList = new ArrayList[numberOfTabs];
mSatelliteIndex = new ArrayList[numberOfTabs];
mSatelliteConstellationIndex = new ArrayList[numberOfTabs];
mContext = context;
mColorMap = colorMap;
// Preparing data sets and renderer for all six constellations
for (int i = 0; i < numberOfTabs; i++) {
mDataSetList[i] = new ArrayList<>();
mRendererList[i] = new ArrayList<>();
mSatelliteIndex[i] = new ArrayList<>();
mSatelliteConstellationIndex[i] = new ArrayList<>();
for (int k = 0; k <= numberOfConstellations; k++) {
mSatelliteIndex[i].add(new ArrayMap<Integer, Integer>());
mSatelliteConstellationIndex[i].add(new ArrayMap<Integer, Integer>());
XYMultipleSeriesRenderer tempRenderer = new XYMultipleSeriesRenderer();
setUpRenderer(tempRenderer, i);
mRendererList[i].add(tempRenderer);
XYMultipleSeriesDataset tempDataSet = new XYMultipleSeriesDataset();
mDataSetList[i].add(tempDataSet);
}
}
}
示例4: buildDateDataset
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* 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;
}
示例5: getAccelerometerData
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
private XYMultipleSeriesDataset getAccelerometerData() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
TimeSeries avgaSeries = new TimeSeries("Average");
TimeSeries minaSeries = new TimeSeries("Minimum");
TimeSeries maxaSeries = new TimeSeries("Maximum");
dataset.addSeries(avgaSeries);
dataset.addSeries(minaSeries);
dataset.addSeries(maxaSeries);
for (int i = 0; i < mHistoryList.size(); i++) {
VehicleInstance item = mHistoryList.get(i);
Long timestamp = item.getTimestamp();
MagnitudeFeatures accelFeatures = item.getAccelFeatures();
Double avga = accelFeatures.getAverage();
Double maxa = accelFeatures.getMaximum();
Double mina = accelFeatures.getMinimum();
avgaSeries.add(timestamp.doubleValue(), avga);
minaSeries.add(timestamp.doubleValue(), mina);
maxaSeries.add(timestamp.doubleValue(), maxa);
}
return dataset;
}
示例6: buildDateDataset
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* 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;
}
示例7: getGyroscopeData
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
private XYMultipleSeriesDataset getGyroscopeData() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
TimeSeries avggSeries = new TimeSeries("Average");
TimeSeries mingSeries = new TimeSeries("Minimum");
TimeSeries maxgSeries = new TimeSeries("Maximum");
dataset.addSeries(avggSeries);
dataset.addSeries(mingSeries);
dataset.addSeries(maxgSeries);
for (int i = 0; i < mHistoryList.size(); i++) {
VehicleInstance item = mHistoryList.get(i);
Long timestamp = item.getTimestamp();
MagnitudeFeatures gyroFeatures = item.getGyroFeatures();
Double avgg = gyroFeatures.getAverage();
Double maxg = gyroFeatures.getMaximum();
Double ming = gyroFeatures.getMinimum();
avggSeries.add(timestamp.doubleValue(), avgg);
mingSeries.add(timestamp.doubleValue(), ming);
maxgSeries.add(timestamp.doubleValue(), maxg);
}
return dataset;
}
示例8: buildDateDataset
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* 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;
}
示例9: buildBarDataset
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的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;
}
示例10: getDataset_type1
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
private XYMultipleSeriesDataset getDataset_type1() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
XYSeries firstSeries = new XYSeries(getString(R.string.altitude_label), 1);
XYSeries secondSeries = new XYSeries(getString(R.string.speed_label));
for (int i = 0; i < timeList.size(); i++) {
firstSeries.add(FunctionUtils.customizedRound(((float) timeList.get(i) / 60), 1),
altitudeList.get(i));
secondSeries.add(FunctionUtils.customizedRound(((float) timeList.get(i) / 60), 1),
speedList.get(i));
}
dataset.addSeries(firstSeries);
dataset.addSeries(secondSeries);
return dataset;
}
示例11: CombinedXYChart
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* Builds a new combined XY chart instance.
*
* @param dataset the multiple series dataset
* @param renderer the multiple series renderer
* @param types the XY chart types
*/
public CombinedXYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer,
String[] types) {
super(dataset, renderer);
int length = types.length;
mCharts = new XYChart[length];
for (int i = 0; i < length; i++) {
try {
mCharts[i] = getXYChart(types[i]);
} catch (Exception e) {
// ignore
}
if (mCharts[i] == null) {
throw new IllegalArgumentException("Unknown chart type " + types[i]);
} else {
XYMultipleSeriesDataset newDataset = new XYMultipleSeriesDataset();
newDataset.addSeries(dataset.getSeriesAt(i));
XYMultipleSeriesRenderer newRenderer = new XYMultipleSeriesRenderer();
// TODO: copy other parameters here
newRenderer.setBarSpacing(renderer.getBarSpacing());
newRenderer.setPointSize(renderer.getPointSize());
int scale = dataset.getSeriesAt(i).getScaleNumber();
if (renderer.isMinXSet(scale)) {
newRenderer.setXAxisMin(renderer.getXAxisMin(scale));
}
if (renderer.isMaxXSet(scale)) {
newRenderer.setXAxisMax(renderer.getXAxisMax(scale));
}
if (renderer.isMinYSet(scale)) {
newRenderer.setYAxisMin(renderer.getYAxisMin(scale));
}
if (renderer.isMaxYSet(scale)) {
newRenderer.setYAxisMax(renderer.getYAxisMax(scale));
}
newRenderer.addSeriesRenderer(renderer.getSeriesRendererAt(i));
mCharts[i].setDatasetRenderer(newDataset, newRenderer);
}
}
}
示例12: addXYSeries
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
private void addXYSeries(XYMultipleSeriesDataset dataset, String title, double[] xValues, double[] yValues, int scale) {
mSeries = new XYSeries(title, scale);
int seriesLength = xValues.length;
for(int k = 0; k < seriesLength; k++) {
mSeries.add(xValues[k], yValues[k]);
}
dataset.addSeries(mSeries);
}
示例13: addValue
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* Adds a value into the both the data set containing all constellations and individual data set
* of the constellation of the satellite
*/
private void addValue(int tab, int constellationType, int svID,
double timeInSeconds, double value) {
XYMultipleSeriesDataset dataSetAll = getDataSet(tab, DATA_SET_INDEX_ALL);
XYMultipleSeriesRenderer rendererAll = getRenderer(tab, DATA_SET_INDEX_ALL);
value = Double.parseDouble(sDataFormat.format(value));
if (hasSeen(constellationType, svID, tab)) {
// If the satellite has been seen before, we retrieve the dataseries it is add and add new
// data
dataSetAll
.getSeriesAt(mSatelliteIndex[tab].get(constellationType).get(svID))
.add(timeInSeconds, value);
mDataSetList[tab]
.get(constellationType)
.getSeriesAt(mSatelliteConstellationIndex[tab].get(constellationType).get(svID))
.add(timeInSeconds, value);
} else {
// If the satellite has not been seen before, we create new dataset and renderer before
// adding data
mSatelliteIndex[tab].get(constellationType).put(svID, dataSetAll.getSeriesCount());
mSatelliteConstellationIndex[tab]
.get(constellationType)
.put(svID, mDataSetList[tab].get(constellationType).getSeriesCount());
XYSeries tempSeries = new XYSeries(CONSTELLATION_PREFIX[constellationType - 1] + svID);
tempSeries.add(timeInSeconds, value);
dataSetAll.addSeries(tempSeries);
mDataSetList[tab].get(constellationType).addSeries(tempSeries);
XYSeriesRenderer tempRenderer = new XYSeriesRenderer();
tempRenderer.setLineWidth(5);
tempRenderer.setColor(mColorMap.getColor(svID, constellationType));
rendererAll.addSeriesRenderer(tempRenderer);
mRendererList[tab].get(constellationType).addSeriesRenderer(tempRenderer);
}
}
示例14: fillInDiscontinuity
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* Creates a discontinuity of the satellites that has been seen but not reported in this batch
* of measurements
*/
private void fillInDiscontinuity(int tab, double referenceTimeSeconds) {
for (XYMultipleSeriesDataset dataSet : mDataSetList[tab]) {
for (int i = 0; i < dataSet.getSeriesCount(); i++) {
if (dataSet.getSeriesAt(i).getMaxX() < referenceTimeSeconds) {
dataSet.getSeriesAt(i).add(referenceTimeSeconds, MathHelper.NULL_VALUE);
}
}
}
}
示例15: init
import org.achartengine.model.XYMultipleSeriesDataset; //导入依赖的package包/类
/**
* Initialize ECG chart.
*/
private void init() {
this.mECGList = new ArrayList<>();
this.mECGList.add(new XYSeries(TITLES[0]));
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addAllSeries(this.mECGList);
this.mXYMultipleSeriesRenderer = buildRenderer();
mLineChart = new LineChart(dataset, mXYMultipleSeriesRenderer);
mGraphicalView = new GraphicalView(getActivity(), mLineChart);
}