本文整理汇总了Java中com.jjoe64.graphview.GraphView.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java GraphView.setVisibility方法的具体用法?Java GraphView.setVisibility怎么用?Java GraphView.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jjoe64.graphview.GraphView
的用法示例。
在下文中一共展示了GraphView.setVisibility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showStepGraph
import com.jjoe64.graphview.GraphView; //导入方法依赖的package包/类
private void showStepGraph(GraphView graph) {
SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();
boolean data = false;
long maxTime = 0;
int maxSteps = 10000;
long now = new Date().getTime();
int history = Integer.parseInt(prefs.getString(PREF_GRAPH_HISTORY, DEFAULT_GRAPH_HISTORY));
Cursor cursor = db.getSteps(now - history * DAY_MS, now, true);
int colTime = cursor.getColumnIndex("time");
int colCount = cursor.getColumnIndex("count");
LineGraphSeries<DataPoint> seriesStep = new LineGraphSeries<DataPoint>();
while (cursor.moveToNext()) {
data = true;
long time = cursor.getLong(colTime);
if (time > maxTime)
maxTime = time;
int count = cursor.getInt(colCount);
if (count > maxSteps)
maxSteps = count;
seriesStep.appendData(new DataPoint(new Date(time), count), true, Integer.MAX_VALUE);
}
if (data) {
graph.removeAllSeries();
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(maxTime - 7 * DAY_MS);
graph.getViewport().setMaxX(maxTime);
graph.getViewport().setYAxisBoundsManual(true);
graph.getViewport().setMinY(0);
graph.getViewport().setMaxY(maxSteps);
graph.getViewport().setScrollable(true);
graph.getViewport().setScalable(true);
graph.getGridLabelRenderer().setLabelFormatter(
new DateAsXAxisLabelFormatter(getActivity(),
SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT)));
graph.getGridLabelRenderer().setNumHorizontalLabels(3);
graph.addSeries(seriesStep);
graph.setVisibility(View.VISIBLE);
} else
graph.setVisibility(View.GONE);
}
示例2: setGraphView
import com.jjoe64.graphview.GraphView; //导入方法依赖的package包/类
void setGraphView(@NonNull GraphView graphView) {
graphView.setLayoutParams(layoutParams);
graphView.setVisibility(View.GONE);
}