當前位置: 首頁>>代碼示例>>Java>>正文


Java LineDataSet.setColor方法代碼示例

本文整理匯總了Java中com.github.mikephil.charting.data.LineDataSet.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java LineDataSet.setColor方法的具體用法?Java LineDataSet.setColor怎麽用?Java LineDataSet.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.mikephil.charting.data.LineDataSet的用法示例。


在下文中一共展示了LineDataSet.setColor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
protected LineData generateLineData() {
    
    ArrayList<ILineDataSet> sets = new ArrayList<ILineDataSet>();
    
    LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "sine.txt"), "Sine function");
    LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "cosine.txt"), "Cosine function");
    
    ds1.setLineWidth(2f);
    ds2.setLineWidth(2f);
    
    ds1.setDrawCircles(false);
    ds2.setDrawCircles(false);
    
    ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);
    
    // load DataSets from textfiles in assets folders
    sets.add(ds1);
    sets.add(ds2);
    
    LineData d = new LineData(sets);
    d.setValueTypeface(tf);
    return d;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:SimpleFragment.java

示例2: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData generateLineData() {

        LineData d = new LineData();

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

        for (int index = 0; index < itemcount; index++)
            entries.add(new Entry(index + 0.5f, getRandom(15, 5)));

        LineDataSet set = new LineDataSet(entries, "Line DataSet");
        set.setColor(Color.rgb(240, 238, 70));
        set.setLineWidth(2.5f);
        set.setCircleColor(Color.rgb(240, 238, 70));
        set.setCircleRadius(5f);
        set.setFillColor(Color.rgb(240, 238, 70));
        set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
        set.setDrawValues(true);
        set.setValueTextSize(10f);
        set.setValueTextColor(Color.rgb(240, 238, 70));

        set.setAxisDependency(YAxis.AxisDependency.LEFT);
        d.addDataSet(set);

        return d;
    }
 
開發者ID:igrow-systems,項目名稱:igrow-android,代碼行數:26,代碼來源:EnvironmentalSensorDetailFragment.java

示例3: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet() {

        LineDataSet set = new LineDataSet(null, "Dynamic Data");
        set.setAxisDependency(AxisDependency.LEFT);
        set.setColor(ColorTemplate.getHoloBlue());
        set.setCircleColor(Color.WHITE);
        set.setLineWidth(2f);
        set.setCircleRadius(4f);
        set.setFillAlpha(65);
        set.setFillColor(ColorTemplate.getHoloBlue());
        set.setHighLightColor(Color.rgb(244, 117, 117));
        set.setValueTextColor(Color.WHITE);
        set.setValueTextSize(9f);
        set.setDrawValues(false);
        return set;
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:RealtimeLineChartActivity.java

示例4: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet(String label) {
    LineDataSet set = new LineDataSet(null, label);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    int color;
    if (label.equals(pm1Label)) {
        color = Color.BLUE;
    } else if (label.equals(pm25Label)) {
        color = Color.RED;
    } else {
        color = Color.BLACK;
    }
    set.setColor(color);
    set.setLineWidth(2f);
    set.setDrawValues(false);
    set.setDrawCircles(false);
    set.setMode(LineDataSet.Mode.LINEAR);
    return set;
}
 
開發者ID:rjaros87,項目名稱:pm-home-station,代碼行數:19,代碼來源:ChartFragment.java

示例5: buildLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData buildLineData(List<Entry> seniors, List<Entry> engineer,
                               List<Entry> juniors, String[] jobTitles ){
    List<ILineDataSet> sets = new ArrayList<>();
    if (!seniors.isEmpty()){
        LineDataSet dSenior = buildLineDataSet(seniors, jobTitles[0]);
        sets.add(dSenior);
    }
    if (!engineer.isEmpty()){
        LineDataSet dEngineer = buildLineDataSet(engineer, jobTitles[1]);
        dEngineer.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        dEngineer.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        sets.add(dEngineer);
    }
    if (!juniors.isEmpty()) {
        LineDataSet dJunior = buildLineDataSet(juniors, jobTitles[2]);
        dJunior.setColor(ColorTemplate.VORDIPLOM_COLORS[2]);
        dJunior.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[2]);
        sets.add(dJunior);//add data
    }
    return  new LineData(sets);
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:22,代碼來源:DataBaseHelper.java

示例6: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
 * Generate line data line data.
 *
 * @return the line data
 */
protected LineData generateLineData() {

    ArrayList<ILineDataSet> sets = new ArrayList<ILineDataSet>();

    LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "sine.txt"), "Sine function");
    LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "cosine.txt"), "Cosine function");

    ds1.setLineWidth(2f);
    ds2.setLineWidth(2f);

    ds1.setDrawCircles(false);
    ds2.setDrawCircles(false);

    ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);

    // load DataSets from textfiles in assets folders
    sets.add(ds1);
    sets.add(ds2);

    LineData d = new LineData(sets);
    d.setValueTypeface(tf);
    return d;
}
 
開發者ID:bounswe,項目名稱:bounswe2016group2,代碼行數:30,代碼來源:userHomeFragment.java

示例7: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet() {

        LineDataSet set = new LineDataSet(null, getString(R.string.app_name));
        set.setAxisDependency(YAxis.AxisDependency.LEFT);
        set.setColor(ColorTemplate.getHoloBlue());
        set.setCircleColor(Color.WHITE);
        set.setLineWidth(1f);
        set.setCircleRadius(1.5f);
        set.setFillAlpha(65);
        set.setFillColor(ColorTemplate.getHoloBlue());
        set.setHighLightColor(Color.rgb(244, 117, 117));
        set.setValueTextColor(Color.WHITE);
        set.setValueTextSize(9f);
        set.setDrawValues(false);
        return set;
    }
 
開發者ID:Alex-ZHOU,項目名稱:VMAndroid,代碼行數:17,代碼來源:StoreDbRecordFragment.java

示例8: createLineChartData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
public LineData createLineChartData()
{
    mDashboardHelper = new DashboardHelper(getActivity());
    HashMap<String, ArrayList> holder = mDashboardHelper.generateBeaconTotalDurationPerDayMap();

    ArrayList<String> xValues = holder.get("dayOfThisMonth");
    ArrayList<Entry> entries = holder.get("totalDurationPerDay");

    LineDataSet set = new LineDataSet(entries, "");
    set.setCircleColor(0xFF2196f3);
    set.setCircleRadius(4f);
    set.setDrawCircleHole(false);
    set.setColor(0xFF2196f3);
    set.setLineWidth(2f);
    set.setDrawValues(false);

    return new LineData(xValues, set);
}
 
開發者ID:daviszhou,項目名稱:BeaconTrackerAndroid,代碼行數:19,代碼來源:DashboardFragment.java

示例9: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
 * 曲線
 */
private LineData generateLineData() {
    LineData lineData = new LineData();
    ArrayList<Entry> entries = new ArrayList<>();
    for (int index = 0; index < items.size(); index++) {
        entries.add(new Entry(index + 1f, (float) items.get(index).sub_data.getData()));
    }
    LineDataSet lineDataSet = new LineDataSet(entries, "對比數據");
    lineDataSet.setValues(entries);
    lineDataSet.setDrawValues(false);//是否在線上顯示值
    lineDataSet.setColor(ContextCompat.getColor(mContext, R.color.co3));
    lineDataSet.setLineWidth(2.5f);
    lineDataSet.setCircleColor(ContextCompat.getColor(mContext, R.color.co3));
    lineDataSet.setCircleRadius(5f);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);//設置線條類型
    //set.setDrawHorizontalHighlightIndicator(false);//隱藏選中線
    //set.setDrawVerticalHighlightIndicator(false);//隱藏選中線條
    lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    lineDataSet.setHighlightEnabled(false);
    lineData.setHighlightEnabled(false);
    lineData.addDataSet(lineDataSet);
    return lineData;
}
 
開發者ID:jay16,項目名稱:shengyiplus-android,代碼行數:27,代碼來源:HomeTricsActivity.java

示例10: 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

示例11: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet() {
    LineDataSet set = new LineDataSet(null, "BG Data");
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    set.setColor(ColorTemplate.getHoloBlue());
    set.setCircleColor(Color.WHITE);
    set.setLineWidth(2f);
    set.setCircleRadius(3f);
    set.setFillAlpha(65);
    set.setFillColor(ColorTemplate.getHoloBlue());
    set.setHighLightColor(Color.rgb(244, 117, 117));
    set.setValueTextColor(Color.WHITE);
    set.setValueTextSize(9f);
    set.setDrawValues(false);
    //set.setColors(ColorTemplate.COLORFUL_COLORS);
    //set.setColors(ColorTemplate.VORDIPLOM_COLORS);
    //set.setColors(ColorTemplate.JOYFUL_COLORS);
    //set.setColors(ColorTemplate.LIBERTY_COLORS);
    //set.setColors(ColorTemplate.PASTEL_COLORS);
    //set.setDrawCubic(chartcubic);
    return set;
}
 
開發者ID:LadyViktoria,項目名稱:wearDrip,代碼行數:22,代碼來源:wearDripWatchFace.java

示例12: getComplexity

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
protected LineData getComplexity() {
    
    ArrayList<ILineDataSet> sets = new ArrayList<ILineDataSet>();
    
    LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "n.txt"), "O(n)");
    LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "nlogn.txt"), "O(nlogn)");
    LineDataSet ds3 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "square.txt"), "O(n\u00B2)");
    LineDataSet ds4 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "three.txt"), "O(n\u00B3)");
    
    ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);
    ds3.setColor(ColorTemplate.VORDIPLOM_COLORS[2]);
    ds4.setColor(ColorTemplate.VORDIPLOM_COLORS[3]);
    
    ds1.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[1]);
    ds3.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[2]);
    ds4.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[3]);
    
    ds1.setLineWidth(2.5f);
    ds1.setCircleRadius(3f);
    ds2.setLineWidth(2.5f);
    ds2.setCircleRadius(3f);
    ds3.setLineWidth(2.5f);
    ds3.setCircleRadius(3f);
    ds4.setLineWidth(2.5f);
    ds4.setCircleRadius(3f);
    
    
    // load DataSets from textfiles in assets folders
    sets.add(ds1);        
    sets.add(ds2);
    sets.add(ds3);
    sets.add(ds4);
    
    LineData d = new LineData(sets);
    d.setValueTypeface(tf);
    return d;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:40,代碼來源:SimpleFragment.java

示例13: addDataSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private void addDataSet() {

        LineData data = mChart.getData();

        if (data != null) {

            int count = (data.getDataSetCount() + 1);

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

            for (int i = 0; i < data.getEntryCount(); i++) {
                yVals.add(new Entry(i, (float) (Math.random() * 50f) + 50f * count));
            }

            LineDataSet set = new LineDataSet(yVals, "DataSet " + count);
            set.setLineWidth(2.5f);
            set.setCircleRadius(4.5f);

            int color = mColors[count % mColors.length];

            set.setColor(color);
            set.setCircleColor(color);
            set.setHighLightColor(color);
            set.setValueTextSize(10f);
            set.setValueTextColor(color);

            data.addDataSet(set);
            data.notifyDataChanged();
            mChart.notifyDataSetChanged();
            mChart.invalidate();
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:DynamicalAddingActivity.java

示例14: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet() {

        LineDataSet set = new LineDataSet(null, "DataSet 1");
        set.setLineWidth(2.5f);
        set.setCircleRadius(4.5f);
        set.setColor(Color.rgb(240, 99, 99));
        set.setCircleColor(Color.rgb(240, 99, 99));
        set.setHighLightColor(Color.rgb(190, 190, 190));
        set.setAxisDependency(AxisDependency.LEFT);
        set.setValueTextSize(10f);

        return set;
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:DynamicalAddingActivity.java

示例15: getData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData getData(int count, float range) {

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

        for (int i = 0; i < count; i++) {
            float val = (float) (Math.random() * range) + 3;
            yVals.add(new Entry(i, val));
        }

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

        set1.setLineWidth(1.75f);
        set1.setCircleRadius(5f);
        set1.setCircleHoleRadius(2.5f);
        set1.setColor(Color.WHITE);
        set1.setCircleColor(Color.WHITE);
        set1.setHighLightColor(Color.WHITE);
        set1.setDrawValues(false);

        // create a data object with the datasets
        LineData data = new LineData(set1);

        return data;
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:LineChartActivityColored.java


注:本文中的com.github.mikephil.charting.data.LineDataSet.setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。