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


Java BarDataSet.setValueTextColor方法代码示例

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


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

示例1: generateBarData

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * 柱形图数据
 */
private BarData generateBarData() {
    BarData barData = new BarData();
    ArrayList<BarEntry> entries1 = new ArrayList<>();
    for (int index = 0; index < items.size(); index++) {
        entries1.add(new BarEntry(index + 1f, (float) items.get(index).main_data.getData()));
    }
    BarDataSet barDataSet = new BarDataSet(entries1, "当前数据");
    barDataSet.setValues(entries1);
    barDataSet.setDrawValues(false);//是否在线上显示值
    barDataSet.setColor(Color.rgb(230, 230, 230));
    barDataSet.setHighLightColor(Color.parseColor(items.get(dateSelected).state.getColor()));
    barDataSet.setValueTextColor(Color.rgb(60, 220, 78));
    barDataSet.setValueTextSize(10f);
    barDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    float barWidth = 0.45f;
    barData.addDataSet(barDataSet);
    barData.setBarWidth(barWidth);
    return barData;
}
 
开发者ID:jay16,项目名称:shengyiplus-android,代码行数:23,代码来源:HomeTricsActivity.java

示例2: createActivitySet

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
protected BarDataSet createActivitySet(List<BarEntry> values, List<Integer> colors, String label) {
        BarDataSet set1 = new BarDataSet(values, label);
        set1.setColors(colors);
//        set1.setDrawCubic(true);
//        set1.setCubicIntensity(0.2f);
//        //set1.setDrawFilled(true);
//        set1.setDrawCircles(false);
//        set1.setLineWidth(2f);
//        set1.setCircleSize(5f);
//        set1.setFillColor(ColorTemplate.getHoloBlue());
        set1.setDrawValues(false);
//        set1.setHighLightColor(Color.rgb(128, 0, 255));
//        set1.setColor(Color.rgb(89, 178, 44));
        set1.setValueTextColor(CHART_TEXT_COLOR);
        set1.setAxisDependency(YAxis.AxisDependency.LEFT);
        return set1;
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:18,代码来源:AbstractChartFragment.java

示例3: createLightSleepSet

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
protected BarDataSet createLightSleepSet(List<BarEntry> values, String label) {
        BarDataSet set1 = new BarDataSet(values, label);

//        set1.setDrawCubic(true);
//        set1.setCubicIntensity(0.2f);
//        //set1.setDrawFilled(true);
//        set1.setDrawCircles(false);
//        set1.setLineWidth(2f);
//        set1.setCircleSize(5f);
//        set1.setFillColor(ColorTemplate.getHoloBlue());
        set1.setDrawValues(false);
//        set1.setHighLightColor(Color.rgb(244, 117, 117));
//        set1.setColor(Color.rgb(182, 191, 255));
        set1.setValueTextColor(CHART_TEXT_COLOR);
//        set1.setColor(Color.CYAN);
        return set1;
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:18,代码来源:AbstractChartFragment.java

示例4: getBarData

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
private BarData getBarData(FinishedExercise finishedExercise) {
    List<FinishedSet> sets = finishedExercise.getSets();
    List<BarEntry> entries = new ArrayList<>();
    for (int i = 0; i < sets.size(); i++) {
        int reps = sets.get(i).getReps();
        int maxReps = sets.get(i).getMaxReps();
        int openReps = maxReps - reps;
        entries.add(new BarEntry(i, new float[]{reps, openReps}));
    }
    BarDataSet set = new BarDataSet(entries, "sets");
    int textColor = activity.getResources().getColor(R.color.primaryTextColor);
    set.setValueTextColor(textColor);
    set.setValueTextSize(12);
    set.setColors(getColors());
    BarData barData = new BarData(set);
    barData.setValueFormatter(new HideZeroValueFormatter());
    return barData;
}
 
开发者ID:avalax,项目名称:FitBuddy,代码行数:19,代码来源:FinishedExerciseAdapter.java

示例5: generateBarData

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

        ArrayList<BarEntry> entries1 = new ArrayList<BarEntry>();
        ArrayList<BarEntry> entries2 = new ArrayList<BarEntry>();

        for (int index = 0; index < itemcount; index++) {
            entries1.add(new BarEntry(0, getRandom(25, 25)));

            // stacked
            entries2.add(new BarEntry(0, new float[]{getRandom(13, 12), getRandom(13, 12)}));
        }

        BarDataSet set1 = new BarDataSet(entries1, "Bar 1");
        set1.setColor(Color.rgb(60, 220, 78));
        set1.setValueTextColor(Color.rgb(60, 220, 78));
        set1.setValueTextSize(10f);
        set1.setAxisDependency(YAxis.AxisDependency.LEFT);

        BarDataSet set2 = new BarDataSet(entries2, "");
        set2.setStackLabels(new String[]{"Stack 1", "Stack 2"});
        set2.setColors(new int[]{Color.rgb(61, 165, 255), Color.rgb(23, 197, 255)});
        set2.setValueTextColor(Color.rgb(61, 165, 255));
        set2.setValueTextSize(10f);
        set2.setAxisDependency(YAxis.AxisDependency.LEFT);

        float groupSpace = 0.06f;
        float barSpace = 0.02f; // x2 dataset
        float barWidth = 0.45f; // x2 dataset
        // (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per "group"

        BarData d = new BarData(set1, set2);
        d.setBarWidth(barWidth);

        // make this BarData object grouped
        d.groupBars(0, groupSpace, barSpace); // start at x = 0

        return d;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:CombinedChartActivity.java

示例6: onCreateView

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_historique_graph, container, false);

    // Gestion de l'affichage graphique
    rlGraphHistorique = (RelativeLayout) view.findViewById(R.id.rlGraphHistorique);
    graphiqueHistorique = new BarChart(getContext());
    final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    rlGraphHistorique.addView(graphiqueHistorique,lp);

    List<BarEntry> entries = getEntries(pointMesures);

    BarDataSet dataSet = new BarDataSet(entries, "Graphique Historique");
    //TODO : ne fonctionne pas avec le fichier de ressource colors
    dataSet.setColor(R.color.barColorGraph);
    dataSet.setValueTextColor(R.color.textColorGraph);


    BarData lineData = new BarData(dataSet);
    graphiqueHistorique.setData(lineData);
    graphiqueHistorique.getLegend().setEnabled(false);
    graphiqueHistorique.getDescription().setEnabled(false);
    graphiqueHistorique.invalidate(); // refresh

    return view;
}
 
开发者ID:MadiBreizh,项目名称:ATMO972,代码行数:28,代码来源:HistoriqueGraphFragment.java

示例7: showBarChart

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * 展示柱状图(多条)
 *
 * @param xAxisValues
 * @param yAxisValues
 * @param labels
 * @param colours
 */
public void showBarChart(List<Float> xAxisValues, List<List<Float>> yAxisValues, List<String> labels, List<Integer> colours) {
    initLineChart();
    BarData data = new BarData();
    for (int i = 0; i < yAxisValues.size(); i++) {
        ArrayList<BarEntry> entries = new ArrayList<>();
        for (int j = 0; j < yAxisValues.get(i).size(); j++) {

            entries.add(new BarEntry(xAxisValues.get(j), yAxisValues.get(i).get(j)));
        }
        BarDataSet barDataSet = new BarDataSet(entries, labels.get(i));

        barDataSet.setColor(colours.get(i));
        barDataSet.setValueTextColor(colours.get(i));
        barDataSet.setValueTextSize(10f);
        barDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
        data.addDataSet(barDataSet);
    }
    int amount = yAxisValues.size();

    float groupSpace = 0.12f; //柱状图组之间的间距
    float barSpace = (float) ((1 - 0.12) / amount / 10); // x4 DataSet
    float barWidth = (float) ((1 - 0.12) / amount / 10 * 9); // x4 DataSet

    // (0.2 + 0.02) * 4 + 0.08 = 1.00 -> interval per "group"
    xAxis.setLabelCount(xAxisValues.size() - 1, false);
    data.setBarWidth(barWidth);


    data.groupBars(0, groupSpace, barSpace);
    mBarChart.setData(data);
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:40,代码来源:BarChartManager.java

示例8: generateBarData

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
private BarData generateBarData(float index, float dis) {

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


        for (int i = 0; i < count; i++) {
            float a = new Random().nextInt(40) / 100f + 0.1f;
            float b = new Random().nextInt(40) / 100f + 0.1f;
            entries.add(new BarEntry(index, new float[]{a, b, 1 - a - b}));
            index += dis;
        }

        BarDataSet set = new BarDataSet(entries, "hello");
        set.setStackLabels(new String[]{"1", "2"});
        set.setColors(new int[]{Color.rgb(154, 209, 253), Color.rgb(254, 206, 121), Color.rgb(253, 136, 95)});
        set.setValueTextColor(Color.rgb(61, 165, 255));
        set.setValueTextSize(10f);
        set.setAxisDependency(YAxis.AxisDependency.LEFT);


        ArrayList<IBarDataSet> threebardata = new ArrayList<>();

        BarData d = new BarData(threebardata);
        d.setBarWidth(0.4f);
        d.setDrawValues(true);

        d.addDataSet(set);

        d.setValueFormatter(new IValueFormatter() {
            @Override
            public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
                return toPercentDecimalStr(value);
            }
        });
        return d;
    }
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:37,代码来源:MainActivity.java

示例9: getBarData

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
private BarData getBarData(List<String> xVals, List<BarEntry> barEntries) {
    final BarDataSet dataSet = new BarDataSet(barEntries, getContext().getString(R.string.servings));

    dataSet.setColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
    dataSet.setValueTextColor(ContextCompat.getColor(getContext(), android.R.color.white));
    dataSet.setValueTextSize(14);

    // We just want the value as an integer
    dataSet.setValueFormatter(new BarChartValueFormatter());

    return new BarData(xVals, dataSet);
}
 
开发者ID:nutritionfactsorg,项目名称:daily-dozen-android,代码行数:13,代码来源:LoadServingsHistoryTask.java

示例10: createDeepSleepSet

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
protected BarDataSet createDeepSleepSet(List<BarEntry> values, String label) {
        BarDataSet set1 = new BarDataSet(values, label);
//        set1.setDrawCubic(true);
//        set1.setCubicIntensity(0.2f);
//        //set1.setDrawFilled(true);
//        set1.setDrawCircles(false);
//        set1.setLineWidth(2f);
//        set1.setCircleSize(5f);
//        set1.setFillColor(ColorTemplate.getHoloBlue());
        set1.setDrawValues(false);
//        set1.setHighLightColor(Color.rgb(244, 117, 117));
//        set1.setColor(Color.rgb(76, 90, 255));
        set1.setValueTextColor(CHART_TEXT_COLOR);
        return set1;
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:16,代码来源:AbstractChartFragment.java

示例11: initGradeDistributionChart

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * Initializes the grade distribution bar chart.
 *
 * @param gradeDistribution array with grade distributions
 */
private void initGradeDistributionChart(int[] gradeDistribution) {
    // y-values
    ArrayList<BarEntry> yValues = new ArrayList<>();
    for(int i = 0; i < gradeDistribution.length; i++) {
        yValues.add(new BarEntry(gradeDistribution[i], i));
    }

    // x-values
    ArrayList<String> xValues = new ArrayList<>();
    xValues.add("1,0 - 1,3");
    xValues.add("1,7 - 2,3");
    xValues.add("2,7 - 3,3");
    xValues.add("3,7 - 4,0");
    xValues.add("4,3 - 5,0");
    xValues.add("Andere");

    BarDataSet dataSet = new BarDataSet(yValues, "");
    dataSet.setValueTextSize(12);
    dataSet.setValueTextColor(ContextCompat.getColor(getContext(), R.color.text87));
    dataSet.setColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
    dataSet.setDrawValues(true);
    dataSet.setBarSpacePercent(35);

    BarData barData = new BarData(xValues, dataSet);
    barData.setValueFormatter(new DecimalValueFormatter("#"));
    barData.setHighlightEnabled(false);
    chartGradeDistribution.setData(barData);

    setChartStyle(chartGradeDistribution);
    chartGradeDistribution.getXAxis().setLabelsToSkip(0);
    chartGradeDistribution.invalidate();
}
 
开发者ID:MyGrades,项目名称:mygrades-app,代码行数:38,代码来源:FragmentStatistics.java

示例12: setDataS

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

        ArrayList<String> xVals = new ArrayList<String>();
        Collections.addAll(xVals, ltob);


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

        for (int i = 0; i < splHistogram.size(); i++) {
            yVals1.add(new BarEntry(splHistogram.get(i), i));
        }

        BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
        set1.setValueTextColor(Color.WHITE);

        set1.setColors(
                new int[]{Color.rgb(0, 128, 255), Color.rgb(0, 128, 255), Color.rgb(0, 128, 255),
                        Color.rgb(102, 178, 255), Color.rgb(102, 178, 255),
                        Color.rgb(102, 178, 255)});

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

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);
        data.setValueFormatter(new FreqValueFormater(sChart));
        sChart.setData(data);
        sChart.invalidate();
    }
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:30,代码来源:Results.java

示例13: onCreate

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cow_details);

        initGraphValuesListener();
        graphValuesQuery = null;
        pickDateButton = findViewById(R.id.pickDateButton);

        // Get the Intent that started this activity and extract the string
        Intent intent = getIntent();
        cowName = intent.getStringExtra(CowListingActivity.Message_CowName);
        cowId = intent.getStringExtra(CowListingActivity.Message_CowID);

        cowNameTextView = findViewById(R.id.cowNameTextView);

        if (cowName.isEmpty())
            cowNameTextView.setText(cowId);
        else
            cowNameTextView.setText(cowName);

        popupSelectedItemId = R.id.month;

        // in this example, a LineChart is initialized from xml
        chart = (BarChart) findViewById(R.id.chart);


/*        entries.add(new BarEntry(2, 2));
        entries.add(new BarEntry(3, 5));
        entries.add(new BarEntry(4, 4));
        BarEntry entr = new BarEntry(1, 10);
        entries.add(entr);*/

        /*List<BarEntry> graphEntries;
        graphEntries = ;*/
        BarDataSet dataSet = new BarDataSet(new ArrayList(), ""); // add entries to dataset
        dataSet.setColor(Color.RED);
        dataSet.setValueTextColor(Color.BLUE); // styling, ...

        BarData barData = new BarData(dataSet);
        chart.setData(barData);

        chart.getDescription().setEnabled(false);

        Calendar calendar = Calendar.getInstance();
        selectDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
    }
 
开发者ID:ekalyvio,项目名称:CowBit,代码行数:48,代码来源:CowDetailsActivity.java

示例14: generateBarData

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

        BarData d = new BarData();

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

        for (int index = 0; index < itemcount; index++)
            entries.add(new BarEntry(getRandom(15, 30), index));

        BarDataSet set = new BarDataSet(entries, "Bar DataSet");
        set.setColor(Color.rgb(60, 220, 78));
        set.setValueTextColor(Color.rgb(60, 220, 78));
        set.setValueTextSize(10f);
        d.addDataSet(set);

        set.setAxisDependency(YAxis.AxisDependency.LEFT);

        return d;
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:20,代码来源:CombinedChartActivity.java

示例15: showBarChart

import com.github.mikephil.charting.data.BarDataSet; //导入方法依赖的package包/类
/**
 * Shows the bar chart with data taken from an OverviewEvent.
 *
 * @param overviewEvent - overview event
 */
private void showBarChart(OverviewEvent overviewEvent) {
    // general layout settings
    barChart.setPinchZoom(false);
    barChart.setDoubleTapToZoomEnabled(false);
    barChart.setScaleEnabled(false);
    barChart.setDescription("");
    barChart.setDrawBorders(false);
    barChart.setDrawBarShadow(false);
    barChart.setDrawGridBackground(false);
    barChart.getLegend().setEnabled(false);

    // set x-axis
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setSpaceBetweenLabels(0);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawGridLines(false);
    xAxis.setTextColor(ContextCompat.getColor(this, R.color.text87));
    xAxis.setLabelsToSkip(0);

    // hide left y-axis
    barChart.getAxisLeft().setDrawGridLines(true);
    barChart.getAxisLeft().setDrawAxisLine(false);
    barChart.getAxisLeft().setDrawLabels(false);
    barChart.getAxisLeft().setGridColor(ContextCompat.getColor(this, R.color.divider));
    barChart.getAxisLeft().setLabelCount(6, true);

    // hide right y-axis
    barChart.getAxisRight().setDrawGridLines(false);
    barChart.getAxisRight().setDrawAxisLine(false);
    barChart.getAxisRight().setDrawLabels(false);

    Overview overview = overviewEvent.getOverview();

    // y-values
    ArrayList<BarEntry> yValues = new ArrayList<>();
    yValues.add(new BarEntry(overview.getSection1(), 0));
    yValues.add(new BarEntry(overview.getSection2(), 1));
    yValues.add(new BarEntry(overview.getSection3(), 2));
    yValues.add(new BarEntry(overview.getSection4(), 3));
    yValues.add(new BarEntry(overview.getSection5(), 4));

    // x-values
    ArrayList<String> xValues = new ArrayList<>();
    xValues.add("1,0 - 1,3");
    xValues.add("1,7 - 2,3");
    xValues.add("2,7 - 3,3");
    xValues.add("3,7 - 4,0");
    xValues.add("4,3 - 5,0");

    // set colors
    int[] BAR_CHART_COLORS = {COLOR_GRAY, COLOR_GRAY, COLOR_GRAY, COLOR_GRAY, COLOR_GRAY};
    if (overview.getUserSection() != null && overview.getUserSection() > 0) {
        BAR_CHART_COLORS[overview.getUserSection() - 1] = COLOR_HIGHLIGHT;
    }

    BarDataSet dataSet = new BarDataSet(yValues, "");
    dataSet.setValueTextSize(12);
    dataSet.setValueTextColor(ContextCompat.getColor(this, R.color.text87));
    dataSet.setColors(BAR_CHART_COLORS);
    dataSet.setDrawValues(true);
    dataSet.setBarSpacePercent(35);

    BarData barData = new BarData(xValues, dataSet);
    barData.setValueFormatter(new MyValueFormatter());
    barData.setHighlightEnabled(false);
    barChart.setData(barData);

    // add a nice and smooth animation
    barChart.animateY(1500);
    barChart.invalidate();
}
 
开发者ID:MyGrades,项目名称:mygrades-app,代码行数:78,代码来源:GradeDetailedActivity.java


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