当前位置: 首页>>代码示例>>Java>>正文


Java LineChartView.setViewportCalculationEnabled方法代码示例

本文整理汇总了Java中lecho.lib.hellocharts.view.LineChartView.setViewportCalculationEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LineChartView.setViewportCalculationEnabled方法的具体用法?Java LineChartView.setViewportCalculationEnabled怎么用?Java LineChartView.setViewportCalculationEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lecho.lib.hellocharts.view.LineChartView的用法示例。


在下文中一共展示了LineChartView.setViewportCalculationEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_line_chart, container, false);

    chart = (LineChartView) rootView.findViewById(R.id.chart);
    chart.setOnValueTouchListener(new ValueTouchListener());

    // Generate some random values.
    generateValues();

    generateData();

    // Disable viewport recalculations, see toggleCubic() method for more info.
    chart.setViewportCalculationEnabled(false);

    resetViewport();

    return rootView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:LineChartActivity.java

示例2: setupCharts

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 2) * 24; // LimiTTer sample rate 1 per 2 minutes
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues, false);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener(this));
    previewChart.setLineChartData(bgGraphBuilder.previewLineData(chart.getLineChartData()));

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());

    setupStatistics(date1.getTimeInMillis(), endDate.getTimeInMillis());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:25,代码来源:BGHistory.java

示例3: setupCharts

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 5) * 24;
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:23,代码来源:BGHistory.java

示例4: setupCharts

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
public void setupCharts() {
    bgGraphBuilder  = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);

    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:NightWatch,代码行数:20,代码来源:Home.java

示例5: onCreateView

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_line_chart, container, false);

    chart = (LineChartView) rootView.findViewById(R.id.chart);
    chart.setOnValueTouchListener(new ValueTouchListener());

    // Generate some randome values.
    getValues();

    generateData();

    // Disable viewpirt recalculations, see toggleCubic() method for more info.
    chart.setViewportCalculationEnabled(false);

    resetViewport();

    return rootView;
}
 
开发者ID:vaslabs,项目名称:SDC,代码行数:21,代码来源:MainFragment.java

示例6: refreshView

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
protected void refreshView(View view) {
    LineChartView chart = (LineChartView) view.findViewById(R.id.example_linechart);
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(getContext());
    chart.setLineChartData(bgGraphBuilder.lineData());
    Viewport viewport = chart.getMaximumViewport();
    chart.setViewportCalculationEnabled(false);
    chart.setInteractive(false);
    chart.setCurrentViewport(viewport);
    chart.setPadding(0, 0, 0, 0);
    chart.setLeft(0);
    chart.setTop(0);
    Log.d(TAG, "onBindExampleChart: refreshview " + chart.getHeight());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:14,代码来源:ExampleChartPreferenceView.java

示例7: updateGraph

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
private void updateGraph(List<LivePvDatum> livePvData) {
    LinearLayout graphLinearLayout = (LinearLayout) fragmentView.findViewById(graph);
    graphLinearLayout.removeAllViews();

    final Context context = getContext();
    if (context != null) {
        LineChartView lineChartView = new LineChartView(context);
        graphLinearLayout.addView(lineChartView);

        List<PointValue> powerPointValues = new ArrayList<>();
        for (int i = 0; i < livePvData.size(); i++) {
            LivePvDatum livePvDatum = livePvData.get(i);

            float x = (float) i;
            float y = (float) livePvDatum.getPowerGeneration();
            powerPointValues.add(new PointValue(x, y));
        }
        List<Line> lines = new ArrayList<>();
        Line powerLine = new Line(powerPointValues)
                .setColor(ChartUtils.COLORS[0])
                .setHasPoints(false)
                .setCubic(true)
                .setFilled(true);
        lines.add(powerLine);
        LineChartData lineChartData = new LineChartData();
        lineChartData.setLines(lines);

        RecordPvDatum recordPvDatum = pvDataOperations.loadRecord();
        double yAxisMax = Math.max(recordPvDatum.getLivePowerGeneration(), 1.0);
        AxisLabelValues axisLabelValues = FormatUtils.getAxisLabelValues(yAxisMax);
        Axis yAxis = Axis
                .generateAxisFromRange(0, axisLabelValues.getMax(), axisLabelValues.getStep())
                .setMaxLabelChars(6)
                .setTextColor(Color.GRAY)
                .setHasLines(true);
        yAxis.setName(getResources().getString(R.string.graph_legend_power));
        lineChartData.setAxisYLeft(yAxis);

        lineChartView.setLineChartData(lineChartData);

        lineChartView.setViewportCalculationEnabled(false);
        Viewport viewport = new Viewport(-1, axisLabelValues.getView(), livePvData.size(), 0);
        lineChartView.setMaximumViewport(viewport);
        lineChartView.setCurrentViewport(viewport);
    }
}
 
开发者ID:jansipke,项目名称:pvdisplay,代码行数:47,代码来源:LiveFragment.java

示例8: setupCharts

import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
private void setupCharts() {
    bgGraphBuilder = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);

    chart.setZoomType(ZoomType.HORIZONTAL);

    //Transmitter Battery Level
    final Sensor sensor = Sensor.currentSensor();
    if (sensor != null && sensor.latest_battery_level != 0 && sensor.latest_battery_level <= Constants.TRANSMITTER_BATTERY_LOW && ! mPreferences.getBoolean("disable_battery_warning", false)) {
        Drawable background = new Drawable() {

            @Override
            public void draw(Canvas canvas) {

                DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
                int px = (int) (30 * (metrics.densityDpi / 160f));
                Paint paint = new Paint();
                paint.setTextSize(px);
                paint.setAntiAlias(true);
                paint.setColor(Color.parseColor("#FFFFAA"));
                paint.setStyle(Paint.Style.STROKE);
                paint.setAlpha(100);
                canvas.drawText("transmitter battery", 10, chart.getHeight() / 3 - (int) (1.2 * px), paint);
                if(sensor.latest_battery_level <= Constants.TRANSMITTER_BATTERY_EMPTY){
                    paint.setTextSize((int)(px*1.5));
                    canvas.drawText("VERY LOW", 10, chart.getHeight() / 3, paint);
                } else {
                    canvas.drawText("low", 10, chart.getHeight() / 3, paint);
                }
            }

            @Override
            public void setAlpha(int alpha) {}
            @Override
            public void setColorFilter(ColorFilter cf) {}
            @Override
            public int getOpacity() {return 0;}
        };
        chart.setBackground(background);
    }
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:56,代码来源:Home.java


注:本文中的lecho.lib.hellocharts.view.LineChartView.setViewportCalculationEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。