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


Java BarEntry.getVals方法代码示例

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


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

示例1: getFormattedValue

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {

    if (!mDrawWholeStack && entry instanceof BarEntry) {

        BarEntry barEntry = (BarEntry) entry;
        float[] vals = barEntry.getVals();

        if (vals != null) {

            // find out if we are on top of the stack
            if (vals[vals.length - 1] == value) {

                // return the "sum" across all stack values
                return mFormat.format(barEntry.getVal()) + mAppendix;
            } else {
                return ""; // return empty
            }
        }
    }

    // return the "proposed" value
    return mFormat.format(value) + mAppendix;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:25,代码来源:StackedValueFormatter.java

示例2: refreshContent

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {

    if (e instanceof BarEntry) {

        BarEntry be = (BarEntry) e;

        if(be.getVals() != null) {

            // draw the stack value
            tvContent.setText("" + Utils.formatNumber(be.getVals()[highlight.getStackIndex()], 0, true));
        } else {
            tvContent.setText("" + Utils.formatNumber(be.getVal(), 0, true));
        }
    } else {

        tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:20,代码来源:StackedBarsMarkerView.java

示例3: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 *
 * @param old
 *            the old highlight object before looking for stacked values
 * @param set
 * @param xIndex
 * @param dataSetIndex
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(Highlight old, IBarDataSet set, int xIndex, int dataSetIndex, double yValue) {

	BarEntry entry = set.getEntryForXIndex(xIndex);

	if (entry == null || entry.getVals() == null)
		return old;

	Range[] ranges = getRanges(entry);
	int stackIndex = getClosestStackIndex(ranges, (float) yValue);

	if(ranges.length > 0)
		return new Highlight(xIndex, dataSetIndex, stackIndex, ranges[stackIndex]);
	else
		return null;
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:27,代码来源:BarHighlighter.java

示例4: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 *
 * @param old
 *            the old highlight object before looking for stacked values
 * @param set
 * @param xIndex
 * @param dataSetIndex
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(Highlight old, IBarDataSet set, int xIndex, int dataSetIndex, double yValue) {

	BarEntry entry = set.getEntryForXIndex(xIndex);

	if (entry == null || entry.getVals() == null)
		return old;

	Range[] ranges = getRanges(entry);
	int stackIndex = getClosestStackIndex(ranges, (float) yValue);

	Highlight h = new Highlight(xIndex, dataSetIndex, stackIndex, ranges[stackIndex]);
	return h;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:25,代码来源:BarHighlighter.java

示例5: getRanges

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * Splits up the stack-values of the given bar-entry into Range objects.
 * 
 * @param entry
 * @return
 */
protected Range[] getRanges(BarEntry entry) {

	float[] values = entry.getVals();

	if (values == null || values.length == 0)
		return null;

	float negRemain = -entry.getNegativeSum();
	float posRemain = 0f;

	Range[] ranges = new Range[values.length];

	for (int i = 0; i < ranges.length; i++) {

		float value = values[i];

		if (value < 0) {
			ranges[i] = new Range(negRemain, negRemain + Math.abs(value));
			negRemain += Math.abs(value);
		} else {
			ranges[i] = new Range(posRemain, posRemain + value);
			posRemain += value;
		}
	}

	return ranges;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:34,代码来源:BarHighlighter.java

示例6: onValueSelected

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {

	BarEntry entry = (BarEntry) e;

	if (entry.getVals() != null)
		Log.i("VAL SELECTED", "Value: " + entry.getVals()[h.getStackIndex()]);
	else
		Log.i("VAL SELECTED", "Value: " + entry.getVal());
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:11,代码来源:StackedBarActivity.java

示例7: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 *
 * @param selectionDetail the selection detail to work with looking for stacked values
 * @param set
 * @param xIndex
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(
		SelectionDetail selectionDetail,
		IBarDataSet set,
		int xIndex,
		double yValue) {

	BarEntry entry = set.getEntryForXIndex(xIndex);

	if (entry == null)
		return null;

	if (entry.getVals() == null) {
		return new Highlight(xIndex,
				entry.getVal(),
				selectionDetail.dataIndex,
				selectionDetail.dataSetIndex);
	}

	Range[] ranges = getRanges(entry);
	if (ranges.length > 0) {
		int stackIndex = getClosestStackIndex(ranges, (float)yValue);
		return new Highlight(
				xIndex,
				entry.getPositiveSum() - entry.getNegativeSum(),
				selectionDetail.dataIndex,
				selectionDetail.dataSetIndex,
				stackIndex,
				ranges[stackIndex]
		);
	}

	return null;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:43,代码来源:BarHighlighter.java

示例8: getRanges

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * Splits up the stack-values of the given bar-entry into Range objects.
 * 
 * @param entry
 * @return
 */
protected Range[] getRanges(BarEntry entry) {

	float[] values = entry.getVals();

	if (values == null || values.length == 0)
		return new Range[0];

	Range[] ranges = new Range[values.length];

	float negRemain = -entry.getNegativeSum();
	float posRemain = 0f;

	for (int i = 0; i < ranges.length; i++) {

		float value = values[i];

		if (value < 0) {
			ranges[i] = new Range(negRemain, negRemain + Math.abs(value));
			negRemain += Math.abs(value);
		} else {
			ranges[i] = new Range(posRemain, posRemain + value);
			posRemain += value;
		}
	}

	return ranges;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:34,代码来源:BarHighlighter.java

示例9: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
 *
 * @param old
 *            the old highlight object before looking for stacked values
 * @param set
 * @param xIndex
 * @param dataSetIndex
 * @param yValue
 * @return
 */
protected Highlight getStackedHighlight(Highlight old, BarDataSet set, int xIndex, int dataSetIndex, double yValue) {

	BarEntry entry = set.getEntryForXIndex(xIndex);

	if (entry == null || entry.getVals() == null)
		return old;

	Range[] ranges = getRanges(entry);
	int stackIndex = getClosestStackIndex(ranges, (float) yValue);

	Highlight h = new Highlight(xIndex, dataSetIndex, stackIndex, ranges[stackIndex]);
	return h;
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:25,代码来源:BarHighlighter.java

示例10: getRanges

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * Splits up the stack-values of the given bar-entry into Range objects.
 * 
 * @param entry
 * @return
 */
protected Range[] getRanges(BarEntry entry) {

	float[] values = entry.getVals();

	if (values == null)
		return null;

	float negRemain = -entry.getNegativeSum();
	float posRemain = 0f;

	Range[] ranges = new Range[values.length];

	for (int i = 0; i < ranges.length; i++) {

		float value = values[i];

		if (value < 0) {
			ranges[i] = new Range(negRemain, negRemain + Math.abs(value));
			negRemain += Math.abs(value);
		} else {
			ranges[i] = new Range(posRemain, posRemain + value);
			posRemain += value;
		}
	}

	return ranges;
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:34,代码来源:BarHighlighter.java

示例11: calcMinMax

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public void calcMinMax(int start, int end) {

    if (mValues == null)
        return;

    final int yValCount = mValues.size();

    if (yValCount == 0)
        return;

    int endValue;

    if (end == 0 || end >= yValCount)
        endValue = yValCount - 1;
    else
        endValue = end;

    mYMin = Float.MAX_VALUE;
    mYMax = -Float.MAX_VALUE;

    for (int i = start; i <= endValue; i++) {

        BarEntry e = mValues.get(i);

        if (e != null && !Float.isNaN(e.getVal())) {

            if (e.getVals() == null) {

                if (e.getVal() < mYMin)
                    mYMin = e.getVal();

                if (e.getVal() > mYMax)
                    mYMax = e.getVal();
            } else {

                if (-e.getNegativeSum() < mYMin)
                    mYMin = -e.getNegativeSum();

                if (e.getPositiveSum() > mYMax)
                    mYMax = e.getPositiveSum();
            }
        }
    }

    if (mYMin == Float.MAX_VALUE) {
        mYMin = 0.f;
        mYMax = 0.f;
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:51,代码来源:RealmBarDataSet.java


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