Java Code Examples for com.github.mikephil.charting.data.DataSet#getYValForXIndex()
The following examples show how to use
com.github.mikephil.charting.data.DataSet#getYValForXIndex() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PieRadarChartBase.java From iMoney with Apache License 2.0 | 4 votes |
/** * 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++) { DataSet<?> 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; }
Example 2
Source File: CombinedHighlighter.java From iMoney with Apache License 2.0 | 3 votes |
/** * 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++) { DataSet<?> 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; }
Example 3
Source File: ChartHighlighter.java From iMoney with Apache License 2.0 | 3 votes |
/** * 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++) { DataSet<?> 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; }
Example 4
Source File: Chart.java From Notification-Analyser with MIT License | 2 votes |
/** * returns the y-value for the given x-index and DataSet index * * @param index * @param dataSet * @return */ public float getYValue(int xIndex, int dataSetIndex) { DataSet<? extends Entry> set = mCurrentData.getDataSetByIndex(dataSetIndex); return set.getYValForXIndex(xIndex); }