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


Java ColorTemplate类代码示例

本文整理汇总了Java中com.github.mikephil.charting.utils.ColorTemplate的典型用法代码示例。如果您正苦于以下问题:Java ColorTemplate类的具体用法?Java ColorTemplate怎么用?Java ColorTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: generateBarData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
protected BarData generateBarData(int dataSets, float range, int count) {
        
        ArrayList<IBarDataSet> sets = new ArrayList<IBarDataSet>();
        
        for(int i = 0; i < dataSets; i++) {
           
            ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
            
//            entries = FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "stacked_bars.txt");
            
            for(int j = 0; j < count; j++) {        
                entries.add(new BarEntry((float) (Math.random() * range) + range / 4, j));
            }
            
            BarDataSet ds = new BarDataSet(entries, getLabel(i));
            ds.setColors(ColorTemplate.VORDIPLOM_COLORS);
            sets.add(ds);
        }
        
        BarData d = new BarData(ChartData.generateXVals(0, count), sets);
        d.setValueTypeface(tf);
        return d;
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:24,代码来源:SimpleFragment.java

示例2: generatePieData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
/**
 * generates less data (1 DataSet, 4 values)
 * @return
 */
protected PieData generatePieData() {
    
    int count = 4;
    
    ArrayList<PieEntry> entries1 = new ArrayList<PieEntry>();
    
    for(int i = 0; i < count; i++) {
        entries1.add(new PieEntry((float) ((Math.random() * 60) + 40), "Quarter " + (i+1)));
    }
    
    PieDataSet ds1 = new PieDataSet(entries1, "Quarterly Revenues 2015");
    ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
    ds1.setSliceSpace(2f);
    ds1.setValueTextColor(Color.WHITE);
    ds1.setValueTextSize(12f);
    
    PieData d = new PieData(ds1);
    d.setValueTypeface(tf);

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

示例3: setData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
private void setData() {

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

        RealmPieDataSet<RealmDemoData> set = new RealmPieDataSet<RealmDemoData>(result, "yValue", "label");
        set.setColors(ColorTemplate.VORDIPLOM_COLORS);
        set.setLabel("Example market share");
        set.setSliceSpace(2);

        // create a data object with the dataset list
        PieData data = new PieData(set);
        styleData(data);
        data.setValueTextColor(Color.WHITE);
        data.setValueTextSize(12f);

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

示例4: setExtra

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
/**
 * Entries that will be appended to the end of the auto calculated
 *   entries after calculating the legend.
 * (if the legend has already been calculated, you will need to call notifyDataSetChanged()
 *   to let the changes take effect)
 */
public void setExtra(int[] colors, String[] labels) {

    List<LegendEntry> entries = new ArrayList<>();

    for (int i = 0; i < Math.min(colors.length, labels.length); i++) {
        final LegendEntry entry = new LegendEntry();
        entry.formColor = colors[i];
        entry.label = labels[i];

        if (entry.formColor == ColorTemplate.COLOR_SKIP ||
                entry.formColor == 0)
            entry.form = LegendForm.NONE;
        else if (entry.formColor == ColorTemplate.COLOR_NONE)
            entry.form = LegendForm.EMPTY;

        entries.add(entry);
    }

    mExtraEntries = entries.toArray(new LegendEntry[entries.size()]);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:Legend.java

示例5: generateBarData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
protected BarData generateBarData(int dataSets, float range, int count) {
        
        ArrayList<IBarDataSet> sets = new ArrayList<IBarDataSet>();
        
        for(int i = 0; i < dataSets; i++) {
           
            ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
            
//            entries = FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "stacked_bars.txt");
            
            for(int j = 0; j < count; j++) {        
                entries.add(new BarEntry(j, (float) (Math.random() * range) + range / 4));
            }
            
            BarDataSet ds = new BarDataSet(entries, getLabel(i));
            ds.setColors(ColorTemplate.VORDIPLOM_COLORS);
            sets.add(ds);
        }
        
        BarData d = new BarData(sets);
        d.setValueTypeface(tf);
        return d;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:SimpleFragment.java

示例6: generateScatterData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
protected ScatterData generateScatterData(int dataSets, float range, int count) {
    
    ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();
    
    ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes();
    
    for(int i = 0; i < dataSets; i++) {
       
        ArrayList<Entry> entries = new ArrayList<Entry>();
        
        for(int j = 0; j < count; j++) {        
            entries.add(new Entry(j, (float) (Math.random() * range) + range / 4));
        }
        
        ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
        ds.setScatterShapeSize(12f);
        ds.setScatterShape(shapes[i % shapes.length]);
        ds.setColors(ColorTemplate.COLORFUL_COLORS);
        ds.setScatterShapeSize(9f);
        sets.add(ds);
    }
    
    ScatterData d = new ScatterData(sets);
    d.setValueTypeface(tf);
    return d;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:SimpleFragment.java

示例7: generateLineData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的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

示例8: generateData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
/**
 * generates a random ChartData object with just one DataSet
 * 
 * @return
 */
private BarData generateData(int cnt) {

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

    for (int i = 0; i < 12; i++) {
        entries.add(new BarEntry(i, (float) (Math.random() * 70) + 30));
    }

    BarDataSet d = new BarDataSet(entries, "New DataSet " + cnt);
    d.setColors(ColorTemplate.VORDIPLOM_COLORS);
    d.setBarShadowColor(Color.rgb(203, 203, 203));
    
    ArrayList<IBarDataSet> sets = new ArrayList<IBarDataSet>();
    sets.add(d);
    
    BarData cd = new BarData(sets);
    cd.setBarWidth(0.9f);
    return cd;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:ListViewBarChartActivity.java

示例9: generateScatterData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
protected ScatterData generateScatterData() {

        ScatterData d = new ScatterData();

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

        for (float index = 0; index < itemcount; index += 0.5f)
            entries.add(new Entry(index + 0.25f, getRandom(10, 55)));

        ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet");
        set.setColors(ColorTemplate.MATERIAL_COLORS);
        set.setScatterShapeSize(7.5f);
        set.setDrawValues(false);
        set.setValueTextSize(10f);
        d.addDataSet(set);

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

示例10: generateBubbleData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
protected BubbleData generateBubbleData() {

        BubbleData bd = new BubbleData();

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

        for (int index = 0; index < itemcount; index++) {
            float y = getRandom(10, 105);
            float size = getRandom(100, 105);
            entries.add(new BubbleEntry(index + 0.5f, y, size));
        }

        BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
        set.setColors(ColorTemplate.VORDIPLOM_COLORS);
        set.setValueTextSize(10f);
        set.setValueTextColor(Color.WHITE);
        set.setHighlightCircleWidth(1.5f);
        set.setDrawValues(true);
        bd.addDataSet(set);

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

示例11: createSet

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的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

示例12: setData

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

        ArrayList<PieEntry> values = new ArrayList<PieEntry>();

        for (int i = 0; i < count; i++) {
            values.add(new PieEntry((float) ((Math.random() * range) + range / 5), mParties[i % mParties.length]));
        }

        PieDataSet dataSet = new PieDataSet(values, "Election Results");
        dataSet.setSliceSpace(3f);
        dataSet.setSelectionShift(5f);

        dataSet.setColors(ColorTemplate.MATERIAL_COLORS);
        //dataSet.setSelectionShift(0f);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter());
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.WHITE);
        data.setValueTypeface(mTfLight);
        mChart.setData(data);

        mChart.invalidate();
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:HalfPieChartActivity.java

示例13: setData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
private void setData() {

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

        RealmLineDataSet<RealmDemoData> set = new RealmLineDataSet<RealmDemoData>(result, "xValue", "yValue");
        set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
        set.setLabel("Realm LineDataSet");
        set.setDrawCircleHole(false);
        set.setColor(ColorTemplate.rgb("#FF5722"));
        set.setCircleColor(ColorTemplate.rgb("#FF5722"));
        set.setLineWidth(1.8f);
        set.setCircleRadius(3.6f);

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

        // create a data object with the dataset list
        LineData data = new LineData(dataSets);
        styleData(data);

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

示例14: setData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的package包/类
private void setData() {

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

        RealmBubbleDataSet<RealmDemoData> set = new RealmBubbleDataSet<RealmDemoData>(result, "xValue", "yValue", "bubbleSize");
        set.setLabel("Realm BubbleDataSet");
        set.setColors(ColorTemplate.COLORFUL_COLORS, 110);

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

        // create a data object with the dataset list
        BubbleData data = new BubbleData(dataSets);
        styleData(data);

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

示例15: setData

import com.github.mikephil.charting.utils.ColorTemplate; //导入依赖的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


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