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


Java LineDataSet.setFillDrawable方法代码示例

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


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

示例1: styleChartLines

import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
/**
 * Style char lines (type, color, etc.).
 *
 * @param entries list of entries.
 * @return line data chart.
 */
private LineData styleChartLines(List<Entry> entries) {
    // Set styles
    LineDataSet lineDataSet = new LineDataSet(entries, "Recording");
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
    lineDataSet.setCubicIntensity(0.2f);
    lineDataSet.setDrawValues(false);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setLineWidth(1.8f);
    lineDataSet.setColor(ContextCompat.getColor(context, R.color.colorAccent));
    if (((int) lineDataSet.getYMax()) != 0) {
        lineDataSet.setDrawFilled(true);
        lineDataSet.setFillAlpha(255);
        // Fix bug with vectors in API < 21
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){
            Drawable drawable = ResourcesCompat.getDrawable(context.getResources(),
                    R.drawable.chart_fade, null);
            lineDataSet.setFillDrawable(drawable);
        } else{
            lineDataSet.setFillColor(ContextCompat.getColor(context, R.color.colorPrimary));
        }
    }
    return new LineData(lineDataSet);
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:30,代码来源:RecordingsAdapter.java

示例2: generateLineDataSet

import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet generateLineDataSet(List<Entry> yVals, int color) {
    // create a dataset and give it a type
    LineDataSet set1 = new LineDataSet(yVals, "");
    List<Integer> colors = new ArrayList<>();

    if (color == getResources().getColor(R.color.glucosio_pink)) {
        for (Entry yVal : yVals) {
            if (yVal.getVal() == (0)) {
                colors.add(Color.TRANSPARENT);
            } else {
                colors.add(color);
            }
        }
        set1.setCircleColors(colors);
    } else {
        set1.setCircleColor(color);
    }

    set1.setColor(color);
    set1.setLineWidth(2f);
    set1.setCircleSize(4f);
    set1.setDrawCircleHole(true);
    set1.disableDashedLine();
    set1.setFillAlpha(255);
    set1.setDrawFilled(true);
    set1.setValueTextSize(0);
    set1.setValueTextColor(Color.parseColor("#FFFFFF"));
    set1.setFillDrawable(getResources().getDrawable(R.drawable.graph_gradient));
    set1.setHighLightColor(getResources().getColor(R.color.glucosio_gray_light));
    set1.setCubicIntensity(0.2f);

    // TODO: Change this to true when a fix is available
    // https://github.com/PhilJay/MPAndroidChart/issues/1541
    set1.setDrawCubic(false);

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        set1.setDrawFilled(false);
        set1.setLineWidth(2f);
        set1.setCircleSize(4f);
        set1.setDrawCircleHole(true);
    }

    return set1;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:45,代码来源:OverviewFragment.java

示例3: setData

import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {

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

        ArrayList<Entry> yVals = new ArrayList<Entry>();

        for (int i = 0; i < count; i++) {

            float mult = (range + 1);
            float val = (float) (Math.random() * mult) + 3;// + (float)
            // ((mult *
            // 0.1) / 10);
            yVals.add(new Entry(val, i));
        }

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
        // set1.setFillAlpha(110);
        // set1.setFillColor(Color.RED);

        // set the line to be drawn like this "- - - - - -"
        set1.enableDashedLine(10f, 5f, 0f);
        set1.enableDashedHighlightLine(10f, 5f, 0f);
        set1.setColor(Color.BLACK);
        set1.setCircleColor(Color.BLACK);
        set1.setLineWidth(1f);
        set1.setCircleRadius(3f);
        set1.setDrawCircleHole(false);
        set1.setValueTextSize(9f);
        Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
        set1.setFillDrawable(drawable);
        set1.setDrawFilled(true);

        ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>();
        dataSets.add(set1); // add the datasets

        // create a data object with the datasets
        LineData data = new LineData(xVals, dataSets);

        // set data
        mChart.setData(data);
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:46,代码来源:LineChartActivity1.java


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