本文整理汇总了Java中com.github.mikephil.charting.interfaces.datasets.IDataSet.getYValForXIndex方法的典型用法代码示例。如果您正苦于以下问题:Java IDataSet.getYValForXIndex方法的具体用法?Java IDataSet.getYValForXIndex怎么用?Java IDataSet.getYValForXIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.interfaces.datasets.IDataSet
的用法示例。
在下文中一共展示了IDataSet.getYValForXIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectionDetail
import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
@Override
protected SelectionDetail getSelectionDetail(int xIndex, float y, int dataSetIndex) {
dataSetIndex = Math.max(dataSetIndex, 0);
BarData barData = mChart.getBarData();
IDataSet dataSet = barData.getDataSetCount() > dataSetIndex
? barData.getDataSetByIndex(dataSetIndex)
: null;
if (dataSet == null)
return null;
final float yValue = dataSet.getYValForXIndex(xIndex);
if (yValue == Double.NaN) return null;
return new SelectionDetail(
yValue,
dataSetIndex,
dataSet);
}
示例2: getSelectionDetailsAtIndex
import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
* Returns an array of SelectionDetail objects for the given x-index. The SelectionDetail
* objects give information about the value at the selected index and the
* DataSet it belongs to. INFORMATION: This method does calculations at
* runtime. Do not over-use in performance critical situations.
*
* @return
*/
public List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {
List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
for (int i = 0; i < mData.getDataSetCount(); i++) {
IDataSet<?> dataSet = mData.getDataSetByIndex(i);
// extract all y-values from all DataSets at the given x-index
final float yVal = dataSet.getYValForXIndex(xIndex);
if (yVal == Float.NaN)
continue;
vals.add(new SelectionDetail(yVal, i, dataSet));
}
return vals;
}
示例3: getSelectionDetailsAtIndex
import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
* Returns an array of SelectionDetail objects for the given x-index. The SelectionDetail
* objects give information about the value at the selected index and the
* DataSet it belongs to. INFORMATION: This method does calculations at
* runtime. Do not over-use in performance critical situations.
*
* @return
*/
public List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {
List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
for (int i = 0; i < mData.getDataSetCount(); i++) {
IDataSet<?> dataSet = mData.getDataSetByIndex(i);
// extract all y-values from all DataSets at the given x-index
final float yVal = dataSet.getYValForXIndex(xIndex);
if (Float.isNaN(yVal))
continue;
vals.add(new SelectionDetail(yVal, i, dataSet));
}
return vals;
}
示例4: getSelectionDetailsAtIndex
import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
* Returns a list of SelectionDetail object corresponding to the given xIndex.
*
* @param xIndex
* @return
*/
@Override
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {
CombinedData data = (CombinedData) mChart.getData();
// get all chartdata objects
List<ChartData> dataObjects = data.getAllData();
List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
float[] pts = new float[2];
for (int i = 0; i < dataObjects.size(); i++) {
for(int j = 0; j < dataObjects.get(i).getDataSetCount(); j++) {
IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j);
// dont include datasets that cannot be highlighted
if (!dataSet.isHighlightEnabled())
continue;
// extract all y-values from all DataSets at the given x-index
final float yVal = dataSet.getYValForXIndex(xIndex);
if (yVal == Float.NaN)
continue;
pts[1] = yVal;
mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);
if (!Float.isNaN(pts[1])) {
vals.add(new SelectionDetail(pts[1], j, dataSet));
}
}
}
return vals;
}
示例5: getSelectionDetailsAtIndex
import com.github.mikephil.charting.interfaces.datasets.IDataSet; //导入方法依赖的package包/类
/**
* Returns a list of SelectionDetail object corresponding to the given xIndex.
*
* @param xIndex
* @return
*/
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {
List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
float[] pts = new float[2];
for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {
IDataSet dataSet = mChart.getData().getDataSetByIndex(i);
// dont include datasets that cannot be highlighted
if (!dataSet.isHighlightEnabled())
continue;
// extract all y-values from all DataSets at the given x-index
final float yVal = dataSet.getYValForXIndex(xIndex);
if (yVal == Float.NaN)
continue;
pts[1] = yVal;
mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);
if (!Float.isNaN(pts[1])) {
vals.add(new SelectionDetail(pts[1], i, dataSet));
}
}
return vals;
}