Java Code Examples for com.github.mikephil.charting.data.CombinedData#getAllData()
The following examples show how to use
com.github.mikephil.charting.data.CombinedData#getAllData() .
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: CombinedHighlighter.java From NetKnight with Apache License 2.0 | 5 votes |
/** * Returns a list of SelectionDetail object corresponding to the given xIndex. * * @param xIndex * @return */ @Override protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex, int dataSetIndex) { List<SelectionDetail> vals = new ArrayList<SelectionDetail>(); float[] pts = new float[2]; CombinedData data = (CombinedData) mChart.getData(); // get all chartdata objects List<ChartData> dataObjects = data.getAllData(); 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 yVals[] = dataSet.getYValsForXIndex(xIndex); for (float yVal : yVals) { pts[1] = yVal; mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts); if (!Float.isNaN(pts[1])) { vals.add(new SelectionDetail(pts[1], yVal, i, j, 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: CombinedHighlighter.java From Stayfit 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++) { 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; }