本文整理匯總了Java中com.github.mikephil.charting.charts.BarChart.setLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.setLayoutParams方法的具體用法?Java BarChart.setLayoutParams怎麽用?Java BarChart.setLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.github.mikephil.charting.charts.BarChart
的用法示例。
在下文中一共展示了BarChart.setLayoutParams方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupTemperatureChart
import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupTemperatureChart(){
EnvStatistic temperature = mHDD.getSessionData().getCurrentStats().getTemperature();
if(temperature!=null && temperature.isValid()){
mTempChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) temperature.getMin(), 0));
statVals.add(new BarEntry((float) temperature.getAvg(), 1));
statVals.add(new BarEntry((float) temperature.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Temperature");
mTempChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mTempChart.setDescription("");
mTempChart.animateY(2000);
mTempChart.getAxisRight().setEnabled(false);
mTempChart.setTouchEnabled(false);
mTempChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mTempChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mTempChartContainer.addView(mTempChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Temperature Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mTempChartContainer.addView(noGraph);
}
}
示例2: setupPressureChart
import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupPressureChart(){
EnvStatistic pressure = mHDD.getSessionData().getCurrentStats().getPressure();
if(pressure!=null && pressure.isValid()){
mPressureChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) pressure.getMin(),0));
statVals.add(new BarEntry((float) pressure.getAvg(), 1));
statVals.add(new BarEntry((float) pressure.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Pressure");
mPressureChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mPressureChart.setDescription("");
mPressureChart.animateY(2000);
mPressureChart.getAxisRight().setEnabled(false);
mPressureChart.setTouchEnabled(false);
mPressureChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mPressureChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mPressureChartContainer.addView(mPressureChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Pressure Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mPressureChartContainer.addView(noGraph);
}
}
示例3: setupHumidityChart
import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupHumidityChart(){
EnvStatistic humidity = mHDD.getSessionData().getCurrentStats().getHumidity();
if(humidity!=null && humidity.isValid()){
mHumidityChart = new BarChart(this);
List<BarEntry> statVals = new ArrayList<>(3);
statVals.add(new BarEntry((float) humidity.getMin(), 0));
statVals.add(new BarEntry((float) humidity.getAvg(), 1));
statVals.add(new BarEntry((float) humidity.getMax(), 2));
BarDataSet summary = new BarDataSet(statVals,"Humidity");
mHumidityChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
mHumidityChart.setDescription("");
mHumidityChart.animateY(2000);
mHumidityChart.getAxisRight().setEnabled(false);
mHumidityChart.setTouchEnabled(false);
mHumidityChart.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mHumidityChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
mHumidityChartContainer.addView(mHumidityChart);
}
else{
TextView noGraph = new TextView(this);
noGraph.setText("No Humidity Statistics to Show");
noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
mHumidityChartContainer.addView(noGraph);
}
}