• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleXYSeries类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: checkSeriesRange

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * Checks if the graph range is modified in some way when.
 *
 * @param series that has to be checked.
 */
private void checkSeriesRange(@NonNull final SimpleXYSeries series) {
    for (int i = 0; i < series.size(); i++) {
        final float rangeValue = series.getY(i).floatValue();
        if (mIsFahrenheit && mLastUnit == HistoryUnitType.TEMPERATURE) {
            final float rangeValueFahrenheit = Converter.convertToF(rangeValue);
            recalculateRangeBoundaries(rangeValueFahrenheit);
        } else {
            recalculateRangeBoundaries(rangeValue);
        }
    }
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:17,代码来源:PlotHandler.java


示例17: getDeviceFormatterFromSeries

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * Obtains and prepares the formatter of a series, using the specific color of a device.
 *
 * @param deviceSeries that is to be formatted.
 * @return {@link com.androidplot.xy.LineAndPointFormatter} of a device series.
 * NOTE: The name of a series MUST be the device address of the device.
 */
@Nullable
private LineAndPointFormatter getDeviceFormatterFromSeries(@NonNull final SimpleXYSeries deviceSeries) {
    final int lineColor = ColorManager.getInstance().getDeviceColor(deviceSeries.getTitle());
    final Paint fillColor = new Paint();
    fillColor.setColor(lineColor);
    fillColor.setAlpha(45);
    return new LineAndPointFormatter(lineColor, null, fillColor.getColor(), null);
}
 
开发者ID:Sensirion,项目名称:SmartGadget-Android,代码行数:16,代码来源:PlotHandler.java


示例18: cargarGrafico

import com.androidplot.xy.SimpleXYSeries; //导入依赖的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);

}
 
开发者ID:mateosss,项目名称:controlalumno,代码行数:15,代码来源:MainActivity.java


示例19: displayDataGraphic

import com.androidplot.xy.SimpleXYSeries; //导入依赖的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();
		}

	}
}
 
开发者ID:ComputerEngineering,项目名称:iWish,代码行数:40,代码来源:GraphicActivity.java


示例20: DynamicPlot

import com.androidplot.xy.SimpleXYSeries; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:KalebKE,项目名称:AccelerationAlert,代码行数:16,代码来源:DynamicPlot.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java License类代码示例发布时间:2022-05-21
下一篇:
Java CCacheInputStream类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap