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


Java LineData.getDataSetByIndex方法代码示例

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


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

示例1: removeLastEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的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

示例2: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的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

示例3: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的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

示例4: updateChart

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
public void updateChart(float value, int index) {
  LineData data = messagesChart.getData();
  ILineDataSet set = data.getDataSetByIndex(index);

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

  data.addEntry(new Entry(set.getEntryCount(), value), index);
  data.notifyDataChanged();

  messagesChart.notifyDataSetChanged();
  messagesChart.setVisibleXRangeMaximum(getVisibleRange().getRange());
  messagesChart.moveViewToX(data.getEntryCount());
}
 
开发者ID:tommus,项目名称:rabbitmq-management-android,代码行数:17,代码来源:MessagesIndicator.java

示例5: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void addEntry() {

        LineData data = mChart.getData();

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

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

        // choose a random dataSet
        int randomDataSetIndex = (int) (Math.random() * data.getDataSetCount());
        float yValue = (float) (Math.random() * 10) + 50f;

        data.addEntry(new Entry(data.getDataSetByIndex(randomDataSetIndex).getEntryCount(), yValue), randomDataSetIndex);
        data.notifyDataChanged();

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

        mChart.setVisibleXRangeMaximum(6);
        //mChart.setVisibleYRangeMaximum(15, AxisDependency.LEFT);
//            
//            // this automatically refreshes the chart (calls invalidate())
        mChart.moveViewTo(data.getEntryCount() - 7, 50f, AxisDependency.LEFT);

    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:DynamicalAddingActivity.java

示例6: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void addEntry() {

        LineData data = mChart.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(), (float) (Math.random() * 40) + 30f), 0);
            data.notifyDataChanged();

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

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

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

            // this automatically refreshes the chart (calls invalidate())
            // mChart.moveViewTo(data.getXValCount()-7, 55f,
            // AxisDependency.LEFT);
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:RealtimeLineChartActivity.java

示例7: initBuffers

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
@Override
public void initBuffers() {

    LineData lineData = mChart.getLineData();
    mLineBuffers = new LineBuffer[lineData.getDataSetCount()];
    mCircleBuffers = new CircleBuffer[lineData.getDataSetCount()];

    for (int i = 0; i < mLineBuffers.length; i++) {
        ILineDataSet set = lineData.getDataSetByIndex(i);
        mLineBuffers[i] = new LineBuffer(set.getEntryCount() * 4 - 4);
        mCircleBuffers[i] = new CircleBuffer(set.getEntryCount() * 2);
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:14,代码来源:LineChartRenderer.java

示例8: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void addEntry() {

        LineData data = mChart.getData();
        
        if(data != null) {

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

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

            // add a new x-value first
            data.addXValue(set.getEntryCount() + "");
            
            // choose a random dataSet
            int randomDataSetIndex = (int) (Math.random() * data.getDataSetCount());
            
            data.addEntry(new Entry((float) (Math.random() * 10) + 50f, set.getEntryCount()), randomDataSetIndex);

            // let the chart know it's data has changed
            mChart.notifyDataSetChanged();
            
            mChart.setVisibleXRangeMaximum(6);
            mChart.setVisibleYRangeMaximum(15, AxisDependency.LEFT);
//            
//            // this automatically refreshes the chart (calls invalidate())
            mChart.moveViewTo(data.getXValCount()-7, 50f, AxisDependency.LEFT);
        }
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:33,代码来源:DynamicalAddingActivity.java

示例9: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void addEntry() {

        LineData data = mChart.getData();

        if (data != null) {

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

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

            // add a new x-value first
            data.addXValue(mMonths[data.getXValCount() % 12] + " "
                    + (year + data.getXValCount() / 12));
            data.addEntry(new Entry((float) (Math.random() * 40) + 30f, set.getEntryCount()), 0);


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

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

            // move to the latest entry
            mChart.moveViewToX(data.getXValCount() - 121);

            // this automatically refreshes the chart (calls invalidate())
            // mChart.moveViewTo(data.getXValCount()-7, 55f,
            // AxisDependency.LEFT);
        }
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:36,代码来源:RealtimeLineChartActivity.java

示例10: runOnTick

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void runOnTick() {
    if (coreResult != null && liveGame != null && coreResult.getStatus() >= 2) {
        LineData lineData = mChart.getLineData();
        LineDataSet lineDataSet = lineData.getDataSetByIndex(0);
        long[] ticks = liveGame.getStats().get("tick");
        if (ticks != null) {
            switch (mSelectedStat) {
                case 0:
                    lineDataSet.setColor(getResources().getColor(R.color.gold));
                    for (int i = lineDataSet.getEntryCount(); i < ticks.length; i++) {
                        mTicks.add(String.valueOf(ticks[i]));
                        lineData.addEntry(
                                new Entry(
                                        liveGame.getRadiant().getStats().getNetGold()[i] - liveGame.getDire().getStats().getNetGold()[i],
                                        lineDataSet.getEntryCount()),
                                0);
                    }
                    break;
                case 1:
                    lineDataSet.setColor(getResources().getColor(R.color.xp));
                    for (int i = lineDataSet.getEntryCount(); i < ticks.length; i++) {
                        mTicks.add(String.valueOf(ticks[i]));
                        lineData.addEntry(
                                new Entry(
                                        liveGame.getRadiant().getStats().getNetExp()[i] - liveGame.getDire().getStats().getNetExp()[i],
                                        lineDataSet.getEntryCount()),
                                0);
                    }
                    break;
            }
        }
        mChart.notifyDataSetChanged();
        mChart.invalidate();
    }
}
 
开发者ID:mrprona92,项目名称:SecretBrand,代码行数:36,代码来源:Graphs.java

示例11: initBuffers

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
@Override
public void initBuffers() {

    LineData lineData = mChart.getLineData();
    mLineBuffers = new LineBuffer[lineData.getDataSetCount()];
    mCircleBuffers = new CircleBuffer[lineData.getDataSetCount()];

    for (int i = 0; i < mLineBuffers.length; i++) {
        LineDataSet set = lineData.getDataSetByIndex(i);
        mLineBuffers[i] = new LineBuffer(set.getEntryCount() * 4 - 4);
        mCircleBuffers[i] = new CircleBuffer(set.getEntryCount() * 2);
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:14,代码来源:LineChartRenderer.java

示例12: toggleSetVisibility

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
protected void toggleSetVisibility(int index) {
  LineData data = messagesChart.getData();
  ILineDataSet set = data.getDataSetByIndex(index);

  if (set == null) {
    return;
  }

  set.setVisible(!set.isVisible());
}
 
开发者ID:tommus,项目名称:rabbitmq-management-android,代码行数:11,代码来源:MessagesIndicator.java

示例13: addEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void addEntry(float entry) {

        LineData data = lchScope.getData();

        if (data != null) {

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

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

            Long tsLong = (System.currentTimeMillis() - relTime) / 1000;
            // if(tsLong != curTime) {
            data.addXValue(tsLong.toString());
            curTime = tsLong;
            //}

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

            lchScope.notifyDataSetChanged();
            lchScope.setVisibleXRangeMaximum(60);

            lchScope.moveViewToX(data.getXValCount() - 61);
        }
    }
 
开发者ID:MarcProe,项目名称:lp2go,代码行数:29,代码来源:ViewControllerScope.java

示例14: drawHighlighted

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    LineData lineData = mChart.getLineData();

    for (Highlight high : indices) {

        ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex());

        if (set == null || !set.isHighlightEnabled())
            continue;

        Entry e = set.getEntryForXValue(high.getX(), high.getY());

        if (!isInBoundsX(e, set))
            continue;

        MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
                .getPhaseY());

        high.setDraw((float) pix.x, (float) pix.y);

        // draw the lines
        drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:LineChartRenderer.java

示例15: removeLastEntry

import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void removeLastEntry() {

        LineData data = mChart.getData();
        
        if(data != null) {
         
            ILineDataSet set = data.getDataSetByIndex(0);

            if (set != null) {

                Entry e = set.getEntryForXIndex(set.getEntryCount() - 1);

                data.removeEntry(e, 0);
                // or remove by index
                // mData.removeEntry(xIndex, dataSetIndex);

                mChart.notifyDataSetChanged();
                mChart.invalidate();
            }
        }
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:22,代码来源:DynamicalAddingActivity.java


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