当前位置: 首页>>代码示例>>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;未经允许,请勿转载。