本文整理汇总了Java中com.github.mikephil.charting.interfaces.datasets.IDataSet.getEntriesForXValue方法的典型用法代码示例。如果您正苦于以下问题:Java IDataSet.getEntriesForXValue方法的具体用法?Java IDataSet.getEntriesForXValue怎么用?Java IDataSet.getEntriesForXValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.interfaces.datasets.IDataSet
的用法示例。
在下文中一共展示了IDataSet.getEntriesForXValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}