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


Java BarChart.setLayoutParams方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:32,代码来源:ResultsActivity.java

示例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);
    }
}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:32,代码来源:ResultsActivity.java

示例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);
    }
}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:32,代码来源:ResultsActivity.java


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