當前位置: 首頁>>代碼示例>>Java>>正文


Java GraphView.addSeries方法代碼示例

本文整理匯總了Java中com.jjoe64.graphview.GraphView.addSeries方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphView.addSeries方法的具體用法?Java GraphView.addSeries怎麽用?Java GraphView.addSeries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jjoe64.graphview.GraphView的用法示例。


在下文中一共展示了GraphView.addSeries方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.activity_tune_result);
    ActivityTuneResultBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_tune_result);
    TuneResult tuneResult = getIntent().getParcelableExtra(TUNE_RESULT_KEY);
    binding.setTuneResult(tuneResult);

    GraphView gphTuning = (GraphView) findViewById(R.id.gphTuning);
    LineGraphSeries<DataPoint> tuningSeries = getLineGraph(tuneResult);
    gphTuning.addSeries(tuningSeries);

    gphTuning.getViewport().setScalable(true);
    gphTuning.getViewport().setScrollable(true);

    // Translate the graph around on a pseudo-log scale
    gphTuning.getGridLabelRenderer().setLabelFormatter(new FrequencyLabelFormatter());

}
 
開發者ID:AndProx,項目名稱:AndProx,代碼行數:20,代碼來源:TuneResultActivity.java

示例2: onStart

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
protected void onStart() {
    super.onStart();

    // draw Graph of RouteHistory
    GraphView graph = (GraphView) findViewById(R.id.view_route_history_stats);
    RouteHistory rh = helper.getRouteHistory();
    Diagram diagram = new Diagram(rh);
    graph.setTitleTextSize(75);
    graph.getGridLabelRenderer().setVerticalAxisTitle(getResources().getString(R.string.route_history_vertical_axis));
    graph.getGridLabelRenderer().setHorizontalAxisTitle(getResources().getString(R.string.route_history_horizontal_axis));
    graph.setTitle(getResources().getString(R.string.route_history_title));

    // activate horizontal zooming and scrolling
    graph.getViewport().setScalable(true);
    graph.addSeries(diagram.draw());

    // draw Graph of last Route
    GraphView dayGraph = (GraphView) findViewById(R.id.view_route_stats);
    drawRouteGraph(0, dayGraph);
}
 
開發者ID:BernhardWebstudio,項目名稱:ShadowTravelor,代碼行數:22,代碼來源:MainActivity.java

示例3: initialize

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
public void initialize(LineGraphSeries<DataPoint>[] series){
    graph = (GraphView) myFragmentView.findViewById(R.id.graphView);
    float tmp;
    if(!sharedPref.getBoolean("pref_yAutoScale", true)){
        graph.getViewport().setYAxisBoundsManual(true);
        tmp = Float.parseFloat(sharedPref.getString("pref_y_min", "-200"));
        graph.getViewport().setMinY(tmp);
        tmp = Float.parseFloat(sharedPref.getString("pref_y_max", "200"));
        graph.getViewport().setMaxY(tmp);
    }
    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMinX(0);
    tmp = Integer.parseInt(sharedPref.getString("pref_windowSize", "200"));
    graph.getViewport().setMaxX(tmp);
    graph.getGridLabelRenderer().setHorizontalLabelsVisible(sharedPref.getBoolean("pref_xgridlabels", false));//pref_ygridlabels
    graph.getGridLabelRenderer().setVerticalLabelsVisible(sharedPref.getBoolean("pref_ygridlabels", true));
    int i =0;
    for (LineGraphSeries<DataPoint> sery : series) {
        if (sery != null) {
            sery.setColor(getColor(i));
            graph.addSeries(sery);
        }
        i++;
    }
}
 
開發者ID:sakulstra,項目名稱:bluegraph,代碼行數:26,代碼來源:GraphFragment.java

示例4: draw

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
public View draw(Collection<String> plottableKeys) {
    Log.d(TAG, "Drawing graph. Plottable reference points: " + plotReference.size());
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View newLayout = inflater.inflate(R.layout.graph_layout, null);
    GraphView graph = (GraphView) newLayout.findViewById(R.id.graph);
    for (String key : plottableKeys) {
        if (plottables.containsKey(key)) {
            List<Double> plottable = plottables.get(key);
            List<DataPoint> dataPoints = new ArrayList<>(plottable.size());
            for (int i = 0; i < plottable.size(); i++) {
                Double plotValue = plottable.get(i);
                Double plotRef = plotReference.get(i);
                if (plotValue != null && plotRef != null) {
                    dataPoints.add(new DataPoint(plotRef, plotValue));
                }
            }
            LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints.toArray(new
                    DataPoint[dataPoints.size()]));
            series.setTitle(key);
            graph.addSeries(series);
        }
    }
    graph.getLegendRenderer().setVisible(true);
    graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.BOTTOM);
    return newLayout;
}
 
開發者ID:WiReSEP,項目名稱:SimWatch,代碼行數:27,代碼來源:GraphPainter.java

示例5: getSampleCode

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
private void getSampleCode() {

        GraphViewSeries exampleSeries = new GraphViewSeries(new GraphView.GraphViewData[] {
                new GraphView.GraphViewData(1, 2.0d)
                , new GraphView.GraphViewData(2, 1.5d)
                , new GraphView.GraphViewData(3, 2.5d)
                , new GraphView.GraphViewData(4, 1.0d)
        });

        GraphView graphView = new LineGraphView(this, "GraphViewDemo");
        graphView.addSeries(exampleSeries);

        GraphView barGraphView = new BarGraphView(this, "BarGraphView");
        barGraphView.addSeries(exampleSeries);

        LinearLayout layout = (LinearLayout) findViewById(R.id.linear_layout);
        layout.addView(barGraphView);
    }
 
開發者ID:Phonbopit,項目名稱:30-android-libraries-in-30-days,代碼行數:19,代碼來源:GraphViewActivity.java

示例6: initGraph

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@AfterViews
void initGraph() {
    if (mScoreResponse != null) {
        final TreeMap<Long, Double> scoreArray = mScoreResponse.getScoreArray();
        final double width = scoreArray.lastKey() - scoreArray.firstKey();
        final GraphView graphView = new LineGraphView(getActivity(), getString(R.string.chart_title));

        GraphViewData[] data = new GraphViewData[scoreArray.size()];
        int i = 0;
        for (Map.Entry<Long, Double> entry : scoreArray.entrySet()) {
            data[i] = new GraphViewData(entry.getKey(), entry.getValue());
            i++;
        }

        final GraphViewSeriesStyle graphViewSeriesStyle = new GraphViewSeriesStyle(Color.WHITE, 4);
        graphView.addSeries(new GraphViewSeries("Score", graphViewSeriesStyle, data));
        graphView.setViewPort(0, width);
        graphView.setScalable(true);
        graphView.setScrollable(true);
        graphContainer.addView(graphView);
    }
}
 
開發者ID:runningcode,項目名稱:Hipster-Visualization,代碼行數:23,代碼來源:GraphFragment.java

示例7: drawRouteGraph

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
private void drawRouteGraph(int i, GraphView graph) {
    graph.getGridLabelRenderer().setVerticalAxisTitle(getResources().getString(R.string.route_vertical_axis));
    graph.getGridLabelRenderer().setHorizontalAxisTitle(getResources().getString(R.string.route_horizontal_axis));

    Route route = this.allRoutes.get(i);

    TextView last = (TextView) findViewById(R.id.last_score);
    last.setText(getResources().getString(R.string.last_score) + ": " + String.valueOf(route.getScore()));

    Diagram diagram = new Diagram(route);
    graph.getViewport().setScalable(true);

    graph.removeAllSeries();
    graph.addSeries(diagram.draw());
}
 
開發者ID:BernhardWebstudio,項目名稱:ShadowTravelor,代碼行數:16,代碼來源:MainActivity.java

示例8: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_graph);

        List<TimeStats> timeStatsList = PrefsController.instance.getPrefs().getTimeStatsList();
        if (!timeStatsList.isEmpty()) {
            // battery temperature graph
            List<Float> batteryTemperatureList = Converters.TIME_STATS_TO_TEMPERATURE_LIST.apply(timeStatsList);
            DataPoint[] batTempDataPoints = new DataPoint[batteryTemperatureList.size()];
            int i = 0;
            for (Float batteryTemperature : batteryTemperatureList) {
                batTempDataPoints[i++] = new DataPoint(i, batteryTemperature);
            }

            GraphView tempGraph = (GraphView) findViewById(R.id.temperature_graph);

            LineGraphSeries<DataPoint> batTempSeries = new LineGraphSeries<>(batTempDataPoints);
            batTempSeries.setDrawDataPoints(true);
            tempGraph.addSeries(batTempSeries);

            // battery level graph
//            List<Float> batteryLevelList = Converters.TIME_STATS_TO_BATTERY_LEVEL.apply(timeStatsList);
//            DataPoint[] batLevelDataPoints = new DataPoint[batteryLevelList.size()];
//            i = 0;
//            for (Float batteryLevel: batteryLevelList) {
//                batLevelDataPoints[i++] = new DataPoint(i, batteryLevel);
//            }
//            LineGraphSeries<DataPoint> batLevelSeries = new LineGraphSeries<>(batLevelDataPoints);
//            GraphView lvlGraph = (GraphView) findViewById(R.id.level_graph);
//            lvlGraph.addSeries(batLevelSeries);
        }

    }
 
開發者ID:Rai220,項目名稱:Telephoto,代碼行數:35,代碼來源:GraphActivity.java

示例9: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_graph2);

    GraphView graph = (GraphView) findViewById(R.id.graph);

    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(new DataPoint[] {
            new DataPoint(0, 4),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6),
            new DataPoint(5, 3),
            new DataPoint(6, 1)
    });
    series.setColor(Color.parseColor("#b485f2"));
    series.setDrawDataPoints(true);
    series.setDataPointsRadius(10);
    series.setThickness(5);

    graph.addSeries(series);
    graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setVerticalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setTextSize(30);

    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMaxX(6);

}
 
開發者ID:inceleb,項目名稱:InstagramManager-Android,代碼行數:31,代碼來源:GraphActivity.java

示例10: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_graph);

    GraphView graph = (GraphView) findViewById(R.id.graph);

    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(new DataPoint[] {
            new DataPoint(0, 4),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6),
            new DataPoint(5, 3),
            new DataPoint(6, 1)
    });
    series.setColor(Color.parseColor("#b485f2"));
    series.setDrawDataPoints(true);
    series.setDataPointsRadius(10);
    series.setThickness(5);

    graph.addSeries(series);
    graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setVerticalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setTextSize(30);
    
    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMaxX(6);

}
 
開發者ID:inceleb,項目名稱:InstagramManager-Android,代碼行數:31,代碼來源:GraphActivity.java

示例11: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_reporte);

        dbHelper = new DBHelper(this);

        Intent intent = getIntent();
        _id_reclutador =intent.getStringExtra("id_reclutador");
        fecha = intent.getStringExtra("fecha");
        fecha2 = intent.getStringExtra("fecha2");

        GraphView graph = (GraphView) findViewById(R.id.graph);
        BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(new DataPoint[] {
                new DataPoint(0, getEmpresaCount("BOSCH", fecha, fecha2)),
                new DataPoint(1, getEmpresaCount("HONEYWELL", fecha, fecha2)),
                new DataPoint(2, getEmpresaCount("UTC", fecha, fecha2)),
                new DataPoint(3, getEmpresaCount("SKYWORKS", fecha, fecha2)),

        });
        graph.addSeries(series);

// styling
        series.setValueDependentColor(new ValueDependentColor<DataPoint>() {
            @Override
            public int get(DataPoint data) {
                return Color.rgb((int) data.getX() * 255 / 4, (int) Math.abs(data.getY() * 255 / 6), 100);
            }
        });

        series.setSpacing(10);
        series.setTitle("Reporte de Fecha #1 a Fecha #2");

// draw values on top
        series.setDrawValuesOnTop(true);
        series.setValuesOnTopColor(Color.RED);
//series.setValuesOnTopSize(50);
        txtEmpresas = (TextView) findViewById(R.id.txtEmpresas);
        txtEmpresas.setText("1.- BOSCH\n2.- HONEYWELL\n3.- UTC\n4.- SKYWORKS");
    }
 
開發者ID:catcarlos,項目名稱:gt-service,代碼行數:41,代碼來源:ActivityReporte.java

示例12: onCreate

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_reporte);

        dbHelper = new DBHelper(this);

        Intent intent = getIntent();
        _id_reclutador =intent.getStringExtra("id_reclutador");
        fecha = intent.getStringExtra("fecha");
        fecha2 = intent.getStringExtra("fecha2");

        GraphView graph = (GraphView) findViewById(R.id.graph);
        BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(new DataPoint[] {
                new DataPoint(0, getEmpresaCount("BOSCH", fecha, fecha2)),
                new DataPoint(1, getEmpresaCount("Chromalloy", fecha, fecha2)),
                new DataPoint(2, getEmpresaCount("UTC", fecha, fecha2))
        });
        graph.addSeries(series);

// styling
        series.setValueDependentColor(new ValueDependentColor<DataPoint>() {
            @Override
            public int get(DataPoint data) {
                return Color.rgb((int) data.getX() * 255 / 4, (int) Math.abs(data.getY() * 255 / 6), 100);
            }
        });

        series.setSpacing(10);
        series.setTitle("Reporte de Fecha #1 a Fecha #2");

// draw values on top
        series.setDrawValuesOnTop(true);
        series.setValuesOnTopColor(Color.RED);
//series.setValuesOnTopSize(50);
        txtEmpresas = (TextView) findViewById(R.id.txtEmpresas);
        txtEmpresas.setText("1.- BOSCH\n2.- Honeywell\n3.- UTC\n4.- Chromalloy\n5.- ManPower\n6.- Skyworks\n7.- Pilkington");
    }
 
開發者ID:catcarlos,項目名稱:gt-service,代碼行數:39,代碼來源:ActivityReporteG.java

示例13: displayGraphs

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
public void displayGraphs(){
    GraphView graph1 = (GraphView) findViewById(R.id.graph1);
    GraphView graph2 = (GraphView) findViewById(R.id.graph2);
    series1 = new LineGraphSeries<DataPoint>();
    series2 = new LineGraphSeries<DataPoint>();
    addEntries();
    graph1.addSeries(series1);
    graph2.addSeries(series2);
}
 
開發者ID:LouisRoux,項目名稱:FloeCompanionApp,代碼行數:10,代碼來源:FloeRunReviewAct.java

示例14: SensorPlotter

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
public SensorPlotter(@NonNull String name, @NonNull  GraphView graphView,
                     @NonNull Observable<SensorEvent> sensorEventObservable) {
    mName = name;
    mSensorEventObservable = sensorEventObservable;

    graphView.getViewport().setXAxisBoundsManual(true);
    graphView.getViewport().setMinX(0);
    graphView.getViewport().setMaxX(VIEWPORT_SECONDS * 1000); // number of ms in viewport

    graphView.getViewport().setYAxisBoundsManual(true);
    graphView.getViewport().setMinY(-20);
    graphView.getViewport().setMaxY(20);

    graphView.getGridLabelRenderer().setHorizontalLabelsVisible(false);
    graphView.getGridLabelRenderer().setVerticalLabelsVisible(false);

    mSeriesX = new LineGraphSeries<>();
    mSeriesY = new LineGraphSeries<>();
    mSeriesZ = new LineGraphSeries<>();
    mSeriesX.setColor(Color.RED);
    mSeriesY.setColor(Color.GREEN);
    mSeriesZ.setColor(Color.BLUE);

    graphView.addSeries(mSeriesX);
    graphView.addSeries(mSeriesY);
    graphView.addSeries(mSeriesZ);
}
 
開發者ID:ArkadyGamza,項目名稱:ShakeDetector,代碼行數:28,代碼來源:SensorPlotter.java

示例15: initGraph

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
/**
 * init and setup Graph Contents
 */
private void initGraph() {
    hasNewPoint = false;
    maxXaxis = 0.1;
    maxY1axis = 10;
    maxY2axis = 0.4;
    graph = (GraphView) findViewById(R.id.analytics_graph);

    speedGraphSeries = new LineGraphSeries<>();
    graph.addSeries(speedGraphSeries);

    graph.getGridLabelRenderer().setVerticalLabelsColor(0xFF009688);
    graph.getViewport().setYAxisBoundsManual(true);
    resetGraphY1MaxValue();
    distanceGraphSeries = new LineGraphSeries<>();
    //        graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setScalable(true);
    graph.getViewport().setScrollable(true);

    graph.getViewport().setMinX(0);
    // set second scale
    graph.getSecondScale().addSeries(distanceGraphSeries);
    // the y bounds are always manual for second scale
    graph.getSecondScale().setMinY(0);
    resetGraphY2MaxValue();
    //        resetGraphXMaxValue();
    graph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(0xFFFF5722);
    // legend
    speedGraphSeries.setTitle("Speed km/h");
    speedGraphSeries.setColor(0xFF009688);
    distanceGraphSeries.setTitle("Distance km");
    distanceGraphSeries.setColor(0xFFFF5722);
    graph.getLegendRenderer().setVisible(true);
    graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
}
 
開發者ID:junjunguo,項目名稱:PocketMaps,代碼行數:38,代碼來源:Analytics.java


注:本文中的com.jjoe64.graphview.GraphView.addSeries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。