本文整理汇总了Java中com.jjoe64.graphview.series.LineGraphSeries.setDrawDataPoints方法的典型用法代码示例。如果您正苦于以下问题:Java LineGraphSeries.setDrawDataPoints方法的具体用法?Java LineGraphSeries.setDrawDataPoints怎么用?Java LineGraphSeries.setDrawDataPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jjoe64.graphview.series.LineGraphSeries
的用法示例。
在下文中一共展示了LineGraphSeries.setDrawDataPoints方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNowLine
import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的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);
}
示例2: onCreate
import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的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);
}
}
示例3: onCreate
import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的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);
}
示例4: onCreate
import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的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);
}
示例5: onPageVisible
import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void onPageVisible(final DataPoint[] datapoints, DataPoint[] averages) {
if(datapoints != null && averages != null) {
progressBar.setVisibility(View.GONE);
graphView.removeAllSeries();
DataPoint[] list = Arrays.copyOfRange(datapoints, Math.max(0, datapoints.length - period.getDays()), datapoints.length);
LineGraphSeries<DataPoint> datapointsSerie = new LineGraphSeries<>(list);
datapointsSerie.setDrawDataPoints(true);
datapointsSerie.setColor(getContext().getResources().getColor(R.color.green));
datapointsSerie.setTitle(getContext().getResources().getString(R.string.daily_average));
datapointsSerie.setOnDataPointTapListener(this);
graphView.addSeries(datapointsSerie);
LineGraphSeries<DataPoint> averageSerie = new LineGraphSeries<>(Arrays.copyOfRange(averages, Math.max(0, averages.length - period.getDays()), averages.length));
averageSerie.setColor(getContext().getResources().getColor(R.color.orange));
averageSerie.setTitle(getContext().getResources().getString(R.string.trend));
averageSerie.setDrawDataPoints(true);
averageSerie.setDataPointsRadius(6f);
averageSerie.setOnDataPointTapListener(this);
graphView.addSeries(averageSerie);
graphView.getViewport().setMinX(datapointsSerie.getLowestValueX());
graphView.getViewport().setMaxX(datapointsSerie.getHighestValueX());
graphView.getViewport().setXAxisBoundsManual(true);
graphView.getGridLabelRenderer().setNumHorizontalLabels(period.getNbLabels());
graphView.getGridLabelRenderer().setNumVerticalLabels(10);
graphView.getLegendRenderer().setVisible(true);
graphView.getLegendRenderer().setBackgroundColor(getContext().getResources().getColor(R.color.grand_exchange_legend));
graphView.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
graphView.getGridLabelRenderer().setHumanRounding(false, true);
graphView.setVisibility(View.VISIBLE);
}
}