com.androidplot.xy.XYPlot Java Examples
The following examples show how to use
com.androidplot.xy.XYPlot.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccelerationAlertActivity.java From AccelerationAlert with Apache License 2.0 | 6 votes |
/** * Initialize the plots. */ private void initPlots() { View view = findViewById(R.id.ScrollView01); view.setOnTouchListener(this); // Create the graph plot XYPlot plot = (XYPlot) findViewById(R.id.plot_sensor); plot.setTitle("Acceleration"); dynamicPlot = new DynamicPlot(plot); dynamicPlot.setMaxRange(1); dynamicPlot.setMinRange(0); // Add our magnitude plot. addLPFMagnitudePlot(); }
Example #2
Source File: PowerPlotFragment.java From GNSS_Compare with Apache License 2.0 | 5 votes |
protected void formatSeries(XYPlot plot, XYSeriesFormatter formatter) { BarRenderer barRenderer = plot.getRenderer(PowerBarRenderer.class); barRenderer.setBarGroupWidth(BarRenderer.BarGroupWidthMode.FIXED_WIDTH, PixelUtils.dpToPix(15)); barRenderer.setBarOrientation(BarRenderer.BarOrientation.SIDE_BY_SIDE); ((BarFormatter) formatter).setMarginLeft(PixelUtils.dpToPix(1)); ((BarFormatter) formatter).setMarginRight(PixelUtils.dpToPix(1)); }
Example #3
Source File: DataPlotZoomListener.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
public DataPlotZoomListener(XYPlot plot, PlotConfiguration pc, String start, String end) { this.plot = plot; this.pc = pc; this.start = start; this.end = end; this.valueData = new HashMap<>(); }
Example #4
Source File: DynamicPlot.java From AccelerationAlert with Apache License 2.0 | 5 votes |
/** * Initialize a new Acceleration View object. * * @param activity * the Activity that owns this View. */ public DynamicPlot(XYPlot dynamicPlot) { this.dynamicPlot = dynamicPlot; series = new SparseArray<SimpleXYSeries>(); history = new SparseArray<LinkedList<Number>>(); initPlot(); }
Example #5
Source File: PowerPlotFragment.java From GNSS_Compare with Apache License 2.0 | 4 votes |
@Override public SeriesRenderer doGetRendererInstance(XYPlot plot) { return new PowerBarRenderer(plot); }
Example #6
Source File: PowerPlotFragment.java From GNSS_Compare with Apache License 2.0 | 4 votes |
public PowerBarRenderer(XYPlot plot) { super(plot); }
Example #7
Source File: CustomPointFormatter.java From sensordatacollector with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings ("rawtypes") @Override public SeriesRenderer getRendererInstance(XYPlot plot) { return new CustomPointRenderer(plot); }
Example #8
Source File: CustomPointRenderer.java From sensordatacollector with GNU General Public License v2.0 | 4 votes |
public CustomPointRenderer(XYPlot plot) { super(plot); }
Example #9
Source File: Plotter.java From sensordatacollector with GNU General Public License v2.0 | 4 votes |
public void startPlotting(XYPlot levelXYPlot, XYPlot historyXYPlot) { levelPlot.plot = levelXYPlot; historyPlot.plot = historyXYPlot; levelsValues = new SimpleXYSeries(levelPlot.SeriesName); levelsValues.useImplicitXVals(); levelPlot.plot.addSeries(levelsValues, new BarFormatter(Color.argb(180, 0, 200, 0), Color.rgb(0, 100, 0))); levelPlot.plot.addSeries(new SimpleXYSeries(Arrays.asList(-10, 0, 10, 0), SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED, "0"), new LineAndPointFormatter(Color.argb(140, 200, 80, 80), Color.BLACK, null, null)); levelPlot.plot.setTitle(levelPlot.plotName); levelPlot.plot.setDomainStepValue(levelPlot.domainValueNames.length); levelPlot.plot.setTicksPerRangeLabel(3); // per the android documentation, the minimum and maximum readings we can get from // any of the orientation sensors is -180 and 359 respectively so we will fix our plot's // boundaries to those values. If we did not do this, the plot would auto-range which // can be visually confusing in the case of dynamic plots. levelPlot.plot.setRangeBoundaries(levelPlot.rangeMin, levelPlot.rangeMax, levelPlot.rangeBoundary); levelPlot.plot.setDomainBoundaries(0, levelPlot.domainValueNames.length - 1, BoundaryMode.FIXED); // use our custom domain value formatter: levelPlot.plot.setDomainValueFormat(new BarPlotFormat(levelPlot.domainValueNames)); // update our domain and range axis labels: levelPlot.plot.setDomainLabel(levelPlot.domainName); levelPlot.plot.getDomainLabelWidget().pack(); levelPlot.plot.setRangeLabel(levelPlot.rangeName); levelPlot.plot.getRangeLabelWidget().pack(); levelPlot.plot.setGridPadding(15, 0, 15, 0); // History Plot historyPlot.plot.setTitle(historyPlot.plotName); historyPlot.plot.setDomainStepValue(5); historyPlot.plot.setTicksPerRangeLabel(3); historyValues = new SimpleXYSeries[historyPlot.seriesValueNames.length]; int Colors[] = new int[6]; Colors[0] = Color.rgb(100, 100, 250); Colors[1] = Color.rgb(250, 100, 100); Colors[2] = Color.rgb(100, 250, 100); Colors[3] = Color.rgb(250, 100, 250); Colors[4] = Color.rgb(250, 250, 100); Colors[5] = Color.rgb(100, 250, 250); for(int i = 0; i < historyPlot.seriesValueNames.length; i++) { historyValues[i] = new SimpleXYSeries(historyPlot.seriesValueNames[i].replace("attr_", "")); historyValues[i].useImplicitXVals(); if(i > 5) { historyPlot.plot.addSeries(historyValues[i], new LineAndPointFormatter(Color.rgb(100, 100, 200), Color.BLACK, null, null)); } else { historyPlot.plot.addSeries(historyValues[i], new LineAndPointFormatter(Colors[i], Color.BLACK, null, null)); } } historyPlot.plot.setRangeBoundaries(historyPlot.rangeMin, historyPlot.rangeMax, historyPlot.rangeBoundary); historyPlot.plot.setDomainBoundaries(historyPlot.domainMin, historyPlot.domainMax, historyPlot.domainBoundary); historyPlot.plot.setDomainStepValue(5); historyPlot.plot.setTicksPerRangeLabel(3); historyPlot.plot.setDomainLabel(historyPlot.domainName); historyPlot.plot.getDomainLabelWidget().pack(); historyPlot.plot.setRangeLabel(historyPlot.rangeName); historyPlot.plot.getRangeLabelWidget().pack(); // get a ref to the BarRenderer so we can make some changes to it: @SuppressWarnings( "rawtypes" ) BarRenderer barRenderer = (BarRenderer) levelPlot.plot.getRenderer(BarRenderer.class); if(barRenderer != null) { // make our bars a little thicker than the default so they can be seen better: // barRenderer.setBarWidth(300); barRenderer.setBarWidthStyle(BarRenderer.BarWidthStyle.VARIABLE_WIDTH); barRenderer.setBarGap(20); } }