public abstract class ChartData<T extends IDataSet<? extends Entry>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<T> |
mDataSets
array that holds all DataSets the ChartData object represents
|
protected float |
mLeftAxisMax |
protected float |
mLeftAxisMin |
protected float |
mRightAxisMax |
protected float |
mRightAxisMin |
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 across all axes
|
protected float |
mYMin
the minimum y-value in the value array across all axes
|
| Constructor and Description |
|---|
ChartData()
Default constructor.
|
ChartData(java.util.List<T> sets)
constructor for chart data
|
ChartData(T... dataSets)
Constructor taking single or multiple DataSet objects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataSet(T d)
Adds a DataSet dynamically.
|
void |
addEntry(Entry e,
int dataSetIndex)
Adds an Entry to the DataSet at the specified index.
|
protected void |
calcMinMax()
Calc minimum and maximum values (both x and y) over all DataSets.
|
protected void |
calcMinMax(Entry e,
YAxis.AxisDependency axis)
Adjusts the current minimum and maximum values based on the provided Entry object.
|
protected void |
calcMinMax(T d)
Adjusts the minimum and maximum values based on the given DataSet.
|
void |
calcMinMaxY(float fromX,
float toX)
Calc minimum and maximum y-values over all DataSets.
|
void |
clearValues()
Clears this data object from all DataSets and removes all Entries.
|
boolean |
contains(T dataSet)
Checks if this data object contains the specified DataSet.
|
int[] |
getColors()
Returns all colors used across all DataSet objects this object
represents.
|
T |
getDataSetByIndex(int index) |
T |
getDataSetByLabel(java.lang.String label,
boolean ignorecase)
Returns the DataSet object with the given label.
|
int |
getDataSetCount()
returns the number of LineDataSets this object contains
|
T |
getDataSetForEntry(Entry e)
Returns the DataSet that contains the provided Entry, or null, if no
DataSet contains this Entry.
|
protected int |
getDataSetIndexByLabel(java.util.List<T> dataSets,
java.lang.String label,
boolean ignorecase)
Retrieve the index of a DataSet with a specific label from the ChartData.
|
java.lang.String[] |
getDataSetLabels()
Returns the labels of all DataSets as a string array.
|
java.util.List<T> |
getDataSets()
Returns all DataSet objects this ChartData object holds.
|
int |
getEntryCount()
Returns the total entry count across all DataSet objects this data object contains.
|
Entry |
getEntryForHighlight(Highlight highlight)
Get the Entry for a corresponding highlight object
|
protected T |
getFirstLeft(java.util.List<T> sets)
Returns the first DataSet from the datasets-array that has it's dependency on the left axis.
|
T |
getFirstRight(java.util.List<T> sets)
Returns the first DataSet from the datasets-array that has it's dependency on the right axis.
|
int |
getIndexOfDataSet(T dataSet)
Returns the index of the provided DataSet in the DataSet array of this data object, or -1 if it does not exist.
|
T |
getMaxEntryCountSet()
Returns the DataSet object with the maximum number of entries or null if there are no DataSets.
|
float |
getXMax()
Returns the maximum x-value this data object contains.
|
float |
getXMin()
Returns the minimum x-value this data object contains.
|
float |
getYMax()
Returns the greatest y-value the data object contains.
|
float |
getYMax(YAxis.AxisDependency axis)
Returns the maximum y-value for the specified axis.
|
float |
getYMin()
Returns the smallest y-value the data object contains.
|
float |
getYMin(YAxis.AxisDependency axis)
Returns the minimum y-value for the specified axis.
|
boolean |
isHighlightEnabled()
Returns true if highlighting of all underlying values is enabled, false
if not.
|
void |
notifyDataChanged()
Call this method to let the ChartData know that the underlying data has
changed.
|
boolean |
removeDataSet(int index)
Removes the DataSet at the given index in the DataSet array from the data
object.
|
boolean |
removeDataSet(T d)
Removes the given DataSet from this data object.
|
boolean |
removeEntry(Entry e,
int dataSetIndex)
Removes the given Entry object from the DataSet at the specified index.
|
boolean |
removeEntry(float xValue,
int dataSetIndex)
Removes the Entry object closest to the given DataSet at the
specified index.
|
void |
setDrawValues(boolean enabled)
Enables / disables drawing values (value-text) for all DataSets this data
object contains.
|
void |
setHighlightEnabled(boolean enabled)
Enables / disables highlighting values for all DataSets this data object
contains.
|
void |
setValueFormatter(IValueFormatter f)
Sets a custom IValueFormatter for all DataSets this data object contains.
|
void |
setValueTextColor(int color)
Sets the color of the value-text (color in which the value-labels are
drawn) for all DataSets this data object contains.
|
void |
setValueTextColors(java.util.List<java.lang.Integer> colors)
Sets the same list of value-colors for all DataSets this
data object contains.
|
void |
setValueTextSize(float size)
Sets the size (in dp) of the value-text for all DataSets this data object
contains.
|
void |
setValueTypeface(android.graphics.Typeface tf)
Sets the Typeface for all value-labels for all DataSets this data object
contains.
|
protected float mYMax
protected float mYMin
protected float mXMax
protected float mXMin
protected float mLeftAxisMax
protected float mLeftAxisMin
protected float mRightAxisMax
protected float mRightAxisMin
public ChartData()
public ChartData(T... dataSets)
dataSets - public ChartData(java.util.List<T> sets)
sets - the dataset arraypublic void notifyDataChanged()
public void calcMinMaxY(float fromX,
float toX)
fromX - the x-value to start the calculation fromtoX - the x-value to which the calculation should be performedprotected void calcMinMax()
public int getDataSetCount()
public float getYMin()
public float getYMin(YAxis.AxisDependency axis)
axis - public float getYMax()
public float getYMax(YAxis.AxisDependency axis)
axis - public float getXMin()
public float getXMax()
public java.util.List<T> getDataSets()
protected int getDataSetIndexByLabel(java.util.List<T> dataSets, java.lang.String label, boolean ignorecase)
dataSets - the DataSet array to searchlabel - ignorecase - if true, the search is not case-sensitivepublic java.lang.String[] getDataSetLabels()
public Entry getEntryForHighlight(Highlight highlight)
highlight - public T getDataSetByLabel(java.lang.String label, boolean ignorecase)
label - ignorecase - public T getDataSetByIndex(int index)
public void addDataSet(T d)
d - public boolean removeDataSet(T d)
d - public boolean removeDataSet(int index)
index - public void addEntry(Entry e, int dataSetIndex)
e - dataSetIndex - protected void calcMinMax(Entry e, YAxis.AxisDependency axis)
e - axis - protected void calcMinMax(T d)
d - public boolean removeEntry(Entry e, int dataSetIndex)
e - dataSetIndex - public boolean removeEntry(float xValue,
int dataSetIndex)
xValue - dataSetIndex - public T getDataSetForEntry(Entry e)
e - public int[] getColors()
public int getIndexOfDataSet(T dataSet)
dataSet - protected T getFirstLeft(java.util.List<T> sets)
public T getFirstRight(java.util.List<T> sets)
public void setValueFormatter(IValueFormatter f)
f - public void setValueTextColor(int color)
color - public void setValueTextColors(java.util.List<java.lang.Integer> colors)
colors - public void setValueTypeface(android.graphics.Typeface tf)
tf - public void setValueTextSize(float size)
size - public void setDrawValues(boolean enabled)
enabled - public void setHighlightEnabled(boolean enabled)
public boolean isHighlightEnabled()
public void clearValues()
public boolean contains(T dataSet)
dataSet - public int getEntryCount()
public T getMaxEntryCountSet()