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


Java ILineDataSet类代码示例

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


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

示例1: drawDataSet

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, ILineDataSet dataSet) {

        if (dataSet.getEntryCount() < 1)
            return;

        mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
        mRenderPaint.setPathEffect(dataSet.getDashPathEffect());

        switch (dataSet.getMode()) {
            default:
            case LINEAR:
            case STEPPED:
                drawLinear(c, dataSet);
                break;

            case CUBIC_BEZIER:
                drawCubicBezier(dataSet);
                break;

            case HORIZONTAL_BEZIER:
                drawHorizontalBezier(dataSet);
                break;
        }

        mRenderPaint.setPathEffect(null);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:LineChartRenderer.java

示例2: drawCubicFill

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
protected void drawCubicFill(Canvas c, ILineDataSet dataSet, Path spline, Transformer trans, XBounds bounds) {

        float fillMin = dataSet.getFillFormatter()
                .getFillLinePosition(dataSet, mChart);

        spline.lineTo(dataSet.getEntryForIndex(bounds.min + bounds.range).getX(), fillMin);
        spline.lineTo(dataSet.getEntryForIndex(bounds.min).getX(), fillMin);
        spline.close();

        trans.pathValueToPixel(spline);

        final Drawable drawable = dataSet.getFillDrawable();
        if (drawable != null) {

            drawFilledPath(c, spline, drawable);
        } else {

            drawFilledPath(c, spline, dataSet.getFillColor(), dataSet.getFillAlpha());
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:LineChartRenderer.java

示例3: init

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
/**
 * Sets up the cache, returns true if a change of cache was required.
 *
 * @param set
 * @return
 */
protected boolean init(ILineDataSet set) {

    int size = set.getCircleColorCount();
    boolean changeRequired = false;

    if (circleBitmaps == null) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    } else if (circleBitmaps.length != size) {
        circleBitmaps = new Bitmap[size];
        changeRequired = true;
    }

    return changeRequired;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:LineChartRenderer.java

示例4: generateLineData

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

示例5: removeLastEntry

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
private void removeLastEntry() {

        LineData data = mChart.getData();

        if (data != null) {

            ILineDataSet set = data.getDataSetByIndex(0);

            if (set != null) {

                Entry e = set.getEntryForXValue(set.getEntryCount() - 1, Float.NaN);

                data.removeEntry(e, 0);
                // or remove by index
                // mData.removeEntryByXValue(xIndex, dataSetIndex);
                data.notifyDataChanged();
                mChart.notifyDataSetChanged();
                mChart.invalidate();
            }
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DynamicalAddingActivity.java

示例6: setData

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

示例7: generateDataLine

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
/**
 * generates a random ChartData object with just one DataSet
 *
 * @return
 */

private LineData generateDataLine(float[] datas, String type) {

    ArrayList<Entry> entryList = new ArrayList<Entry>();
    for (int i = 0; i < datas.length; i++) {
        entryList.add(new Entry(i, datas[i]));
    }

    LineDataSet d1 = new LineDataSet(entryList, "DataSet :" + type);
    d1.setLineWidth(2.5f);
    Random r = new Random();
    d1.setHighLightColor(Color.rgb(r.nextInt(256), r.nextInt(256), r.nextInt(256)));
    d1.setDrawValues(false);

    ArrayList<ILineDataSet> sets = new ArrayList<>();
    sets.add(d1);

    return new LineData(sets);
}
 
开发者ID:Ksj7,项目名称:Rabbitqueue,代码行数:25,代码来源:MainActivity.java

示例8: buildLineData

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

示例9: getData

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
private LineData getData(ArrayList<Entry> yVals) {
    LineDataSet set1 = new LineDataSet(yVals, "");
    set1.setLineWidth(1.45f);
    set1.setColor(Color.argb(240, 255, 255, 255));
    set1.setCircleColor(Color.WHITE);
    set1.setHighLightColor(Color.WHITE);
    set1.setFillColor(getResources().getColor(R.color.chartFilled));
    set1.setDrawCircles(false);
    set1.setDrawValues(false);
    set1.setDrawFilled(true);
    set1.setFillFormatter(new IFillFormatter() {
        @Override
        public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
            return priceChart.getAxisLeft().getAxisMinimum();
        }
    });

    LineData data = new LineData(set1);
    return data;
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:21,代码来源:FragmentPrice.java

示例10: addEntry

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
private void addEntry(String label, int value) {
    LineData data = chart.getData();
    if (data != null) {
        int index;
        if (label.equals(pm1Label)) {
            index = 0;
        } else if (label.equals(pm25Label)) {
            index = 1;
        } else {
            index = 2;
        }
        ILineDataSet set = data.getDataSetByIndex(index);

        if (set == null) {
            set = createSet(label);
            data.addDataSet(set);
        }

        data.addEntry(new Entry(set.getEntryCount(), value), index);
    }
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:22,代码来源:ChartFragment.java

示例11: addEntry

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
private void addEntry(int db) {

        LineData data = mLineChart.getData();

        if (data != null) {

            ILineDataSet set = data.getDataSetByIndex(0);
            // set.addEntry(...); // can be called as well

            if (set == null) {
                set = createSet();
                data.addDataSet(set);
            }

            data.addEntry(new Entry(set.getEntryCount(), db), 0);
            data.notifyDataChanged();

            // let the chart know it's data has changed
            mLineChart.notifyDataSetChanged();

            // limit the number of visible entries
            mLineChart.setVisibleXRangeMaximum(60);
            //mLineChart.setVisibleYRange(30, AxisDependency.LEFT);

            // move to the latest entry
            mLineChart.moveViewToX(data.getEntryCount());

        }
    }
 
开发者ID:Alex-ZHOU,项目名称:VMAndroid,代码行数:30,代码来源:RecordDBFragment.java

示例12: setData

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

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

        RealmLineDataSet<RealmDemoData> set = new RealmLineDataSet<RealmDemoData>(result, "value", "xIndex");
//        set.setDrawCubic(false);
        set.setLabel("次数");
//        set.setDrawCircleHole(false);
        set.setColor(getResourcesColor(R.color.gold));
        set.setCircleColor(getResourcesColor(R.color.gold));
        set.setHighLightColor(Color.WHITE);
        set.setLineWidth(1.8f);
        set.setCircleSize(3.6f);
        set.setValueTextColor(Color.WHITE);

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

        // create a data object with the dataset list
        RealmLineData data = new RealmLineData(result, "xValue", dataSets);
        styleData(data);

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

示例13: initLine

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
/**
 * 初始化线
 */
private void initLine() {
    RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
    RealmLineDataSet<RealmDemoData> set = new RealmLineDataSet<RealmDemoData>(result, "value", "xIndex");
    set.setLabel("次数");
    set.setColor(getResourcesColor(R.color.gold));
    set.setCircleColor(getResourcesColor(R.color.gold));
    set.setHighLightColor(Color.WHITE);
    set.setLineWidth(1.8f);
    set.setCircleSize(3.6f);
    set.setValueTextColor(Color.WHITE);
    ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>();
    dataSets.add(set); // add the dataset
    RealmLineData data = new RealmLineData(result, "xValue", dataSets);
    styleData(data);
    mChart.setData(data);
    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
 
开发者ID:dscn,项目名称:ktball,代码行数:21,代码来源:SchoolAllPeopleDetailAcitivty.java

示例14: drawDataSet

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, ILineDataSet dataSet) {

        if (dataSet.getEntryCount() < 1)
            return;

        mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
        mRenderPaint.setPathEffect(dataSet.getDashPathEffect());

        // if drawing cubic lines is enabled
        if (dataSet.isDrawCubicEnabled()) {

            drawCubic(c, dataSet);

            // draw normal (straight) lines
        } else {
            drawLinear(c, dataSet);
        }

        mRenderPaint.setPathEffect(null);
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:21,代码来源:LineChartRenderer.java

示例15: drawLinearFill

import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; //导入依赖的package包/类
protected void drawLinearFill(Canvas c, ILineDataSet dataSet, int minx,
                              int maxx,
                              Transformer trans) {

    Path filled = generateFilledPath(
            dataSet, minx, maxx);

    trans.pathValueToPixel(filled);

    final Drawable drawable = dataSet.getFillDrawable();
    if (drawable != null) {

        drawFilledPath(c, filled, drawable);
    } else {

        drawFilledPath(c, filled, dataSet.getFillColor(), dataSet.getFillAlpha());
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:19,代码来源:LineChartRenderer.java


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