當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。