當前位置: 首頁>>代碼示例>>Java>>正文


Java GraphView.setVisibility方法代碼示例

本文整理匯總了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);
}
 
開發者ID:M66B,項目名稱:BackPackTrackII,代碼行數:56,代碼來源:SettingsFragment.java

示例2: setGraphView

import com.jjoe64.graphview.GraphView; //導入方法依賴的package包/類
void setGraphView(@NonNull GraphView graphView) {
    graphView.setLayoutParams(layoutParams);
    graphView.setVisibility(View.GONE);
}
 
開發者ID:VREMSoftwareDevelopment,項目名稱:WiFiAnalyzer,代碼行數:5,代碼來源:GraphViewBuilder.java


注:本文中的com.jjoe64.graphview.GraphView.setVisibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。