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 java.util.List<java.lang.String> |
mXVals
holds all x-values the chart represents
|
protected float |
mYMax
maximum y-value in the y-value array across all axes
|
protected float |
mYMin
the minimum y-value in the y-value array across all axes
|
| Constructor and Description |
|---|
ChartData() |
ChartData(java.util.List<java.lang.String> xVals)
Constructor for only x-values.
|
ChartData(java.util.List<java.lang.String> xVals,
java.util.List<T> sets)
constructor for chart data
|
ChartData(java.lang.String[] xVals)
Constructor for only x-values.
|
ChartData(java.lang.String[] xVals,
java.util.List<T> sets)
constructor that takes string array instead of List string
|
| 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.
|
void |
addXValue(java.lang.String xVal)
Adds a new x-value to the chart data.
|
void |
calcMinMax(int start,
int end)
calc minimum and maximum y value over all datasets
|
protected void |
calcYValueCount()
Calculates the total number of y-values across all DataSets the ChartData
represents.
|
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.
|
static java.util.List<java.lang.String> |
generateXVals(int from,
int to)
Generates an x-values array filled with numbers in range specified by the
parameters.
|
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.
|
protected java.lang.String[] |
getDataSetLabels()
Returns the labels of all DataSets as a string array.
|
java.util.List<T> |
getDataSets() |
Entry |
getEntryForHighlight(Highlight highlight)
Get the Entry for a corresponding highlight object
|
T |
getFirstLeft()
Returns the first DataSet from the datasets-array that has it's dependency on the left axis.
|
T |
getFirstRight()
Returns the first DataSet from the datasets-array that has it's dependency on the right axis.
|
int |
getIndexOfDataSet(T dataSet) |
int |
getXValCount()
returns the total number of x-values this ChartData object represents
(the size of the x-values array)
|
float |
getXValMaximumLength()
returns the maximum length (in characters) across all values in the
x-vals array
|
java.util.List<java.lang.String> |
getXVals()
returns the x-values the chart represents
|
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.
|
int |
getYValCount()
Returns the total number of y-values across all DataSet objects the this
object represents.
|
protected void |
init()
performs all kinds of initialization calculations, such as min-max and
value count and sum
|
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(int xIndex,
int dataSetIndex)
Removes the Entry object at the given xIndex from the DataSet at the
specified index.
|
void |
removeXValue(int index)
Removes the x-value 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(ValueFormatter f)
Sets a custom ValueFormatter 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.
|
void |
setXVals(java.util.List<java.lang.String> xVals)
sets the x-values the chart represents
|
protected float mYMax
protected float mYMin
protected float mLeftAxisMax
protected float mLeftAxisMin
protected float mRightAxisMax
protected float mRightAxisMin
protected java.util.List<java.lang.String> mXVals
public ChartData()
public ChartData(java.util.List<java.lang.String> xVals)
xVals - public ChartData(java.lang.String[] xVals)
xVals - public ChartData(java.util.List<java.lang.String> xVals,
java.util.List<T> sets)
xVals - The values describing the x-axis. Must be at least as long
as the highest xIndex in the Entry objects across all
DataSets.sets - the dataset arraypublic ChartData(java.lang.String[] xVals,
java.util.List<T> sets)
xVals - The values describing the x-axis. Must be at least as long
as the highest xIndex in the Entry objects across all
DataSets.sets - the dataset arrayprotected void init()
public void notifyDataChanged()
public void calcMinMax(int start,
int end)
protected void calcYValueCount()
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 getXValMaximumLength()
public int getYValCount()
public java.util.List<java.lang.String> getXVals()
public void setXVals(java.util.List<java.lang.String> xVals)
public void addXValue(java.lang.String xVal)
xVal - public void removeXValue(int index)
index - 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 int getXValCount()
protected 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 - public boolean removeEntry(Entry e, int dataSetIndex)
e - dataSetIndex - public boolean removeEntry(int xIndex,
int dataSetIndex)
xIndex - dataSetIndex - public T getDataSetForEntry(Entry e)
e - public int[] getColors()
public int getIndexOfDataSet(T dataSet)
public T getFirstLeft()
public T getFirstRight()
public static java.util.List<java.lang.String> generateXVals(int from,
int to)
public void setValueFormatter(ValueFormatter 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 -