本文整理汇总了Java中com.androidplot.xy.XYSeries类的典型用法代码示例。如果您正苦于以下问题:Java XYSeries类的具体用法?Java XYSeries怎么用?Java XYSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYSeries类属于com.androidplot.xy包,在下文中一共展示了XYSeries类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawSeries
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
@Override
protected void drawSeries(Canvas canvas, RectF plotArea, XYSeries series, LineAndPointFormatter formatter) {
Number x = null;
Number y = null;
if (series != null && series.size() > 0) {
y = series.getY(0);
x = series.getX(0);
}
if (x == null || y == null) {
return;
}
XYPlot p = getPlot();
PointF thisPoint = ValPixConverter.valToPix(x, y, plotArea,
p.getCalculatedMinX(), p.getCalculatedMaxX(), p.getCalculatedMinY(), p.getCalculatedMaxY());
prev = new Point(thisPoint);
point = next = null;
pointsCounter = series.size();
super.drawSeries(canvas, plotArea, series, formatter);
}
示例2: getFormatter
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
@Override
public MyBarFormatter getFormatter(int index, XYSeries series) {
if (devices[index].equals(YOUR_DEVICE)) {
return currentFormatter;
} else {
if (versions[index].contains("ocl")) {
return openclFormatter;
} if (versions[index].contains("cpp") || versions[index].contains("omp")) {
return cppFormatter;
} else {
return getFormatter(series);
}
}
}
示例3: updatePlot
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
/**
* Method changes which points and what color is rendered
*/
public void updatePlot() {
// Remove all current series from each plot
Iterator<XYSeries> iterator1 = audiogram.getSeriesSet().iterator();
while (iterator1.hasNext()) {
XYSeries setElement = iterator1.next();
audiogram.removeSeries(setElement);
}
drawBackground();
if (leftEarButton.isChecked()) {
// Create a formatter to use for drawing a series using
// LineAndPointRenderer
// and configure it from xml:
LineAndPointFormatter series1Format = new LineAndPointFormatter();
series1Format.setPointLabelFormatter(new PointLabelFormatter());
series1Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_plf1);
audiogram.clear();
series1 = (SimpleXYSeries) getSeries(); // call getSeries function
// add a new series' to the xyplot:
audiogram.addSeries(series1, series1Format);
audiogram.redraw(); // redraw series
}
else {
LineAndPointFormatter series2Format = new LineAndPointFormatter();
series2Format.setPointLabelFormatter(new PointLabelFormatter());
series2Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_plf2);
audiogram.clear();
series2 = (SimpleXYSeries) getSeries(); // call getSeries function
// add a new series' to the xyplot:
audiogram.addSeries(series2, series2Format);
audiogram.redraw();
}
}
示例4: cargarGrafico
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
public void cargarGrafico(XYPlot grafico, Number[] serie) {
XYSeries series1 = new SimpleXYSeries(Arrays.asList(serie),
SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, getResources()
.getString(R.string.notas));
LineAndPointFormatter series1Format = new LineAndPointFormatter(
Color.rgb(255, 255, 255), Color.rgb(0, 153, 204),
Color.alpha(0), null);
grafico.destroyDrawingCache();
grafico.setScrollContainer(false);
grafico.clear();
grafico.addSeries(series1, series1Format);
}
示例5: displayDataGraphic
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
private void displayDataGraphic(String dataGraphic){
//qui devo aggiornare il grafico
if(finitoBeatPassati){
try{
if(cominciaDa>60){
y++;
X = X + 1;
lista.remove(0);
lista.add(X);
Y = (double) Integer.parseInt(dataGraphic);
lista.remove(0);
lista.add(Y);
plot.setDomainBoundaries(0+y, 60+y, BoundaryMode.FIXED);
}
else{
X = X + 1;
lista.add(X);
Y = (double) Integer.parseInt(dataGraphic);
lista.add(Y);
}
//passo la lista
XYSeries series = new SimpleXYSeries(lista, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED,"segnale");
//colore linea grafico impostazioni
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(Color.rgb(0, 0, 0),0x000000, 0x000000, null);
plot.clear();
plot.addSeries(series, seriesFormat);
plot.redraw();
cominciaDa++;
}
catch (Exception e){
e.printStackTrace();
}
}
}
示例6: getView
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
@Override
public View getView(int pos, View convertView, ViewGroup parent) {
LayoutInflater inf = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = convertView;
if (v == null) {
v = inf.inflate(R.layout.loadtest_item, parent, false);
}
audiogram = (XYPlot) v.findViewById(R.id.xyplot);
Random generator = new Random();
graphSettings();
for (int i = 0; i < 2; i++) {
ArrayList<Number> nums = new ArrayList<Number>();
for (int j = 0; j < 100; j++) {
nums.add(generator.nextFloat());
}
double rl = Math.random();
double gl = Math.random();
double bl = Math.random();
double rp = Math.random();
double gp = Math.random();
double bp = Math.random();
XYSeries series = new SimpleXYSeries(nums,
SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Left Ear" + i);
audiogram.addSeries(
series,
new LineAndPointFormatter(Color.rgb(
new Double(rl * 255).intValue(), new Double(
gl * 255).intValue(), new Double(
bl * 255).intValue()), Color.rgb(
new Double(rp * 255).intValue(), new Double(
gp * 255).intValue(), new Double(
bp * 255).intValue()), null, null));
}
return v;
}
示例7: createLineAndPointFormatter
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
private LineAndPointFormatter createLineAndPointFormatter(int color,float width, boolean line) {
LineAndPointFormatter series1Format = new LineAndPointFormatter();
PointLabelFormatter pointLabelFormatter = new PointLabelFormatter();
series1Format.setPointLabeler(new PointLabeler() {
@Override
public String getLabel(XYSeries series, int index) {
return "";
}
});
series1Format.setPointLabelFormatter(pointLabelFormatter);
series1Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_plf1);
Paint lp = series1Format.getLinePaint();
lp.setColor(color);
lp.setAntiAlias(false);
lp.setStrokeWidth(width);
if(line) {
series1Format.setVertexPaint(null);
series1Format.setLinePaint(lp);
} else {
Paint linep = new Paint(lp);
linep.setStrokeWidth(1);
linep.setColor(color);
series1Format.setLinePaint(null);
series1Format.setVertexPaint(lp);
}
series1Format.setPointLabelFormatter(null);
return series1Format;
}
示例8: onCreate
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.graphic);
//mHandler = new Handler();
//mStarting = false;
final Intent intent = getIntent();
//totBeats = intent.getStringExtra("beats");
totBeats2 = (ArrayList<String>) intent.getSerializableExtra("beats");
mStarting = intent.getBooleanExtra("run", true);
finitoBeatPassati = false;
cominciaDa = (int) intent.getIntExtra("tempo", 0);
y = 0;//(int) intent.getIntExtra("tempo", 0);
if(totBeats2!=null){
getArrayListBeats(totBeats2);
}
//mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
//mActivities = (Activities) intent.getSerializableExtra("a");
// Start heartRate.
plot = (XYPlot) findViewById(R.id.graphic);
styleOn = true;
//distanza tra righe verticali
//plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 10);
//distanza tra righe orizzontali
plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 20);
//colore sfondo grafico
plot.getGraphWidget().getGridBackgroundPaint().setShader(WHITE_SHADER);
//colore line verticali
plot.getGraphWidget().getDomainGridLinePaint().setColor(Color.rgb(255, 255, 255));
//colore linee orizzontali
plot.getGraphWidget().getRangeGridLinePaint().setColor(Color.rgb(0, 0, 0));
plot.getGraphWidget().getRangeGridLinePaint().setPathEffect(new DashPathEffect(new float[]{3, 3}, 1));
//valori numerici della y
plot.setRangeBoundaries(30, 210, BoundaryMode.FIXED);
//valori numerici della x
if(cominciaDa<60){
plot.setDomainBoundaries(0, 60, BoundaryMode.FIXED);
}
else{
plot.setDomainBoundaries(cominciaDa-60, cominciaDa, BoundaryMode.FIXED);
}
// scala dei numeri del grafico in decimale
plot.setRangeValueFormat(new DecimalFormat("0"));
plot.setDomainValueFormat(new DecimalFormat("0"));
//linee verticali
plot.setDomainStep(XYStepMode.SUBDIVIDE, 7);
//plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 30);
// plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 60);
// qui c'era il for di riempimento lista
//passo la lista
XYSeries series = new SimpleXYSeries(lista, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED,"Segnale");
//colore linea grafico impostazioni
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(Color.rgb(0, 0, 0),0x000000, 0x000000, null);
plot.clear();
plot.addSeries(series, seriesFormat);
}
示例9: onCreate
import com.androidplot.xy.XYSeries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.stats_journeys_month);
SharedPreferences settings = getSharedPreferences(
UserPrefsActivity.APP_PREFS, MODE_PRIVATE);
mySimpleXYPlot = (XYPlot) findViewById(R.id.xy_JourneysMonth);
Integer[] series1Integers = new Integer[] { null, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0 };
ArrayList<Number> series1Numbers = new ArrayList<Number>();
int i = 0;
Journey db_journeys = new Journey(this);
db_journeys.open();
Cursor c;
if (settings.getBoolean("AlwaysUseStats", false) == true) {
c = db_journeys.getAllPastYearJourneys();
} else {
c = db_journeys.getAllPastYearStatsJourneys();
}
if (c.moveToFirst()) {
do {
i = i + 1;
series1Integers[c.getInt(3)] = series1Integers[c.getInt(3)] + 1;
} while (c.moveToNext());
}
db_journeys.close();
for (int j = 1; j <= 12; j++) {
series1Numbers.add(series1Integers[j]);
}
XYSeries series1 = new SimpleXYSeries(series1Numbers,
SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "");
LineAndPointFormatter series1Format = new LineAndPointFormatter(
Color.rgb(0, 200, 0), // line color
Color.rgb(0, 100, 0), // point color
Color.rgb(0, 200, 0), // fill color
null); // PointLabelFormatter
BarFormatter series1BarFormat = new BarFormatter(Color.rgb(0, 200, 0),
Color.rgb(0, 100, 0));
mySimpleXYPlot.addSeries(series1, series1BarFormat);
mySimpleXYPlot.getLegendWidget().setVisible(false);
mySimpleXYPlot.setRangeLabel("");
mySimpleXYPlot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 2);
mySimpleXYPlot.setRangeValueFormat(new DecimalFormat("#"));
mySimpleXYPlot.setDomainLabel("");
mySimpleXYPlot.setDomainStep(XYStepMode.SUBDIVIDE, 12);
final String[] months = getResources().getStringArray(
R.array.stats_journeys_month_months);
mySimpleXYPlot.setDomainValueFormat(new Format() {
@Override
public StringBuffer format(Object object, StringBuffer buffer,
FieldPosition field) {
int pos = (int) Math.round((Double) object);
StringBuffer result = new StringBuffer(months[pos]);
return result;
}
@Override
public Object parseObject(String string, ParsePosition position) {
return null;
}
});
mySimpleXYPlot.setTitle(getApplicationContext().getString(
R.string.stats_jouneys_month));
}