当前位置: 首页>>代码示例>>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;未经允许,请勿转载。