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