/** * Returns the total entry count across all DataSet objects this data object contains. * * @return */ public int getEntryCount() { int count = 0; for (T set : mDataSets) { count += set.getEntryCount(); } return count; }
/** * Returns the DataSet object with the maximum number of entries or null if there are no DataSets. * * @return */ public T getMaxEntryCountSet() { if (mDataSets == null || mDataSets.isEmpty()) return null; T max = mDataSets.get(0); for (T set : mDataSets) { if (set.getEntryCount() > max.getEntryCount()) max = set; } return max; } }
/** * Returns the DataSet that contains the provided Entry, or null, if no * DataSet contains this Entry. * * @param e * @return */ public T getDataSetForEntry(Entry e) { if (e == null) return null; for (int i = 0; i < mDataSets.size(); i++) { T set = mDataSets.get(i); for (int j = 0; j < set.getEntryCount(); j++) { if (e.equalTo(set.getEntryForXValue(e.getX(), e.getY()))) return set; } } return null; }
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }
int entryCount = dataSet.getEntryCount();
/** * draws all MarkerViews on the highlighted positions */ protected void drawMarkers(Canvas canvas) { // if there is no marker view or drawing marker is disabled if (mMarker == null || !isDrawMarkersEnabled() || !valuesToHighlight()) return; for (int i = 0; i < mIndicesToHighlight.length; i++) { Highlight highlight = mIndicesToHighlight[i]; IDataSet set = mData.getDataSetByIndex(highlight.getDataSetIndex()); Entry e = mData.getEntryForHighlight(mIndicesToHighlight[i]); int entryIndex = set.getEntryIndex(e); // make sure entry not null if (e == null || entryIndex > set.getEntryCount() * mAnimator.getPhaseX()) continue; float[] pos = getMarkerPosition(highlight); // check bounds if (!mViewPortHandler.isInBounds(pos[0], pos[1])) continue; // callbacks to update the content mMarker.refreshContent(e, highlight); // draw the marker mMarker.draw(canvas, pos[0], pos[1]); } }
/** * draws all MarkerViews on the highlighted positions */ protected void drawMarkers(Canvas canvas) { // if there is no marker view or drawing marker is disabled if (mMarker == null || !isDrawMarkersEnabled() || !valuesToHighlight()) return; for (int i = 0; i < mIndicesToHighlight.length; i++) { Highlight highlight = mIndicesToHighlight[i]; IDataSet set = mData.getDataSetByHighlight(highlight); Entry e = mData.getEntryForHighlight(highlight); if (e == null) continue; int entryIndex = set.getEntryIndex(e); // make sure entry not null if (entryIndex > set.getEntryCount() * mAnimator.getPhaseX()) continue; float[] pos = getMarkerPosition(highlight); // check bounds if (!mViewPortHandler.isInBounds(pos[0], pos[1])) continue; // callbacks to update the content mMarker.refreshContent(e, highlight); // draw the marker mMarker.draw(canvas, pos[0], pos[1]); } }
/** * Returns the total entry count across all DataSet objects this data object contains. * * @return */ public int getEntryCount() { int count = 0; for (T set : mDataSets) { count += set.getEntryCount(); } return count; }
/** * Returns the total entry count across all DataSet objects this data object contains. * * @return */ public int getEntryCount() { int count = 0; for (T set : mDataSets) { count += set.getEntryCount(); } return count; }
/** * Returns the total entry count across all DataSet objects this data object contains. * * @return */ public int getEntryCount() { int count = 0; for (T set : mDataSets) { count += set.getEntryCount(); } return count; }
/** * Returns the total entry count across all DataSet objects this data object contains. * * @return */ public int getEntryCount() { int count = 0; for (T set : mDataSets) { count += set.getEntryCount(); } return count; }
/** * Returns the DataSet object with the maximum number of entries or null if there are no DataSets. * * @return */ public T getMaxEntryCountSet() { if (mDataSets == null || mDataSets.isEmpty()) return null; T max = mDataSets.get(0); for (T set : mDataSets) { if (set.getEntryCount() > max.getEntryCount()) max = set; } return max; } }
/** * Returns the DataSet object with the maximum number of entries or null if there are no DataSets. * * @return */ public T getMaxEntryCountSet() { if (mDataSets == null || mDataSets.isEmpty()) return null; T max = mDataSets.get(0); for (T set : mDataSets) { if (set.getEntryCount() > max.getEntryCount()) max = set; } return max; } }
/** * Returns the DataSet object with the maximum number of entries or null if there are no DataSets. * * @return */ public T getMaxEntryCountSet() { if (mDataSets == null || mDataSets.isEmpty()) { return null; } T max = mDataSets.get(0); for (T set : mDataSets) { if (set.getEntryCount() > max.getEntryCount()) { max = set; } } return max; } }
/** * Returns the DataSet object with the maximum number of entries or null if there are no DataSets. * * @return */ public T getMaxEntryCountSet() { if (mDataSets == null || mDataSets.isEmpty()) return null; T max = mDataSets.get(0); for (T set : mDataSets) { if (set.getEntryCount() > max.getEntryCount()) max = set; } return max; } }
/** * Returns the DataSet that contains the provided Entry, or null, if no * DataSet contains this Entry. * * @param e * @return */ public T getDataSetForEntry(Entry e) { if (e == null) return null; for (int i = 0; i < mDataSets.size(); i++) { T set = mDataSets.get(i); for (int j = 0; j < set.getEntryCount(); j++) { if (e.equalTo(set.getEntryForXValue(e.getX(), e.getY()))) return set; } } return null; }
/** * Returns the DataSet that contains the provided Entry, or null, if no * DataSet contains this Entry. * * @param e * @return */ public T getDataSetForEntry(Entry e) { if (e == null) return null; for (int i = 0; i < mDataSets.size(); i++) { T set = mDataSets.get(i); for (int j = 0; j < set.getEntryCount(); j++) { if (e.equalTo(set.getEntryForXValue(e.getX(), e.getY()))) return set; } } return null; }
/** * Returns the DataSet that contains the provided Entry, or null, if no * DataSet contains this Entry. * * @param e * @return */ public T getDataSetForEntry(Entry e) { if (e == null) return null; for (int i = 0; i < mDataSets.size(); i++) { T set = mDataSets.get(i); for (int j = 0; j < set.getEntryCount(); j++) { if (e.equalTo(set.getEntryForXValue(e.getX(), e.getY()))) return set; } } return null; }
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }