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


Java BarData.setValueTextColor方法代码示例

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


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

示例1: setData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData() {

        RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

        //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
        RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "xValue", "stackValues", "floatValue"); // stacked entries
        set.setColors(new int[]{ColorTemplate.rgb("#8BC34A"), ColorTemplate.rgb("#FFC107"), ColorTemplate.rgb("#9E9E9E")});
        set.setLabel("Mobile OS distribution");
        set.setStackLabels(new String[]{"iOS", "Android", "Other"});

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set); // add the dataset

        // create a data object with the dataset list
        BarData data = new BarData(dataSets);
        styleData(data);
        data.setValueTextColor(Color.WHITE);

        // set data
        mChart.setData(data);
        mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RealmDatabaseActivityHorizontalBar.java

示例2: createBarChartData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createBarChartData()
{
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setMinimumFractionDigits(0);
    numberFormat.setMaximumFractionDigits(2);

    mDashboardHelper = new DashboardHelper(getActivity());
    HashMap<String, ArrayList> holder = mDashboardHelper.generateTimesPerDayMap();

    ArrayList<String> xVals = holder.get("dayOfThisMonth");
    ArrayList<BarEntry> yVals1 = holder.get("episodesPerDay");

    BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
    set1.setColor(0xFF2196f3);
    set1.setBarSpacePercent(40f);

    ArrayList<IBarDataSet> dataSets = new ArrayList<>();
    dataSets.add(set1);

    BarData data = new BarData(xVals, dataSets);
    data.setValueTextSize(10);
    data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
    data.setValueTextColor(Color.WHITE);
    data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
            value));
    return data;
}
 
开发者ID:daviszhou,项目名称:BeaconTrackerAndroid,代码行数:28,代码来源:DashboardFragment.java

示例3: refreshWeekBeforeSteps

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private DefaultChartsData refreshWeekBeforeSteps(DBHandler db, CombinedChart combinedChart, Calendar day, GBDevice device) {

        ActivityAnalysis analysis = new ActivityAnalysis();

        day = (Calendar) day.clone(); // do not modify the caller's argument
        day.add(Calendar.DATE, -7);
        List<BarEntry> entries = new ArrayList<>();
        List<String> labels = new ArrayList<>();

        for (int counter = 0; counter < 7; counter++) {
            entries.add(new BarEntry(analysis.calculateTotalSteps(getSamplesOfDay(db, day, device)), counter));
            labels.add(day.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, mLocale));
            day.add(Calendar.DATE, 1);
        }

        BarDataSet set = new BarDataSet(entries, "");
        set.setColor(akActivity.color);

        BarData barData = new BarData(labels, set);
        barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);

        LimitLine target = new LimitLine(mTargetSteps);
        combinedChart.getAxisLeft().removeAllLimitLines();
        combinedChart.getAxisLeft().addLimitLine(target);

        CombinedData combinedData = new CombinedData(labels);
        combinedData.setData(barData);
        return new DefaultChartsData(combinedData);
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:30,代码来源:WeekStepsChartFragment.java

示例4: showAnalysis

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
public void showAnalysis(Report report) {
    List<BarEntry> barEntries = new ArrayList<>();
    List<Expense> expenses = report.getExpenses();

    for (int i = 0; i < expenses.size(); i++) {
        Expense expense = expenses.get(i);
        barEntries.add(new BarEntry(
                i,
                expense.getAmount().floatValue())
        );
    }
    BarDataSet barSet = new BarDataSet(barEntries, "");
    barSet.setColor(selectedCategory.getColor());

    List<IBarDataSet> dataSets = new ArrayList<>();
    dataSets.add(barSet);

    BarData data = new BarData(dataSets);
    data.setValueTextSize(10f);
    data.setValueTextColor(getOutlayTheme().secondaryTextColor);
    data.setBarWidth(0.9f);

    dayAxisValueFormatter.setExpenses(expenses);
    barChart.setData(data);
    barChart.invalidate();
    barChart.animateY(500);
}
 
开发者ID:bmelnychuk,项目名称:outlay,代码行数:29,代码来源:AnalysisFragment.java

示例5: createBarChartData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createBarChartData()
{
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setMinimumFractionDigits(0);
    numberFormat.setMaximumFractionDigits(2);

    ArrayList<String> xVals = new ArrayList<>();
    for(int i = 0; i < 12; i++)
    {
        xVals.add(i + "");
    }

    ArrayList<BarEntry> yVals1 = new ArrayList<>();

    for(int i = 0; i < 12; i++)
    {
        float mult = (5 + 1);
        int val = (int) (Math.random() * mult);
        yVals1.add(new BarEntry((val == 0 ? 1 : val), i));
    }

    BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
    set1.setColor(0xFF2196f3);
    set1.setBarSpacePercent(40f);

    ArrayList<IBarDataSet> dataSets = new ArrayList<>();
    dataSets.add(set1);

    BarData data = new BarData(xVals, dataSets);
    data.setValueTextSize(10);
    data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
    data.setValueTextColor(Color.WHITE);
    data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
            value));
    return data;
}
 
开发者ID:ResearchStack,项目名称:SampleApp,代码行数:37,代码来源:DashboardFragment.java

示例6: createStackedBarChartData

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createStackedBarChartData()
{
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setMinimumFractionDigits(0);
    numberFormat.setMaximumFractionDigits(2);

    ArrayList<String> xVals = new ArrayList<>();
    for(int i = 0; i < 12; i++)
    {
        xVals.add(i + "");
    }

    ArrayList<BarEntry> yVals1 = new ArrayList<>();

    for(int i = 0; i < 12; i++)
    {
        float mult = (5 + 1);
        int val = (int) (Math.random() * mult);
        yVals1.add(new BarEntry(new float[] {(val == 0 ? 1 : val - 1), 1}, i));
    }

    BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
    set1.setColors(new int[] {0xFF2196f3, 0xFF3f51b5});
    set1.setBarSpacePercent(40f);

    ArrayList<IBarDataSet> dataSets = new ArrayList<>();
    dataSets.add(set1);

    BarData data = new BarData(xVals, dataSets);
    data.setValueTextSize(10);
    data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
    data.setValueTextColor(Color.WHITE);
    data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
            value));
    return data;
}
 
开发者ID:ResearchStack,项目名称:SampleApp,代码行数:37,代码来源:DashboardFragment.java

示例7: getView

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {

            BarData data = getItem(position);

            ViewHolder holder = null;

            if (convertView == null) {

                holder = new ViewHolder();

                convertView = LayoutInflater.from(getContext()).inflate(
                        R.layout.list_item_barchart, null);
                holder.chart = (BarChart) convertView.findViewById(R.id.chart);

                convertView.setTag(holder);

            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            // apply styling
            data.setValueTypeface(mTfLight);
            data.setValueTextColor(Color.BLACK);
            holder.chart.getDescription().setEnabled(false);
            holder.chart.setDrawGridBackground(false);

            XAxis xAxis = holder.chart.getXAxis();
            xAxis.setPosition(XAxisPosition.BOTTOM);
            xAxis.setTypeface(mTfLight);
            xAxis.setDrawGridLines(false);
            
            YAxis leftAxis = holder.chart.getAxisLeft();
            leftAxis.setTypeface(mTfLight);
            leftAxis.setLabelCount(5, false);
            leftAxis.setSpaceTop(15f);
            
            YAxis rightAxis = holder.chart.getAxisRight();
            rightAxis.setTypeface(mTfLight);
            rightAxis.setLabelCount(5, false);
            rightAxis.setSpaceTop(15f);

            // set data
            holder.chart.setData(data);
            holder.chart.setFitBars(true);
            
            // do not forget to refresh the chart
//            holder.chart.invalidate();
            holder.chart.animateY(700);

            return convertView;
        }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:53,代码来源:ListViewBarChartActivity.java

示例8: getView

import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {

            BarData data = getItem(position);

            ViewHolder holder = null;

            if (convertView == null) {

                holder = new ViewHolder();

                convertView = LayoutInflater.from(getContext()).inflate(
                        R.layout.list_item_barchart, null);
                holder.chart = (BarChart) convertView.findViewById(R.id.chart);

                convertView.setTag(holder);

            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            // apply styling
            data.setValueTypeface(mTf);
            data.setValueTextColor(Color.BLACK);
            holder.chart.setDescription("");
            holder.chart.setDrawGridBackground(false);

            XAxis xAxis = holder.chart.getXAxis();
            xAxis.setPosition(XAxisPosition.BOTTOM);
            xAxis.setTypeface(mTf);
            xAxis.setDrawGridLines(false);
            
            YAxis leftAxis = holder.chart.getAxisLeft();
            leftAxis.setTypeface(mTf);
            leftAxis.setLabelCount(5, false);
            leftAxis.setSpaceTop(15f);
            
            YAxis rightAxis = holder.chart.getAxisRight();
            rightAxis.setTypeface(mTf);
            rightAxis.setLabelCount(5, false);
            rightAxis.setSpaceTop(15f);

            // set data
            holder.chart.setData(data);
            
            // do not forget to refresh the chart
//            holder.chart.invalidate();
            holder.chart.animateY(700, Easing.EasingOption.EaseInCubic);

            return convertView;
        }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:52,代码来源:ListViewBarChartActivity.java


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