本文整理汇总了Java中org.achartengine.model.XYSeries类的典型用法代码示例。如果您正苦于以下问题:Java XYSeries类的具体用法?Java XYSeries怎么用?Java XYSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYSeries类属于org.achartengine.model包,在下文中一共展示了XYSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInBackground
import org.achartengine.model.XYSeries; //导入依赖的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: drawChartValuesText
import org.achartengine.model.XYSeries; //导入依赖的package包/类
/**
* The graphical representation of the series values as text.
*
* @param canvas the canvas to paint to
* @param series the series to be painted
* @param renderer the series renderer
* @param paint the paint to be used for drawing
* @param points the array of points to be used for drawing the series
* @param seriesIndex the index of the series currently being drawn
* @param startIndex the start index of the rendering points
*/
protected void drawChartValuesText(Canvas canvas, XYSeries series, XYSeriesRenderer renderer,
Paint paint, List<Float> points, int seriesIndex, int startIndex) {
int seriesNr = mDataset.getSeriesCount();
int length = points.size();
float halfDiffX = getHalfDiffX(points, length, seriesNr);
for (int i = 0; i < length; i += 2) {
int index = startIndex + i / 2;
double value = series.getY(index);
if (!isNullValue(value)) {
float x = points.get(i);
if (mType == Type.DEFAULT) {
x += seriesIndex * 2 * halfDiffX - (seriesNr - 1.5f) * halfDiffX;
}
if (value >= 0) {
drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
- renderer.getChartValuesSpacing(), paint, 0);
} else {
drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
+ renderer.getChartValuesTextSize() + renderer.getChartValuesSpacing() - 3, paint, 0);
}
}
}
}
示例3: renderGraph
import org.achartengine.model.XYSeries; //导入依赖的package包/类
private void renderGraph() {
mSeries = new XYSeries("Vols/FreqBin");
div10 = new XYSeries("div10");
mSeries.add(3,4);
mRenderer = new XYSeriesRenderer();
div10Renderer = new XYSeriesRenderer();
div10Renderer.setColor(root.getResources().getColor(R.color.red));
dataset.addSeries(mSeries);
dataset.addSeries(div10);
renderer.addSeriesRenderer(mRenderer);
renderer.addSeriesRenderer(div10Renderer);
renderer.setPanEnabled(false);
renderer.setZoomEnabled(false);
mChart = ChartFactory.getLineChartView(getActivity(), dataset, renderer);
((LinearLayout)root.findViewById(R.id.chart)).addView(mChart);
}
示例4: addRenderer
import org.achartengine.model.XYSeries; //导入依赖的package包/类
@Override
public void addRenderer(int series, Activity activity, int color) {
XYSeriesRenderer mCurrentRenderer = new XYSeriesRenderer();
mCurrentRenderer.setLineWidth(getDPI(3));
mCurrentRenderer.setColor(color);
// Include low and max value
mCurrentRenderer.setDisplayBoundingPoints(true);
// we add point markers
mCurrentRenderer.setPointStyle(PointStyle.CIRCLE);
mCurrentRenderer.setPointStrokeWidth(getDPI(5));
mCurrentRenderer.setShowLegendItem(false);
XYSeries seriesData = new XYSeries("data" + series);
mSeriesDataSet.add(series, seriesData);
mRenderer.addSeriesRenderer(series, mCurrentRenderer);
}
示例5: getDataset_type1
import org.achartengine.model.XYSeries; //导入依赖的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;
}
示例6: pvChanged
import org.achartengine.model.XYSeries; //导入依赖的package包/类
@Override
public void pvChanged(PvChangeEvent event)
{
if (allowDataUpdates)
{
IndexedProcessVar pv = (IndexedProcessVar) event.getSource();
XYSeries series = (XYSeries) pv.get(FID_DATA_SERIES);
if (series != null)
{
if(event.getValue() instanceof Number)
{
series.add(event.getTime(),
((Number)event.getValue()).doubleValue());
}
}
// send update to plugin handler
if(PluginManager.pluginHandler != null)
{
PluginManager.pluginHandler.sendDataUpdate(
pv.get(EcuDataPv.FID_MNEMONIC).toString(),
event.getValue().toString());
}
}
}
示例7: addSeries
import org.achartengine.model.XYSeries; //导入依赖的package包/类
private void addSeries(float[] votesarr, int max, XYMultipleSeriesDataset dataSet,
XYMultipleSeriesRenderer multiRenderer, int i, String text,
XYSeriesRenderer renderer) {
XYSeries series = new XYSeries(text);
// Calculate the value in percent
double votes = votesarr[i] * 100 / max;
votes = MathUtils.roundToDecimals(votes, 2);
series.add(i+1, votes);
renderer.setDisplayChartValues(true);
renderer.setChartValuesTextSize(22);
dataSet.addSeries(series);
multiRenderer.addSeriesRenderer(renderer);
multiRenderer.addXTextLabel(i+1, text);
}
示例8: updateGraph
import org.achartengine.model.XYSeries; //导入依赖的package包/类
void updateGraph(final Graph g) {
if(g == null) return;
final String eq = mLogic.getText();
if(eq.isEmpty()) {
XYSeries series = new XYSeries("");
try {
clearGraph(g);
g.getDataset().addSeries(series);
}
catch(NullPointerException e) {
e.printStackTrace();
}
if(mLogic.mGraphDisplay != null) mLogic.mGraphDisplay.repaint();
return;
}
if(Logic.isOperator(eq.charAt(eq.length() - 1)) || mLogic.displayContainsMatrices() || eq.endsWith("(")) return;
new GraphTask(g, mLogic).execute(eq);
}
示例9: drawChartValuesText
import org.achartengine.model.XYSeries; //导入依赖的package包/类
/**
* The graphical representation of the series values as text.
*
* @param canvas the canvas to paint to
* @param series the series to be painted
* @param renderer the series renderer
* @param paint the paint to be used for drawing
* @param points the array of points to be used for drawing the series
* @param seriesIndex the index of the series currently being drawn
* @param startIndex the start index of the rendering points
*/
protected void drawChartValuesText(Canvas canvas, XYSeries series, SimpleSeriesRenderer renderer,
Paint paint, List<Float> points, int seriesIndex, int startIndex) {
int seriesNr = mDataset.getSeriesCount();
int length = points.size();
float halfDiffX = getHalfDiffX(points, length, seriesNr);
for (int i = 0; i < length; i += 2) {
int index = startIndex + i / 2;
double value = series.getY(index);
if (!isNullValue(value)) {
float x = points.get(i);
if (mType == Type.DEFAULT) {
x += seriesIndex * 2 * halfDiffX - (seriesNr - 1.5f) * halfDiffX;
}
if (value >= 0) {
drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
- renderer.getChartValuesSpacing(), paint, 0);
} else {
drawText(canvas, getLabel(renderer.getChartValuesFormat(), value), x, points.get(i + 1)
+ renderer.getChartValuesTextSize() + renderer.getChartValuesSpacing() - 3, paint, 0);
}
}
}
}
示例10: drawChartValuesText
import org.achartengine.model.XYSeries; //导入依赖的package包/类
/**
* The graphical representation of the series values as text.
*
* @param canvas the canvas to paint to
* @param series the series to be painted
* @param renderer the series renderer
* @param paint the paint to be used for drawing
* @param points the array of points to be used for drawing the series
* @param seriesIndex the index of the series currently being drawn
* @param startIndex the start index of the rendering points
*/
protected void drawChartValuesText(Canvas canvas, XYSeries series, XYSeriesRenderer renderer,
Paint paint, List<Float> points, int seriesIndex, int startIndex) {
int seriesNr = mDataset.getSeriesCount();
float halfDiffX = getHalfDiffX(points, points.size(), seriesNr);
int start = 0;
if (startIndex > 0) {
start = 2;
}
for (int i = start; i < points.size(); i += 4) {
int index = startIndex + i / 2;
float x = points.get(i);
if (mType == Type.DEFAULT) {
x += seriesIndex * 2 * halfDiffX - (seriesNr - 1.5f) * halfDiffX;
}
if (!isNullValue(series.getY(index + 1)) && points.size() > i + 3) {
// draw the maximum value
drawText(canvas, getLabel(renderer.getChartValuesFormat(), series.getY(index + 1)), x,
points.get(i + 3) - renderer.getChartValuesSpacing(), paint, 0);
}
if (!isNullValue(series.getY(index)) && points.size() > i + 1) {
// draw the minimum value
drawText(
canvas,
getLabel(renderer.getChartValuesFormat(), series.getY(index)),
x,
points.get(i + 1) + renderer.getChartValuesTextSize()
+ renderer.getChartValuesSpacing() - 3, paint, 0);
}
}
}
示例11: drawSeries
import org.achartengine.model.XYSeries; //导入依赖的package包/类
@Override
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList,
XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, Orientation or,
int startIndex) {
mCharts[seriesIndex].setScreenR(getScreenR());
mCharts[seriesIndex].setCalcRange(getCalcRange(mDataset.getSeriesAt(seriesIndex)
.getScaleNumber()), 0);
mCharts[seriesIndex].drawSeries(series, canvas, paint, pointsList, seriesRenderer, yAxisValue,
0, or, startIndex);
}
示例12: addXYSeries
import org.achartengine.model.XYSeries; //导入依赖的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.XYSeries; //导入依赖的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: init
import org.achartengine.model.XYSeries; //导入依赖的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);
}
示例15: init
import org.achartengine.model.XYSeries; //导入依赖的package包/类
/**
* Initialilze chart.
*/
private void init() {
mACCList = new ArrayList<>();
mACCList.add(new XYSeries(TITLES[0]));
mACCList.add(new XYSeries(TITLES[1]));
mACCList.add(new XYSeries(TITLES[2]));
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addAllSeries(mACCList);
this.mXYMultipleSeriesRenderer = buildRenderer();
mLineChart = new LineChart(dataset, mXYMultipleSeriesRenderer);
mGraphicalView = new GraphicalView(getActivity(), mLineChart);
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:16,代码来源:HitoeProfileDeviceOrientationFragment.java