本文整理汇总了Java中org.achartengine.model.TimeSeries类的典型用法代码示例。如果您正苦于以下问题:Java TimeSeries类的具体用法?Java TimeSeries怎么用?Java TimeSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimeSeries类属于org.achartengine.model包,在下文中一共展示了TimeSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildDateDataset
import org.achartengine.model.TimeSeries; //导入依赖的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;
}
示例2: addAlertSeries
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
private void addAlertSeries() {
TimeSeries alertSeries = new TimeSeries("Alerts");
long alertTime = _maxTime - 5000 * 60;
alertSeries.add(alertTime, Long.MAX_VALUE);
alertSeries.add(alertTime, Long.MIN_VALUE);
_dataSet.addSeries(alertSeries);
// create new renderer for the new series
XYSeriesRenderer renderer = new XYSeriesRenderer();
_multipleSeriesRenderer.addSeriesRenderer(renderer);
renderer.setPointStyle(PointStyle.POINT);
renderer.setColor(Color.RED);
renderer.setFillPoints(false);
renderer.setDisplayChartValues(false);
// renderer.setDisplayChartValuesDistance(1);
// renderer.setChartValuesTextSize(30f);
renderer.setShowLegendItem(false);
}
示例3: buildDateDataset
import org.achartengine.model.TimeSeries; //导入依赖的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;
}
示例4: buildDateDataset
import org.achartengine.model.TimeSeries; //导入依赖的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.TimeSeries; //导入依赖的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: getGyroscopeData
import org.achartengine.model.TimeSeries; //导入依赖的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;
}
示例7: buildDateDataset
import org.achartengine.model.TimeSeries; //导入依赖的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;
Log.v("X", xV.length + "");
Log.v("Y", yV.length + "");
for (int k = 0; k < seriesLength; k++) {
series.add(xV[k], yV[k]);
}
dataset.addSeries(series);
}
return dataset;
}
示例8: onTemperature
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
@Override
public void onTemperature(StoredBleDevice device, int temperature) {
if (_offline) {
return;
}
// add new point
int seriesIdx = deviceSeriesMap.get(device.getAddress());
TimeSeries series = (TimeSeries)_dataSet.getSeriesAt(seriesIdx);
series.add(new Date(), temperature);
// update y-axis range
if (temperature > _maxTemp) {
_maxTemp = (long)(temperature + (temperature - _minTemp) * 0.2);
}
if (temperature < _minTemp) {
_minTemp = Math.min(0, (long)(temperature - (_maxTemp - temperature) * 0.2));
}
// update x-axis range
_maxTime = new Date().getTime();
_liveMinTime = _maxTime - 30 * 60 * 1000;
// update range
if (_zoomLevel == 0) {
_multipleSeriesRenderer.setInitialRange(new double[]{_liveMinTime, _maxTime, _minTemp, _maxTemp});
_multipleSeriesRenderer.setRange(new double[]{_liveMinTime, _maxTime, _minTemp, _maxTemp});
}
// redraw
runOnUiThread(new Runnable() {
@Override
public void run() {
_graphView.repaint();
}
});
}
示例9: getDateDemoDataset
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
private XYMultipleSeriesDataset getDateDemoDataset() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
final int nr = 10;
long value = new Date().getTime() - 3 * TimeChart.DAY;
Random r = new Random();
for (int i = 0; i < SERIES_NR; i++) {
TimeSeries series = new TimeSeries("Demo series " + (i + 1));
for (int k = 0; k < nr; k++) {
series.add(new Date(value + k * TimeChart.DAY / 4), 20 + r.nextInt() % 100);
}
dataset.addSeries(series);
}
return dataset;
}
示例10: prepareAccelerometerSeries
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
private void prepareAccelerometerSeries() {
accelerometerSeries = new TimeSeries(ACCELEROMETER_SERIES_TITLE);
dataset.addSeries(accelerometerSeries);
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setPointStyle(PointStyle.CIRCLE);
renderer.setFillPoints(true);
renderer.setColor(Color.BLUE);
this.renderer.addSeriesRenderer(renderer);
}
示例11: prepareThresholdSeries
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
private void prepareThresholdSeries() {
mThresholdSeries = new TimeSeries(THRESHOLD_SERIES_TITLE);
dataset.addSeries(mThresholdSeries);
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setLineWidth(3f);
renderer.setColor(Color.BLACK);
this.renderer.addSeriesRenderer(renderer);
}
示例12: GraphView
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
public GraphView(Context context) {
super(context);
XYMultipleSeriesDataset ds = new XYMultipleSeriesDataset();
series = new TimeSeries("quote");
ds.addSeries(series);
renderers = new XYMultipleSeriesRenderer();
renderer = new XYSeriesRenderer();
renderer.setColor(Color.GREEN);
renderer.setLineWidth(5.0f);
renderer.setFillBelowLine(true);
renderer.setFillBelowLineColor(Color.green(64));
renderers.addSeriesRenderer(renderer);
tc = new TimeChart(ds, renderers);
}
示例13: onActivityCreated
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d(TAG, "onActivityCreated");
mViewZoomIn = getActivity().findViewById(R.id.zoom_in);
mViewZoomOut = getActivity().findViewById(R.id.zoom_out);
mViewZoomReset = getActivity().findViewById(R.id.zoom_reset);
mViewZoomIn.setOnClickListener(this);
mViewZoomOut.setOnClickListener(this);
mViewZoomReset.setOnClickListener(this);
pulseSeries = new TimeSeries("Pulse");
if (mPulses.size() > 0) {
for (Pulse p : mPulses) {
pulseSeries.add(new Date(p.getTime()), p.getValue());
}
}
mDataset.addSeries(pulseSeries);
// graph itself
XYSeriesRenderer pulseRenderer = new XYSeriesRenderer();
pulseRenderer.setDisplayChartValues(true);
pulseRenderer.setChartValuesTextSize(25);
pulseRenderer.setPointStyle(PointStyle.CIRCLE);
pulseRenderer.setColor(Color.RED);
pulseRenderer.setFillPoints(true);
pulseRenderer.setLineWidth(3);
mRenderer.addSeriesRenderer(pulseRenderer);
maxXRange = pulseSeries.getMaxX();
minXRange = pulseSeries.getMinX();
}
示例14: initChart
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
private void initChart() {
xChartSeries = new TimeSeries("x");
yChartSeries = new TimeSeries("y");
zChartSeries = new TimeSeries("z");
dataSet.addSeries(xChartSeries);
dataSet.addSeries(yChartSeries);
dataSet.addSeries(zChartSeries);
xSeriesRenderer = new XYSeriesRenderer();
xSeriesRenderer.setColor(Color.parseColor("#99cc00"));
ySeriesRenderer = new XYSeriesRenderer();
ySeriesRenderer.setColor(Color.parseColor("#ffbb33"));
zSeriesRenderer = new XYSeriesRenderer();
zSeriesRenderer.setColor(Color.parseColor("#ff4444"));
dataRenderer.addSeriesRenderer(xSeriesRenderer);
dataRenderer.addSeriesRenderer(ySeriesRenderer);
dataRenderer.addSeriesRenderer(zSeriesRenderer);
dataRenderer.setBackgroundColor(Color.parseColor("#000000"));
dataRenderer.setApplyBackgroundColor(true);
// dataRenderer.setAxesColor(Color.parseColor("#0099cc"));
dataRenderer.setXLabelsColor(Color.parseColor("#33b5e5"));
dataRenderer.setLabelsTextSize(20.0f);
dataRenderer.setLabelsColor(Color.parseColor("#0099cc"));
dataRenderer.setChartTitle(chartTitle);
dataRenderer.setChartTitleTextSize(20.0f);
dataRenderer.setLegendTextSize(36.0f);
isChartReady = true;
}
示例15: createGraph
import org.achartengine.model.TimeSeries; //导入依赖的package包/类
protected void createGraph() {
graphRenderer = new XYMultipleSeriesRenderer();
graphRenderer.setChartTitle("Line Graph");
graphRenderer.setChartTitleTextSize(50);
graphRenderer.setMargins(new int[] {100, 100, 70, 50}); // top, left, bottom, right
graphRenderer.setBackgroundColor(Color.WHITE);
graphRenderer.setMarginsColor(Color.parseColor("#FFFFFF"));
graphRenderer.setAxesColor(Color.DKGRAY);
graphRenderer.setXTitle("Time(sec)");
graphRenderer.setYTitle("Value");
graphRenderer.setAxisTitleTextSize(30);
graphRenderer.setLabelsTextSize(25);
graphRenderer.setYLabelsAlign(Paint.Align.RIGHT);
// graphRenderer.setPointSize(50);
graphRenderer.setLegendTextSize(30);
graphRenderer.setXAxisMin(0);
graphRenderer.setXAxisMax(100);
graphRenderer.setZoomEnabled(false, false);
graphDataSerieses = new XYSeries[sensorInfo.getType().getValueNumbers()];
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();;
for(int loop1 = 0 ; loop1 < sensorInfo.getType().getValueNumbers() ; loop1++) {
graphDataSerieses[loop1] = new TimeSeries(sensorInfo.getType().getValueInfos()[loop1][0] + "(" + sensorInfo.getType().getValueInfos()[loop1][1] + ")");
dataset.addSeries(graphDataSerieses[loop1]);
XYSeriesRenderer seriesRenderer = new XYSeriesRenderer();
seriesRenderer.setColor(Color.parseColor(COLORS[loop1]));
seriesRenderer.setPointStyle(PointStyle.POINT);
seriesRenderer.setLineWidth(3);
graphRenderer.addSeriesRenderer(seriesRenderer);
}
graphView = ChartFactory.getLineChartView(this, dataset, graphRenderer);
LinearLayout graphArea = (LinearLayout) findViewById(R.id.ll_graph_area);
graphArea.addView(graphView);
graphArea.setClickable(false);
}