public abstract class DataSet<T extends Entry> extends BaseDataSet<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
DataSet.Rounding
Determines how to round DataSet index values for
getEntryIndex(float, float, Rounding) DataSet.getEntryIndex()}
when an exact x-index is not found. |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<T> |
mValues
the entries that this DataSet represents / holds together
|
protected float |
mXMax
maximum x-value in the value array
|
protected float |
mXMin
minimum x-value in the value array
|
protected float |
mYMax
maximum y-value in the value array
|
protected float |
mYMin
minimum y-value in the value array
|
mAxisDependency, mColors, mDrawIcons, mDrawValues, mGradientColor, mGradientColors, mHighlightEnabled, mIconsOffset, mValueColors, mValueFormatter, mValueTextSize, mValueTypeface, mVisible| Constructor and Description |
|---|
DataSet(java.util.List<T> values,
java.lang.String label)
Creates a new DataSet object with the given values (entries) it represents.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEntry(T e)
Adds an Entry to the DataSet dynamically.
|
void |
addEntryOrdered(T e)
Adds an Entry to the DataSet dynamically.
|
void |
calcMinMax()
Calculates the minimum and maximum x and y values (mXMin, mXMax, mYMin, mYMax).
|
protected void |
calcMinMax(T e)
Updates the min and max x and y value of this DataSet based on the given Entry.
|
protected void |
calcMinMaxX(T e) |
void |
calcMinMaxY(float fromX,
float toX)
Calculates the min and max y-values from the Entry closest to the given fromX to the Entry closest to the given toX value.
|
protected void |
calcMinMaxY(T e) |
void |
clear()
Removes all values from this DataSet and does all necessary recalculations.
|
abstract DataSet<T> |
copy()
Provides an exact copy of the DataSet this method is used on.
|
protected void |
copy(DataSet dataSet) |
java.util.List<T> |
getEntriesForXValue(float xValue)
Returns all Entry objects found at the given x-value with binary
search.
|
int |
getEntryCount()
Returns the number of y-values this DataSet represents -> the size of the y-values array
-> yvals.size()
|
T |
getEntryForIndex(int index)
Returns the Entry object found at the given index (NOT xIndex) in the values array.
|
T |
getEntryForXValue(float xValue,
float closestToY)
Returns the first Entry object found at the given x-value with binary
search.
|
T |
getEntryForXValue(float xValue,
float closestToY,
DataSet.Rounding rounding)
Returns the first Entry object found at the given x-value with binary
search.
|
int |
getEntryIndex(Entry e)
Returns the position of the provided entry in the DataSets Entry array.
|
int |
getEntryIndex(float xValue,
float closestToY,
DataSet.Rounding rounding)
Returns the first Entry index found at the given x-value with binary
search.
|
java.util.List<T> |
getValues()
Returns the array of entries that this DataSet represents.
|
float |
getXMax()
returns the maximum x-value this DataSet holds
|
float |
getXMin()
returns the minimum x-value this DataSet holds
|
float |
getYMax()
returns the maximum y-value this DataSet holds
|
float |
getYMin()
returns the minimum y-value this DataSet holds
|
boolean |
removeEntry(T e)
Removes an Entry from the DataSets entries array.
|
void |
setValues(java.util.List<T> values)
Sets the array of entries that this DataSet represents, and calls notifyDataSetChanged()
|
java.lang.String |
toSimpleString()
Returns a simple string representation of the DataSet with the type and
the number of Entries.
|
java.lang.String |
toString() |
addColor, contains, copy, getAxisDependency, getColor, getColor, getColors, getForm, getFormLineDashEffect, getFormLineWidth, getFormSize, getGradientColor, getGradientColor, getGradientColors, getIconsOffset, getIndexInEntries, getLabel, getValueColors, getValueFormatter, getValueTextColor, getValueTextColor, getValueTextSize, getValueTypeface, isDrawIconsEnabled, isDrawValuesEnabled, isHighlightEnabled, isVisible, needsFormatter, notifyDataSetChanged, removeEntry, removeEntryByXValue, removeFirst, removeLast, resetColors, setAxisDependency, setColor, setColor, setColors, setColors, setColors, setColors, setDrawIcons, setDrawValues, setForm, setFormLineDashEffect, setFormLineWidth, setFormSize, setGradientColor, setGradientColors, setHighlightEnabled, setIconsOffset, setLabel, setValueFormatter, setValueTextColor, setValueTextColors, setValueTextSize, setValueTypeface, setVisibleprotected java.util.List<T extends Entry> mValues
protected float mYMax
protected float mYMin
protected float mXMax
protected float mXMin
public DataSet(java.util.List<T> values, java.lang.String label)
values - label - public void calcMinMax()
IDataSetpublic void calcMinMaxY(float fromX,
float toX)
IDataSetprotected void calcMinMax(T e)
e - protected void calcMinMaxX(T e)
protected void calcMinMaxY(T e)
public int getEntryCount()
IDataSetpublic java.util.List<T> getValues()
public void setValues(java.util.List<T> values)
public abstract DataSet<T> copy()
protected void copy(DataSet dataSet)
dataSet - public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toSimpleString()
public float getYMin()
IDataSetpublic float getYMax()
IDataSetpublic float getXMin()
IDataSetpublic float getXMax()
IDataSetpublic void addEntryOrdered(T e)
IDataSetpublic void clear()
IDataSetpublic boolean addEntry(T e)
IDataSetpublic boolean removeEntry(T e)
IDataSetpublic int getEntryIndex(Entry e)
IDataSetpublic T getEntryForXValue(float xValue, float closestToY, DataSet.Rounding rounding)
IDataSetxValue - the x-valueclosestToY - If there are multiple y-values for the specified x-value,rounding - determine whether to round up/down/closest
if there is no Entry matching the provided x-valuepublic T getEntryForXValue(float xValue, float closestToY)
IDataSetxValue - the x-valueclosestToY - If there are multiple y-values for the specified x-value,public T getEntryForIndex(int index)
IDataSetpublic int getEntryIndex(float xValue,
float closestToY,
DataSet.Rounding rounding)
IDataSetxValue - the x-valueclosestToY - If there are multiple y-values for the specified x-value,rounding - determine whether to round up/down/closest
if there is no Entry matching the provided x-valuepublic java.util.List<T> getEntriesForXValue(float xValue)
IDataSet