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


Java IDataSet.getEntryForXValue方法代码示例

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


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

示例1: removeEntry

import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
 * Removes the Entry object closest to the given DataSet at the
 * specified index. Returns true if an Entry was removed, false if no Entry
 * was found that meets the specified requirements.
 *
 * @param xValue
 * @param dataSetIndex
 * @return
 */
public boolean removeEntry(float xValue, int dataSetIndex) {

    if (dataSetIndex >= mDataSets.size())
        return false;

    IDataSet dataSet = mDataSets.get(dataSetIndex);
    Entry e = dataSet.getEntryForXValue(xValue, Float.NaN);

    if (e == null)
        return false;

    return removeEntry(e, dataSetIndex);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:ChartData.java

示例2: buildHighlights

import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
 * An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex.
 *
 * @param set
 * @param dataSetIndex
 * @param xVal
 * @param rounding
 * @return
 */
protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float xVal, DataSet.Rounding rounding) {

    ArrayList<Highlight> highlights = new ArrayList<>();

    //noinspection unchecked
    List<Entry> entries = set.getEntriesForXValue(xVal);
    if (entries.size() == 0) {
        // Try to find closest x-value and take all entries for that x-value
        final Entry closest = set.getEntryForXValue(xVal, Float.NaN, rounding);
        if (closest != null)
        {
            //noinspection unchecked
            entries = set.getEntriesForXValue(closest.getX());
        }
    }

    if (entries.size() == 0)
        return highlights;

    for (Entry e : entries) {
        MPPointD pixels = mChart.getTransformer(
                set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());

        highlights.add(new Highlight(
                e.getX(), e.getY(),
                (float) pixels.x, (float) pixels.y,
                dataSetIndex, set.getAxisDependency()));
    }

    return highlights;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:ChartHighlighter.java

示例3: buildHighlights

import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
@Override
protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float xVal, DataSet.Rounding rounding) {

	ArrayList<Highlight> highlights = new ArrayList<>();

	//noinspection unchecked
	List<Entry> entries = set.getEntriesForXValue(xVal);
	if (entries.size() == 0) {
		// Try to find closest x-value and take all entries for that x-value
		final Entry closest = set.getEntryForXValue(xVal, Float.NaN, rounding);
		if (closest != null)
		{
			//noinspection unchecked
			entries = set.getEntriesForXValue(closest.getX());
		}
	}

	if (entries.size() == 0)
		return highlights;

	for (Entry e : entries) {
		MPPointD pixels = mChart.getTransformer(
				set.getAxisDependency()).getPixelForValues(e.getY(), e.getX());

		highlights.add(new Highlight(
				e.getX(), e.getY(),
				(float) pixels.x, (float) pixels.y,
				dataSetIndex, set.getAxisDependency()));
	}

	return highlights;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:HorizontalBarHighlighter.java


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