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


Java LineChartView.setStep方法代码示例

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


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

示例1: temperatureGraph

import com.db.chart.view.LineChartView; //导入方法依赖的package包/类
private void temperatureGraph() {
    LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_temperature);

    // Data
    LineSet dataset = new LineSet();
    for (int i = 0; i < weatherList.size(); i++) {
        float temperature = UnitConvertor.convertTemperature(Float.parseFloat(weatherList.get(i).getTemperature()), sp);

        if (temperature < minTemp) {
            minTemp = temperature;
        }

        if (temperature > maxTemp) {
            maxTemp = temperature;
        }

        dataset.addPoint(getDateLabel(weatherList.get(i), i), (float) ((Math.ceil(temperature / 2)) * 2));
    }
    dataset.setSmooth(false);
    dataset.setColor(Color.parseColor("#FF5722"));
    dataset.setThickness(4);

    lineChartView.addData(dataset);

    // Grid
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setColor(Color.parseColor("#333333"));
    paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
    paint.setStrokeWidth(1);
    lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
    lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
    lineChartView.setAxisBorderValues((int) minTemp - 2, (int) maxTemp + 2);
    lineChartView.setStep(2);
    lineChartView.setXAxis(false);
    lineChartView.setYAxis(false);

    lineChartView.show();
}
 
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java

示例2: rainGraph

import com.db.chart.view.LineChartView; //导入方法依赖的package包/类
private void rainGraph() {
    LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_rain);

    // Data
    LineSet dataset = new LineSet();
    for (int i = 0; i < weatherList.size(); i++) {
        float rain = Float.parseFloat(weatherList.get(i).getRain());

        if (rain < minRain) {
            minRain = rain;
        }

        if (rain > maxRain) {
            maxRain = rain;
        }

        dataset.addPoint(getDateLabel(weatherList.get(i), i), rain);
    }
    dataset.setSmooth(false);
    dataset.setColor(Color.parseColor("#2196F3"));
    dataset.setThickness(4);

    lineChartView.addData(dataset);

    // Grid
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setColor(Color.parseColor("#333333"));
    paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
    paint.setStrokeWidth(1);
    lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
    lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
    lineChartView.setAxisBorderValues((int) minRain - 1, (int) maxRain + 2);
    lineChartView.setStep(1);
    lineChartView.setXAxis(false);
    lineChartView.setYAxis(false);

    lineChartView.show();
}
 
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java

示例3: pressureGraph

import com.db.chart.view.LineChartView; //导入方法依赖的package包/类
private void pressureGraph() {
    LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_pressure);

    // Data
    LineSet dataset = new LineSet();
    for (int i = 0; i < weatherList.size(); i++) {
        float pressure = UnitConvertor.convertPressure(Float.parseFloat(weatherList.get(i).getPressure()), sp);

        if (pressure < minPressure) {
            minPressure = pressure;
        }

        if (pressure > maxPressure) {
            maxPressure = pressure;
        }

        dataset.addPoint(getDateLabel(weatherList.get(i), i), pressure);
    }
    dataset.setSmooth(true);
    dataset.setColor(Color.parseColor("#4CAF50"));
    dataset.setThickness(4);

    lineChartView.addData(dataset);

    // Grid
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setColor(Color.parseColor("#333333"));
    paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
    paint.setStrokeWidth(1);
    lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
    lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
    lineChartView.setAxisBorderValues((int) minPressure - 1, (int) maxPressure + 1);
    lineChartView.setStep(2);
    lineChartView.setXAxis(false);
    lineChartView.setYAxis(false);

    lineChartView.show();
}
 
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java

示例4: temperatureGraph

import com.db.chart.view.LineChartView; //导入方法依赖的package包/类
private void temperatureGraph() {
    LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_temperature);

    // Data
    LineSet dataset = new LineSet();
    for (int i = 0; i < weatherList.size(); i++) {
        float temperature = UnitConvertor.convertTemperature(Float.parseFloat(weatherList.get(i).getTemperature()), sp);

        if (temperature < minTemp) {
            minTemp = temperature;
        }

        if (temperature > maxTemp) {
            maxTemp = temperature;
        }

        dataset.addPoint(getDateLabel(weatherList.get(i), i), (float) temperature);
    }
    dataset.setSmooth(false);
    dataset.setColor(Color.parseColor("#FF5722"));
    dataset.setThickness(4);

    lineChartView.addData(dataset);

    // Grid
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setColor(Color.parseColor("#333333"));
    paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
    paint.setStrokeWidth(1);
    lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
    lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
    lineChartView.setAxisBorderValues((int) (Math.round(minTemp)) - 1, (int) (Math.round(maxTemp)) + 1);
    lineChartView.setStep(2);
    lineChartView.setXAxis(false);
    lineChartView.setYAxis(false);

    lineChartView.show();
}
 
开发者ID:martykan,项目名称:forecastie,代码行数:41,代码来源:GraphActivity.java

示例5: rainGraph

import com.db.chart.view.LineChartView; //导入方法依赖的package包/类
private void rainGraph() {
    LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_rain);

    // Data
    LineSet dataset = new LineSet();
    for (int i = 0; i < weatherList.size(); i++) {
        float rain = Float.parseFloat(weatherList.get(i).getRain());

        if (rain < minRain) {
            minRain = rain;
        }

        if (rain > maxRain) {
            maxRain = rain;
        }

        dataset.addPoint(getDateLabel(weatherList.get(i), i), rain);
    }
    dataset.setSmooth(false);
    dataset.setColor(Color.parseColor("#2196F3"));
    dataset.setThickness(4);

    lineChartView.addData(dataset);

    // Grid
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setColor(Color.parseColor("#333333"));
    paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
    paint.setStrokeWidth(1);
    lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
    lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
    lineChartView.setAxisBorderValues(0, (int) (Math.round(maxRain)) + 1);
    lineChartView.setStep(1);
    lineChartView.setXAxis(false);
    lineChartView.setYAxis(false);

    lineChartView.show();
}
 
开发者ID:martykan,项目名称:forecastie,代码行数:41,代码来源:GraphActivity.java


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