本文整理匯總了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);
}