/** * 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 true if the DataSet values should be drawn, false if not. * * @param set * @return */ protected boolean shouldDrawValues(IDataSet set) { return set.isVisible() && (set.isDrawValuesEnabled() || set.isDrawIconsEnabled()); }
/** * Enables / disables highlighting values for all DataSets this data object * contains. If set to true, this means that values can * be highlighted programmatically or by touch gesture. */ public void setHighlightEnabled(boolean enabled) { for (IDataSet set : mDataSets) { set.setHighlightEnabled(enabled); } }
/** * Enables / disables drawing values (value-text) for all DataSets this data * object contains. * * @param enabled */ public void setDrawValues(boolean enabled) { for (IDataSet set : mDataSets) { set.setDrawValues(enabled); } }
/** * Applies the required styling (provided by the DataSet) to the value-paint * object. * * @param set */ protected void applyValueTextStyle(IDataSet set) { mValuePaint.setTypeface(set.getValueTypeface()); mValuePaint.setTextSize(set.getValueTextSize()); }
/** * Returns the maximum shape-size across all DataSets. * * @return */ public float getGreatestShapeSize() { float max = 0f; for (IScatterDataSet set : mDataSets) { float size = set.getScatterShapeSize(); if (size > max) max = size; } return max; } }
/** * Returns the first DataSet from the datasets-array that has it's dependency on the left axis. * Returns null if no DataSet with left dependency could be found. * * @return */ protected T getFirstLeft(List<T> sets) { for (T dataSet : sets) { if (dataSet.getAxisDependency() == AxisDependency.LEFT) return dataSet; } return null; }
/** * Sets the color of the value-text (color in which the value-labels are * drawn) for all DataSets this data object contains. * * @param color */ public void setValueTextColor(int color) { for (IDataSet set : mDataSets) { set.setValueTextColor(color); } }
/** * Sets the same list of value-colors for all DataSets this * data object contains. * * @param colors */ public void setValueTextColors(List<Integer> colors) { for (IDataSet set : mDataSets) { set.setValueTextColors(colors); } }
/** * Sets the Typeface for all value-labels for all DataSets this data object * contains. * * @param tf */ public void setValueTypeface(Typeface tf) { for (IDataSet set : mDataSets) { set.setValueTypeface(tf); } }
/** * Sets the size (in dp) of the value-text for all DataSets this data object * contains. * * @param size */ public void setValueTextSize(float size) { for (IDataSet set : mDataSets) { set.setValueTextSize(size); } }
/** * Sets the width of the circle that surrounds the bubble when highlighted * for all DataSet objects this data object contains, in dp. * * @param width */ public void setHighlightCircleWidth(float width) { for (IBubbleDataSet set : mDataSets) { set.setHighlightCircleWidth(width); } } }
/** * Returns true if highlighting of all underlying values is enabled, false * if not. * * @return */ public boolean isHighlightEnabled() { for (IDataSet set : mDataSets) { if (!set.isHighlightEnabled()) return false; } return true; }
/** * Sets a custom IValueFormatter for all DataSets this data object contains. * * @param f */ public void setValueFormatter(ValueFormatter f) { if (f == null) return; else { for (IDataSet set : mDataSets) { set.setValueFormatter(f); } } }
/** * Sets up the cache, returns true if a change of cache was required. * * @param set * @return */ protected boolean init(ILineDataSet set) { int size = set.getCircleColorCount(); boolean changeRequired = false; if (circleBitmaps == null) { circleBitmaps = new Bitmap[size]; changeRequired = true; } else if (circleBitmaps.length != size) { circleBitmaps = new Bitmap[size]; changeRequired = true; } return changeRequired; }
/** * Returns the labels of all DataSets as a string array. * * @return */ public String[] getDataSetLabels() { String[] types = new String[mDataSets.size()]; for (int i = 0; i < mDataSets.size(); i++) { types[i] = mDataSets.get(i).getLabel(); } return types; }
/** * Returns the angle that each slice in the radar chart occupies. * * @return */ public float getSliceAngle() { return 360f / (float) mData.getMaxEntryCountSet().getEntryCount(); }
@Override public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, float posX, float posY, Paint renderPaint) { final float shapeHalf = dataSet.getScatterShapeSize() / 2f; c.drawLine( posX - shapeHalf, posY - shapeHalf, posX + shapeHalf, posY + shapeHalf, renderPaint); } }
/** * Returns the first DataSet from the datasets-array that has it's dependency on the right axis. * Returns null if no DataSet with right dependency could be found. * * @return */ public T getFirstRight(List<T> sets) { for (T dataSet : sets) { if (dataSet.getAxisDependency() == AxisDependency.RIGHT) return dataSet; } return null; }
/** * Returns true if the current touch situation should be interpreted as inverted, false if not. * * @return */ private boolean inverted() { return (mClosestDataSetToTouch == null && mChart.isAnyAxisInverted()) || (mClosestDataSetToTouch != null && mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())); }