本文整理汇总了Java中com.androidplot.xy.BoundaryMode类的典型用法代码示例。如果您正苦于以下问题:Java BoundaryMode类的具体用法?Java BoundaryMode怎么用?Java BoundaryMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoundaryMode类属于com.androidplot.xy包,在下文中一共展示了BoundaryMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustRangeBoundaries
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
private void adjustRangeBoundaries() {
double delta = mRangeValueMax - mRangeValueMin;
int roundTo = 5;
if (delta < 1) {
roundTo = 1;
} else if (delta < 2) {
roundTo = 2;
}
int minValueRounded = roundDown(mRangeValueMin, roundTo);
int maxValueRounded = roundUp(mRangeValueMax, roundTo);
mViewPlot.setRangeLowerBoundary(minValueRounded, BoundaryMode.FIXED);
mViewPlot.setRangeUpperBoundary(maxValueRounded, BoundaryMode.FIXED);
}
示例2: adjustDomainBoundaries
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
/**
* Updates the domain boundary.
*
* @param lastBoundary that it's going to be put in the
*/
private void adjustDomainBoundaries(long lastBoundary) {
if (lastBoundary < System.currentTimeMillis() - THRESHOLD_TIME_REPRESENTATION_MS) {
lastBoundary = System.currentTimeMillis();
}
final long firstBoundary = lastBoundary - mLastInterval.getNumberMilliseconds();
Log.d(TAG,
String.format(
"%s -> Domain boundaries has been updated from %d to %d.",
"adjustDomainBoundaries()",
firstBoundary,
lastBoundary
)
);
mViewPlot.setDomainBoundaries(firstBoundary, lastBoundary, BoundaryMode.FIXED);
}
示例3: setData
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
public void setData(List<StationMeasurements> measurementsList) {
manager.reset();
manager.setData(measurementsList);
graph.setRangeBoundaries(null, null, BoundaryMode.AUTO);
graph.setDomainBoundaries(null, null, BoundaryMode.AUTO);
graph.calculateMinMaxVals();
graphMinXY = new PointF(
graph.getCalculatedMinX().floatValue(),
graph.getCalculatedMinY().floatValue());
graphMaxXY = new PointF(
graph.getCalculatedMaxX().floatValue(),
graph.getCalculatedMaxY().floatValue());
zoomMinXY = new PointF(graphMinXY.x, graphMinXY.y);
zoomMaxXY = new PointF(graphMaxXY.x, graphMaxXY.y);
graph.setRangeBoundaries(graphMinXY.y, graphMaxXY.y, BoundaryMode.FIXED);
graph.redraw();
}
示例4: initPlot
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
private void initPlot() {
mXHistorySeries = new SimpleXYSeries( "X" );
mXHistorySeries.useImplicitXVals();
mYHistorySeries = new SimpleXYSeries( "Y" );
mYHistorySeries.useImplicitXVals();
mZHistorySeries = new SimpleXYSeries( "Z" );
mZHistorySeries.useImplicitXVals();
mHistoryPlot.setRangeBoundaries( -20, 20, BoundaryMode.AUTO );
mHistoryPlot.setDomainBoundaries( 0, HISTORY_SIZE, BoundaryMode.FIXED );
// int x_plotColor = getResources().getColor( R.color.plot_x, null );
// int y_plotColor = getResources().getColor( R.color.plot_y, null );
// int z_plotColor = getResources().getColor( R.color.plot_z, null );
// mHistoryPlot.addSeries( mXHistorySeries, new LineAndPointFormatter( x_plotColor, null, null, null ) );
// mHistoryPlot.addSeries( mYHistorySeries, new LineAndPointFormatter( y_plotColor, null, null, null ) );
// mHistoryPlot.addSeries( mZHistorySeries, new LineAndPointFormatter( z_plotColor, null, null, null ) );
float lineWidth = mPrefs.getFloatPreference( "plotLineWidth", R.string.settings_default_plot_line_width );
mHistoryPlot.addSeries( mXHistorySeries, getLineAndPointFormatter( lineWidth, Color.RED ) );
mHistoryPlot.addSeries( mYHistorySeries, getLineAndPointFormatter( lineWidth, Color.GREEN ) );
mHistoryPlot.addSeries( mZHistorySeries, getLineAndPointFormatter( lineWidth, Color.BLUE ) );
mHistoryPlot.setRangeValueFormat( new DecimalFormat( "#" ) );
redrawer = new Redrawer( mHistoryPlot, 40, false );
}
示例5: refreshSeries
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
private void refreshSeries()
{
for(int i = 0; i < pc.domainValueNames.length; i++) {
plot.removeSeries(series[i]);
}
// New zoom
double zoomStart = (((double) minXY.x) + 1388534400000d);
double zoomEnd = (((double) maxXY.x) + 1388534400000d);
// DatabaseHelper.streamData(pc.tableName, "SELECT " + values + " FROM " + pc.tableName, start, "" + zoomStart, timeData, valueData, 150);
// DatabaseHelper.streamData(pc.tableName, "SELECT " + values + " FROM " + pc.tableName, "" + zoomStart, "" + zoomEnd, timeData, valueData, 400);
// DatabaseHelper.streamData(pc.tableName, "SELECT " + values + " FROM " + pc.tableName, "" + zoomEnd, end, timeData, valueData, 150);
for(int i = 0; i < pc.domainValueNames.length; i++) {
series[i] = new SimpleXYSeries(valueData.get("attr_time"), valueData.get(pc.domainValueNames[i]), pc.domainValueNames[i].replace("attr_", ""));
plot.addSeries(series[i], new LineAndPointFormatter(SensorDataUtil.getColor(i), Color.BLACK, null, null));
}
plot.calculateMinMaxVals();
if(plot.getCalculatedMaxY().doubleValue() > maxY || plot.getCalculatedMinY().doubleValue() < minY) {
maxY = (plot.getCalculatedMaxY().doubleValue() > maxY) ? plot.getCalculatedMaxY().doubleValue() + 1 : maxY;
minY = (plot.getCalculatedMinY().doubleValue() < minY) ? plot.getCalculatedMinY().doubleValue() - 1 : minY;
plot.setRangeBoundaries(minY, maxY, BoundaryMode.FIXED);
plot.setDomainBoundaries(minXY.x, maxXY.x, BoundaryMode.FIXED);
}
plot.redraw();
}
示例6: restoreState
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
public void restoreState(Bundle state) {
manager.restoreVisibleSeries(state);
zoomMinXY = restorePoint(state, STATE_ZOOM_MIN);
zoomMaxXY = restorePoint(state, STATE_ZOOM_MAX);
graph.setDomainBoundaries(zoomMinXY.x, zoomMaxXY.x, BoundaryMode.FIXED);
updateGraph();
}
示例7: run
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
@Override
public void run() {
do {
if (stopped) return;
pan *= 0.97;
scroll(pan);
graph.setDomainBoundaries(zoomMinXY.x, zoomMaxXY.x, BoundaryMode.FIXED);
graph.redraw();
try {
Thread.sleep(REFRESH_RATE);
} catch (InterruptedException ie) {
Timber.d("Smooth scroll thread was interrupted");
}
} while (Math.abs(pan) > 0.3);
}
示例8: setupDomainWidget
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
private void setupDomainWidget() {
// Set up the domain label text, color, size, position, boundaries and step
plot.setDomainLabel(getString(R.string.label_domain));
plot.getDomainLabelWidget().getLabelPaint().setColor(getResources().getColor(R.color.opensignals_text_field));
plot.getDomainLabelWidget().getLabelPaint().setTextSize(40.0f);
plot.getDomainLabelWidget().setWidth(1.0f, SizeLayoutType.RELATIVE);
plot.getDomainLabelWidget().getPositionMetrics().getXPositionMetric().set(0, XLayoutStyle.RELATIVE_TO_LEFT);
plot.getDomainLabelWidget().setClippingEnabled(false);
plot.setDomainBoundaries(0, 5000, BoundaryMode.FIXED);
plot.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL);
plot.setDomainStepValue(10);
plot.getGraphWidget().setDomainLabelPaint(null);
plot.getGraphWidget().setDomainOriginLabelPaint(null);
}
示例9: displayDataGraphic
import com.androidplot.xy.BoundaryMode; //导入依赖的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();
}
}
}
示例10: initPlot
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
/**
* Create the plot.
*/
private void initPlot()
{
this.dynamicPlot.setRangeBoundaries(minRange, maxRange,
BoundaryMode.FIXED);
this.dynamicPlot.setDomainBoundaries(0, windowSize, BoundaryMode.FIXED);
this.dynamicPlot.setDomainStepValue(5);
this.dynamicPlot.setTicksPerRangeLabel(3);
this.dynamicPlot.setDomainLabel("Update #");
this.dynamicPlot.getDomainLabelWidget().pack();
this.dynamicPlot.setRangeLabel("G's/Sec");
this.dynamicPlot.getRangeLabelWidget().pack();
this.dynamicPlot.getLegendWidget().setWidth(0.7f);
this.dynamicPlot.setGridPadding(15, 15, 15, 15);
this.dynamicPlot.getGraphWidget().setGridBackgroundPaint(null);
this.dynamicPlot.getGraphWidget().setBackgroundPaint(null);
this.dynamicPlot.getGraphWidget().setBorderPaint(null);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setColor(Color.rgb(119, 119, 119));
paint.setStrokeWidth(2);
this.dynamicPlot.getGraphWidget().setDomainOriginLinePaint(paint);
this.dynamicPlot.getGraphWidget().setRangeOriginLinePaint(paint);
this.dynamicPlot.setBorderPaint(null);
this.dynamicPlot.setBackgroundPaint(null);
this.dynamicPlot.redraw();
}
示例11: adjustYBoundaries
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
private void adjustYBoundaries() {
//default positioning puts the origin on the bottom, we want it on the center
double min = minY;
double max = maxY;
adjustToFixedLine(fixedLines);
dynamicPlot.setRangeBoundaries(min, max, BoundaryMode.FIXED);
}
示例12: initGraph
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
protected void initGraph(final boolean isEmpty) {
int greyColor = getAppResouces().getColor(android.R.color.secondary_text_light_nodisable);
xyPlot.getGraphWidget().getDomainGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeSubGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainSubGridLinePaint().setColor(greyColor);
xyPlot.getBackgroundPaint().setColor(Color.WHITE);
xyPlot.setPlotMargins(0, 0, 0, 0);
xyPlot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getCursorLabelBackgroundPaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getRangeOriginLabelPaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainOriginLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeOriginLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainLabelPaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeLabelPaint().setColor(greyColor);
xyPlot.getDomainLabelWidget().getLabelPaint().setColor(greyColor);
xyPlot.getRangeLabelWidget().getLabelPaint().setColor(greyColor);
xyPlot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_CENTER,
0, YLayoutStyle.RELATIVE_TO_BOTTOM, AnchorPosition.BOTTOM_MIDDLE);
xyPlot.getTitleWidget().getLabelPaint().setColor(Color.TRANSPARENT);
xyPlot.getTitleWidget().setVisible(false);
xyPlot.getLegendWidget().setVisible(false);
float domainLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelWidth);
float rangeLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelWidth);
float rangeLabelVerticalOffset = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelVerticalOffset);
float domainLabelMarginLeft = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginLeft);
float domainLabelMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginRight);
float rangeLabelMargin = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelMargin);
float gridPaddingMargin = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMargin);
float gridPaddingMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMarginRight);
xyPlot.getDomainLabelWidget().setMargins(domainLabelMarginLeft, 0, domainLabelMarginRight, 0);
xyPlot.getRangeLabelWidget().setMargins(rangeLabelMargin, 0, rangeLabelMargin, 0);
xyPlot.getGraphWidget().setGridPadding(gridPaddingMargin, gridPaddingMargin, gridPaddingMarginRight, gridPaddingMargin);
xyPlot.getGraphWidget().setDomainLabelWidth(domainLabelWidth);
xyPlot.getGraphWidget().setRangeLabelWidth(rangeLabelWidth);
xyPlot.getGraphWidget().setDomainLabelHorizontalOffset(0);
xyPlot.getGraphWidget().setRangeLabelVerticalOffset(rangeLabelVerticalOffset);
xyPlot.getDomainLabelWidget().pack();
xyPlot.getRangeLabelWidget().pack();
final String secStr = getContext().getString(R.string.seconds);
final DecimalFormat domainFmt = new DecimalFormat("#.#");
xyPlot.setDomainValueFormat(new NumberFormat() {
@Override
public StringBuffer format(double d, StringBuffer sb, FieldPosition fp) {
return sb.append(domainFmt.format(d / 50f)).append(secStr);
}
@Override
public StringBuffer format(long l, StringBuffer stringBuffer, FieldPosition fieldPosition) {
return null;
}
@Override
public Number parse(String s, ParsePosition parsePosition) {
return null;
}
});
xyPlot.setRangeValueFormat(new DecimalFormat("#.#G"));
xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
xyPlot.setDomainStepValue(2);
xyPlot.setRangeStepValue(11);
xyPlot.setRangeBoundaries(-0.5f, 0.5f, BoundaryMode.FIXED);
DashPathEffect dashFx = new DashPathEffect(new float[] {PixelUtils.dpToPix(3), PixelUtils.dpToPix(3)}, 0);
xyPlot.getGraphWidget().getDomainGridLinePaint().setPathEffect(dashFx);
xyPlot.getGraphWidget().getRangeGridLinePaint().setPathEffect(dashFx);
setGraphData(null);
}
示例13: onCreate
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_serial_console);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mTitleTextView = (TextView) findViewById(R.id.demoTitle);
mDumpTextView = (TextView) findViewById(R.id.consoleText);
mScrollView = (ScrollView) findViewById(R.id.demoScroller);
// Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// setSupportActionBar(toolbar);
plot = (XYPlot) findViewById(R.id.plot);
plot.setRangeBoundaries(1,1, BoundaryMode.AUTO);
// create a couple arrays of y-values to plot:
// Number[] series1Numbers = {1, 4, 2, 8, 4, 16, 8, 32, 16, 64};
// turn the above arrays into XYSeries':
// (Y_VALS_ONLY means use the element index as the x value)
// series1 = new SimpleXYSeries(Arrays.asList(series1Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Nesto1");
series1 = new SimpleXYSeries("Values");
series1.useImplicitXVals();
// create formatters to use for drawing a series using LineAndPointRenderer
// and configure them from xml:
LineAndPointFormatter series1Format = new LineAndPointFormatter();
series1Format.setPointLabelFormatter(new PointLabelFormatter());
series1Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_labels);
LineAndPointFormatter series2Format = new LineAndPointFormatter();
series2Format.setPointLabelFormatter(new PointLabelFormatter());
series2Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_labels_2);
// see: http://androidplot.com/smooth-curves-and-androidplot/
series1Format.setInterpolationParams(
new CatmullRomInterpolator.Params(10, CatmullRomInterpolator.Type.Centripetal));
// add a new series' to the xyplot:
plot.addSeries(series1, series1Format);
// reduce the number of range labels
plot.setTicksPerRangeLabel(3);
// rotate domain labels 45 degrees to make them more compact horizontally:
plot.getGraphWidget().setDomainLabelOrientation(-45);
if (savedInstanceState != null) {
savedInstanceState.getSerializable("sport");
savedInstanceState.getBoolean("chDetect");
}
}
示例14: dibujarGrafica
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void dibujarGrafica(Calibrado cal){
ArrayList<String> listaCons=cal.getPuntosCal();
Number[] rgb=new Number[cal.getNumeroPuntos()];
Number[] concentracion=new Number[cal.getNumeroPuntos()];
for(int i=0; i<listaCons.size();i++){
String[] dos=listaCons.get(i).split(";");
rgb[i]=Double.parseDouble(dos[0]);
concentracion[i]=Double.parseDouble(dos[1]);
}
XYSeries series1 = new SimpleXYSeries(
Arrays.asList(concentracion), // Array de datos
Arrays.asList(rgb), // Sólo valores verticales-- otro array
""); // Nombre de la primera serie
LineAndPointFormatter series1Format = new LineAndPointFormatter(
null, // Color de la línea si pones null no hay linea
Color.rgb(0, 100, 0), // Color del punto
null); // Relleno
// Una vez definida la serie (datos y estilo), la añadimos al panel
mySimpleXYPlot.addSeries(series1, series1Format);
Number[] lineaX={0, 500};
Number[] lineaY={cal.getOrdenadaOrigen(), m.calcularRGBaPartirdeConcentracion(500, cal)};
XYSeries series2 = new SimpleXYSeries(Arrays.asList(lineaX), Arrays.asList(lineaY), "");
mySimpleXYPlot.addSeries(series2, new LineAndPointFormatter(Color.rgb(0, 0, 100), null, null));
mySimpleXYPlot.setDomainLabel("[Furfural] (µg/L)");
mySimpleXYPlot.setRangeLabel("RGB");
mySimpleXYPlot.setTitle("");
mySimpleXYPlot.setTicksPerRangeLabel(1);
mySimpleXYPlot.setTicksPerDomainLabel(1);
mySimpleXYPlot.setDomainValueFormat(new DecimalFormat("0"));
mySimpleXYPlot.setRangeValueFormat(new DecimalFormat("0.00"));
mySimpleXYPlot.setDomainBoundaries(0, 600, BoundaryMode.FIXED);
mySimpleXYPlot.setDomainStep(XYStepMode.SUBDIVIDE, 7);
mySimpleXYPlot.getLegendWidget().setSize(new SizeMetrics(0, SizeLayoutType.ABSOLUTE, 0, SizeLayoutType.ABSOLUTE));
mySimpleXYPlot.setPlotPadding(10, 10, 10, 10);
mySimpleXYPlot.setDomainLabelWidget(null);
}
示例15: start
import com.androidplot.xy.BoundaryMode; //导入依赖的package包/类
public void start()
{
series = new SimpleXYSeries[pc.domainValueNames.length];
MainActivity main = (MainActivity) ActivityController.getInstance().get("MainActivity");
main.refreshGraphBuilderProgressBar(R.string.analyze_analyzelive_loading2, 5);
String tableName = SQLTableName.PREFIX + pc.deviceID + pc.tableName;
DatabaseHelper.streamData(tableName, pc.domainValueNames, start, end, valueData);
main.refreshGraphBuilderProgressBar(R.string.analyze_analyzelive_loading4, 20);
for(int i = 0; i < pc.domainValueNames.length; i++) {
series[i] = new SimpleXYSeries(valueData.get("attr_time"), valueData.get(pc.domainValueNames[i]), pc.domainValueNames[i].replace("attr_", ""));
plot.addSeries(series[i], new LineAndPointFormatter(SensorDataUtil.getColor(i), Color.BLACK, null, null));
}
plot.calculateMinMaxVals();
minXY = new PointF(plot.getCalculatedMinX().floatValue(), plot.getCalculatedMinY().floatValue());
maxXY = new PointF(plot.getCalculatedMaxX().floatValue(), plot.getCalculatedMaxY().floatValue());
maxY = plot.getCalculatedMaxY().doubleValue() + 1;
minY = plot.getCalculatedMinY().doubleValue() - 1;
plot.setRangeBoundaries(minY, maxY, BoundaryMode.FIXED);
plot.setDomainBoundaries(minXY.x, maxXY.x, BoundaryMode.FIXED);
main.refreshGraphBuilderProgressBar(R.string.analyze_analyzelive_loading5, 80);
plot.redraw();
}