当前位置: 首页>>代码示例>>Java>>正文


Java SimpleXYSeries类代码示例

本文整理汇总了Java中com.androidplot.xy.SimpleXYSeries的典型用法代码示例。如果您正苦于以下问题:Java SimpleXYSeries类的具体用法?Java SimpleXYSeries怎么用?Java SimpleXYSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleXYSeries类属于com.androidplot.xy包,在下文中一共展示了SimpleXYSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setGraphData

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
protected void setGraphData(List<Double> data) {
    if (!isAdded()) {
        return;
    }
    xyPlot.clear();
    int blueGraph = getAppResouces().getColor(R.color.blue_about);
    SplineLineAndPointFormatter formatter = new SplineLineAndPointFormatter(blueGraph, Color.TRANSPARENT, null);
    formatter.getLinePaint().setStrokeJoin(Paint.Join.ROUND);
    formatter.getLinePaint().setStrokeWidth(4);
    formatter.getLinePaint().setAntiAlias(true);
    if (data != null) {
        series.setModel(data, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);
    } else {
        series.setModel(new ArrayList<Number>(), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);
    }
    xyPlot.addSeries(series, formatter);
    xyPlot.calculateMinMaxVals();
    xyPlot.redraw();
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:20,代码来源:StartMeasurementFragment.java

示例2: updatePlot

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
private void updatePlot() {
    boolean validSeriesFound = false;
    long biggestTimestampSeries = 0;
    for (final SimpleXYSeries deviceSeries : mDeviceSeries) {
        checkSeriesRange(deviceSeries);
        final long biggestSeriesTimestamp = obtainBiggestTimestampSeries(deviceSeries);
        if (biggestSeriesTimestamp > biggestTimestampSeries) {
            biggestTimestampSeries = biggestSeriesTimestamp;
        }
        final LineAndPointFormatter deviceFormatter = getDeviceFormatterFromSeries(deviceSeries);

        List<SimpleXYSeries> deviceSeriesNoGaps = handleGapsForSeries(deviceSeries);
        for (final SimpleXYSeries series : deviceSeriesNoGaps) {
            mViewPlot.addSeries(prepareSeriesToShow(series), deviceFormatter);
        }

        validSeriesFound = true;
    }
    adjustGraphFormat(biggestTimestampSeries, validSeriesFound);
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:21,代码来源:PlotHandler.java

示例3: onIntervalTabSelected

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * This method is called when a interval tab is pressed by the user.
 *
 * @param position of the tab pressed by the user.
 */
private void onIntervalTabSelected(final int position) {

    if (mHistoryDeviceAdapter == null) {
        Log.e(TAG, "onIntervalTabSelected -> mHistoryDeviceAdapter can't be null.");
        return;
    }
    if (mPlotHandler == null) {
        Log.e(TAG, "onIntervalTabSelected -> mPlotHandler can't be null.");
        return;
    }

    mLastIntervalPosition = position;

    mIntervalSelected = HistoryIntervalType.getInterval(position);

    updateDeviceView();

    final List<String> selectedItems = mHistoryDeviceAdapter.getListOfSelectedItems();
    final List<SimpleXYSeries> plotSeries = obtainPlotSeries(selectedItems);
    mPlotHandler.updateSeries(getContext(), plotSeries, mIntervalSelected, mUnitTypeSelected);
    refreshIntervalTabs();
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:28,代码来源:HistoryFragment.java

示例4: onTypeOfValueTabSelected

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * This method is called when a value type tab is pressed by the user.
 *
 * @param position of the tab pressed by the user.
 */
private void onTypeOfValueTabSelected(final int position) {

    if (mHistoryDeviceAdapter == null) {
        Log.e(TAG, "onTypeOfValueTabSelected -> mHistoryDeviceAdapter can't be null.");
        return;
    }
    if (mPlotHandler == null) {
        Log.e(TAG, "onTypeOfValueTabSelected -> mPlotHandler can't be null.");
        return;
    }

    mLastUnitPosition = position;

    mUnitTypeSelected = HistoryUnitType.getUnitType(position);

    final List<String> selectedItems = mHistoryDeviceAdapter.getListOfSelectedItems();
    final List<SimpleXYSeries> plotSeries = obtainPlotSeries(selectedItems);
    mPlotHandler.updateSeries(getContext(), plotSeries, mIntervalSelected, mUnitTypeSelected);
    refreshTypeValueTabs();
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:26,代码来源:HistoryFragment.java

示例5: obtainPlotSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * Obtain the list of series from the database.
 *
 * @param deviceAddressList with the devices that will be used in order to display data.
 * @return {@link java.util.List} with the {@link com.androidplot.xy.SimpleXYSeries} that will be displayed in the graph.
 */
@NonNull
private List<SimpleXYSeries> obtainPlotSeries(@NonNull final List<String> deviceAddressList) {

    final HistoryDatabaseManager historyDb = HistoryDatabaseManager.getInstance();
    final HistoryResult databaseResults =
            historyDb.getHistoryPoints(mIntervalSelected, deviceAddressList);

    final List<SimpleXYSeries> listOfDataPoints = new LinkedList<>();

    if (databaseResults == null) {
        return listOfDataPoints;
    }
    for (final String deviceAddress : databaseResults.getResults().keySet()) {
        final List<RHTDataPoint> deviceDataPoints = databaseResults.getResults().get(deviceAddress);
        if (deviceDataPoints.isEmpty()) {
            continue;
        }
        final SimpleXYSeries newSeries = obtainGraphSeriesFromDataPointList(deviceAddress, deviceDataPoints);
        listOfDataPoints.add(newSeries);
    }
    return listOfDataPoints;
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:29,代码来源:HistoryFragment.java

示例6: obtainGraphSeriesFromDataPointList

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * Obtains a SimpleXYSeries from a datapoint list.
 *
 * @param dataPoints that haves to be converted into a graph series.
 * @return {@link com.androidplot.xy.SimpleXYSeries} with the device data.
 */
@NonNull
private SimpleXYSeries obtainGraphSeriesFromDataPointList(@NonNull final String deviceAddress,
                                                          @NonNull final List<RHTDataPoint> dataPoints) {
    if (dataPoints.isEmpty()) {
        throw new IllegalArgumentException(
                String.format(
                        "%s: %s -> In order to obtain data from a list it cannot be empty.",
                        "obtainGraphSeriesFromDataPointList",
                        TAG
                )
        );
    }
    sortDataPointListByTimestamp(dataPoints);
    final SimpleXYSeries deviceSeries = new SimpleXYSeries(deviceAddress);
    for (final RHTDataPoint dataPoint : dataPoints) {
        final Float value = getRequiredValueFromDatapoint(dataPoint);
        deviceSeries.addFirst(dataPoint.getTimestamp(), value);
    }
    return deviceSeries;
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:27,代码来源:HistoryFragment.java

示例7: createCurrentTimeSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
private void createCurrentTimeSeries(){
    // If the current time should be drawn...
    if(prefs.getBoolean("show_graph_time", true)){
        // If current day, get current time and paint red vertical line on graph
        if(day.isToday()){
            Double currentTime = day.getCurrentTimeHours();
            Double[] xValues = {currentTime,currentTime};
            Double[] yValues = {0.0, 20.0};
            timeSeries = new SimpleXYSeries(
                    Arrays.asList(xValues),
                    Arrays.asList(yValues),
                    "Time");

            LineAndPointFormatter timeFormat = new LineAndPointFormatter(
                    Color.rgb(200, 0, 0),   // line color
                    null,                   // point color
                    Color.rgb(200, 0, 0),		// fill color
								null
				);
            timeFormat.getLinePaint().setStyle(Paint.Style.STROKE);
            timeFormat.getLinePaint().setStrokeWidth(5);
            plot.addSeries(timeSeries, timeFormat);
        }
    }
}
 
开发者ID:flyingsparx,项目名称:GowerTides,代码行数:26,代码来源:TideGraph.java

示例8: initPlot

import com.androidplot.xy.SimpleXYSeries; //导入依赖的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 );
    }
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:31,代码来源:MainActivity.java

示例9: onCreate

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    DsSensorManager.checkBtLePermissions(this, true);

    mPlot = (XYPlot) findViewById(R.id.plotViewA);
    mPlotData = new SimpleXYSeries("Sensor Values");
    mPlotData.useImplicitXVals();
    mPlot.addSeries(mPlotData, new LineAndPointFormatter(Color.rgb(100, 100, 200), null, null, new PointLabelFormatter(Color.DKGRAY)));
    mPlot.setDomainLabel("Sample Index");
    mPlot.setRangeLabel("Value");
}
 
开发者ID:gradlman,项目名称:SensorLib,代码行数:15,代码来源:MainActivity.java

示例10: refreshSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的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();
}
 
开发者ID:sztyler,项目名称:sensordatacollector,代码行数:33,代码来源:DataPlotZoomListener.java

示例11: setDynamicPlotData

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
public void setDynamicPlotData(float[] values)
{
    if(!isPlotting()) {
        return;
    }

    // update instantaneous data:
    Number[] series1Numbers = new Number[levelPlot.domainValueNames.length];

    for(int i = 0; i < levelPlot.domainValueNames.length; i++) {
        series1Numbers[i] = values[i];
    }

    levelsValues.setModel(Arrays.asList(series1Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);

    if(historyPlot == null || historyValues == null || historyValues.length == 0) {
        return;
    }

    // get rid the oldest sample in history:
    if(historyValues[0].size() > historyPlot.domainMax - historyPlot.domainMin) {
        for(SimpleXYSeries historyValue : historyValues) {
            historyValue.removeFirst();
        }
    }

    for(int i = 0; i < historyValues.length; i++) {
        historyValues[i].addLast(null, values[i]);
    }

    // redraw the Plots:
    levelPlot.plot.redraw();
    historyPlot.plot.redraw();
}
 
开发者ID:sztyler,项目名称:sensordatacollector,代码行数:35,代码来源:Plotter.java

示例12: updateSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
public synchronized void updateSeries(@NonNull final Context context,
                                      @NonNull final List<SimpleXYSeries> series,
                                      @NonNull final HistoryIntervalType interval,
                                      @NonNull final HistoryUnitType type) {

    mShouldResetRangeBoundaries = true;
    cleanSeries();
    mDeviceSeries = series;
    updatePlotRangeFormat(context, type);
    updatePlotDomainFormat(context, interval);
    updatePlot();
    Log.i(TAG, "updateSeries -> Series where updated, graph was updated.");
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:14,代码来源:PlotHandler.java

示例13: prepareSeriesToShow

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
@NonNull
private SimpleXYSeries prepareSeriesToShow(@NonNull final SimpleXYSeries series) {
    final SimpleXYSeries fixedDeviceSeries;
    if (mIsFahrenheit && mLastUnit == HistoryUnitType.TEMPERATURE) {
        fixedDeviceSeries = convertSeriesToFahrenheit(series);
    } else {
        fixedDeviceSeries = series;
    }
    if (fixedDeviceSeries.size() == 1) {
        prepare1ValueSeries(fixedDeviceSeries);
    }
    return fixedDeviceSeries;
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:14,代码来源:PlotHandler.java

示例14: convertSeriesToFahrenheit

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
@NonNull
private SimpleXYSeries convertSeriesToFahrenheit(@NonNull final SimpleXYSeries seriesInCelsius) {
    final SimpleXYSeries seriesInFahrenheit = new SimpleXYSeries(seriesInCelsius.getTitle());
    for (int i = 0; i < seriesInCelsius.size(); i++) {
        final Number x = seriesInCelsius.getX(i);
        final Number y = Converter.convertToF(seriesInCelsius.getY(i).floatValue());
        seriesInFahrenheit.addFirst(x, y);
    }
    return seriesInFahrenheit;
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:11,代码来源:PlotHandler.java

示例15: obtainBiggestTimestampSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
private long obtainBiggestTimestampSeries(@NonNull final SimpleXYSeries series) {
    final long firstValue = series.getX(0).longValue();
    final long lastValue = series.getX(series.size() - 1).longValue();

    if (firstValue > lastValue) {
        return firstValue;
    }
    return lastValue;
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:10,代码来源:PlotHandler.java


注:本文中的com.androidplot.xy.SimpleXYSeries类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。