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


Java GraphView類代碼示例

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


GraphView類屬於com.jjoe64.graphview包,在下文中一共展示了GraphView類的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: createSeries

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private void createSeries(final GraphView view, final int spacing)
{
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postDelayed(new Runnable()
    {
        public void run()
        {
            _series = new BarGraphSeries<>();
            _series.setColor(Color.parseColor(options.color.get()));
            _series.setDrawValuesOnTop(true);
            _series.setValuesOnTopColor(Color.BLACK);
            _series.setSpacing(spacing);

            view.addSeries(_series);
        }
    }, 1);
}
 
開發者ID:hcmlab,項目名稱:ssj,代碼行數:18,代碼來源:EventPainter.java

示例4: addNowLine

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
public void addNowLine(GraphView graph, long now) {
    LineGraphSeries<DataPoint> seriesNow;
    DataPoint[] nowPoints = new DataPoint[]{
            new DataPoint(now, 0),
            new DataPoint(now, maxY)
    };

    seriesNow = new LineGraphSeries<>(nowPoints);
    seriesNow.setDrawDataPoints(false);
    // custom paint to make a dotted line
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2);
    paint.setPathEffect(new DashPathEffect(new float[]{10, 20}, 0));
    paint.setColor(Color.WHITE);
    seriesNow.setCustomPaint(paint);

    addSeriesWithoutInvalidate(graph, seriesNow);
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:20,代碼來源:GraphData.java

示例5: initializeGraph

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private void initializeGraph(int count){
    GraphView graph = new GraphView(getActivity());
    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));
    ((FrameLayout)myFragmentView).addView(graph);
}
 
開發者ID:sakulstra,項目名稱:bluegraph,代碼行數:19,代碼來源:GraphFragment.java

示例6: 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

示例7: formatXAxix

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private void formatXAxix(GraphView graph) {
    graph.getGridLabelRenderer().setLabelFormatter(new DefaultLabelFormatter() {
        @Override
        public String formatLabel(double value, boolean isValueX) {
            if (isValueX) {
                // new value is sample_num*x_interval_size(from values)
                return super.formatLabel(value * BikeableRoute.GRAPH_X_INTERVAL, isValueX);
            } else {
                // show normal y values
                return super.formatLabel(value, isValueX);

            }
        }
    });
    graph.getGridLabelRenderer().setHorizontalAxisTitle("Distance (meters)");
    graph.getGridLabelRenderer().setHorizontalAxisTitleColor(Color.rgb(48, 139, 159));
    graph.getGridLabelRenderer().setVerticalAxisTitle("Elevation (meters)");
    graph.getGridLabelRenderer().setVerticalAxisTitleColor(Color.rgb(48, 139, 159));

}
 
開發者ID:nogalavi,項目名稱:Bikeable,代碼行數:21,代碼來源:PathElevationGraphDrawer.java

示例8: 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

示例9: 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

示例10: 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

示例11: updateTrafficOnDate

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private ArrayList<GraphView.GraphViewData> updateTrafficOnDate(String date,
		int type) {
	// initialize database
	Log.e(TAG, "date=" + date + " type:" + type);
	this.transformationDB = new LocalTransformationDBMS(getActivity()
			.getApplicationContext());
	transformationDB.open();
	ArrayList<TrafficData> list = transformationDB.getAllTrafficFromDate(
			date, type);
	ArrayList<GraphView.GraphViewData> data = new ArrayList<GraphView.GraphViewData>();
	for (TrafficData t : list) {
		GraphViewData x = new GraphViewData(t.getxValue(), t.getyValue());
		data.add(x);
	}
	transformationDB.close();

	return data;
}
 
開發者ID:myHealthAssistant-tudarmstadt,項目名稱:myHealthHub,代碼行數:19,代碼來源:GraphPlotFragment.java

示例12: updateTrafficOnDate

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private ArrayList<GraphView.GraphViewData> updateTrafficOnDate(String date,
		int type) {
	// initialize database
	Log.e(TAG, "date=" + date + " type:" + type);
	this.transformationDB = new LocalTransformationDBMS(
			this.getApplicationContext());
	transformationDB.open();
	ArrayList<TrafficData> list = transformationDB.getAllTrafficFromDate(
			date, type);
	ArrayList<GraphView.GraphViewData> data = new ArrayList<GraphView.GraphViewData>();
	for (TrafficData t : list) {
		GraphViewData x = new GraphViewData(t.getxValue(), t.getyValue());
		data.add(x);
	}
	transformationDB.close();

	return data;
}
 
開發者ID:myHealthAssistant-tudarmstadt,項目名稱:myHealthHub,代碼行數:19,代碼來源:GraphPlotBigActivity.java

示例13: clearChart

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
private void clearChart(String title) {
	GraphViewData[] dataList = new GraphViewData[1];
	dataList[0] = new GraphViewData(0.0, 0.0);
	GraphViewSeries gvs_series = new GraphViewSeries(dataList);

	if (title.equals(firstGrpTitle)) {
		createGraph(firstGrpTitle, gvs_series, R.id.light_graph, isFirstBar, 0);
		
		
		data_line = new ArrayList<GraphView.GraphViewData>();
	}
	if (title.equals(secondGrpTitle)) {
		createGraph(secondGrpTitle, gvs_series, R.id.motion_graph, isSecondBar, 0);
		
		
		data_bar = new ArrayList<GraphView.GraphViewData>();
	}
}
 
開發者ID:myHealthAssistant-tudarmstadt,項目名稱:myHealthHub,代碼行數:19,代碼來源:GraphPlotBigActivity.java

示例14: onItemSelected

import com.jjoe64.graphview.GraphView; //導入依賴的package包/類
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
    // load graphic of selected day
    if (allRoutes.size() > 0) {
        GraphView graph = (GraphView) findViewById(R.id.view_route_stats);
            drawRouteGraph(i, graph);
    }
}
 
開發者ID:BernhardWebstudio,項目名稱:ShadowTravelor,代碼行數:9,代碼來源:MainActivity.java

示例15: 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


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