本文整理汇总了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());
}
示例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);
}
示例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++;
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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);
}
示例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);
}
示例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");
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}