public abstract class DataSet<T extends Entry>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected YAxis.AxisDependency |
mAxisDependency
this specifies which axis this DataSet should be plotted against
|
protected java.util.List<java.lang.Integer> |
mColors
List representing all colors that are used for this DataSet
|
protected boolean |
mDrawValues
if true, y-values are drawn on the chart
|
protected boolean |
mHighlightEnabled
if true, value highlightning is enabled
|
protected int |
mLastEnd
the last end value used for calcMinMax
|
protected int |
mLastStart
the last start value used for calcMinMax
|
protected ValueFormatter |
mValueFormatter
custom formatter that is used instead of the auto-formatter if set
|
protected float |
mYMax
maximum y-value in the y-value array
|
protected float |
mYMin
the minimum y-value in the y-value array
|
protected java.util.List<T> |
mYVals
the entries that this dataset represents / holds together
|
| Constructor and Description |
|---|
DataSet(java.util.List<T> yVals,
java.lang.String label)
Creates a new DataSet object with the given values it represents.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColor(int color)
Adds a new color to the colors array of the DataSet.
|
void |
addEntry(Entry e)
Adds an Entry to the DataSet dynamically.
|
void |
addEntryOrdered(Entry e)
Adds an Entry to the DataSet dynamically.
|
protected void |
calcMinMax(int start,
int end)
calc minimum and maximum y value
|
void |
clear()
Removes all values from this DataSet and recalculates min and max value.
|
boolean |
contains(Entry e)
Checks if this DataSet contains the specified Entry.
|
abstract DataSet<T> |
copy()
Provides an exact copy of the DataSet this method is used on.
|
float |
getAverage()
Returns the average value across all entries in this DataSet.
|
YAxis.AxisDependency |
getAxisDependency()
Returns the axis this DataSet should be plotted against.
|
int |
getColor()
Returns the first color (index 0) of the colors-array this DataSet
contains.
|
int |
getColor(int index)
Returns the color at the given index of the DataSet's color array.
|
java.util.List<java.lang.Integer> |
getColors()
returns all the colors that are set for this DataSet
|
java.util.List<T> |
getEntriesForXIndex(int x)
Returns all Entry objects at the given xIndex.
|
int |
getEntryCount()
returns the number of y-values this DataSet represents
|
T |
getEntryForXIndex(int x)
Returns the first Entry object found at the given xIndex with binary
search.
|
int |
getEntryIndex(int x)
Returns the first Entry index found at the given xIndex with binary
search.
|
int |
getEntryPosition(Entry e)
Returns the position of the provided entry in the DataSets Entry array.
|
int |
getIndexInEntries(int xIndex)
The xIndex of an Entry object is provided.
|
java.lang.String |
getLabel()
Returns the label string that describes the DataSet.
|
int |
getValueCount()
Returns the number of entries this DataSet holds.
|
ValueFormatter |
getValueFormatter()
Returns the formatter used for drawing the values inside the chart.
|
int |
getValueTextColor() |
float |
getValueTextSize()
Returns the text-size of the labels that are displayed above the values.
|
android.graphics.Typeface |
getValueTypeface() |
float |
getYMax()
returns the maximum y-value this DataSet holds
|
float |
getYMin()
returns the minimum y-value this DataSet holds
|
float |
getYValForXIndex(int xIndex)
Returns the value of the Entry object at the given xIndex.
|
java.util.List<T> |
getYVals()
returns the DataSets Entry array
|
float |
getYValueSum()
gets the sum of all y-values
|
boolean |
isDrawValuesEnabled()
returns true if y-value drawing is enabled, false if not
|
boolean |
isHighlightEnabled()
returns true if highlighting of values is enabled, false if not
|
boolean |
isVisible()
Returns true if this DataSet is visible inside the chart, or false if it
is currently hidden.
|
boolean |
needsDefaultFormatter()
If this component has no ValueFormatter or is only equipped with the
default one (no custom set), return true.
|
void |
notifyDataSetChanged()
Use this method to tell the data set that the underlying data has changed
|
boolean |
removeEntry(int xIndex)
Removes the Entry object that has the given xIndex from the DataSet.
|
boolean |
removeEntry(T e)
Removes an Entry from the DataSets entries array.
|
boolean |
removeFirst()
Removes the first Entry (at index 0) of this DataSet from the entries array.
|
boolean |
removeLast()
Removes the last Entry (at index size-1) of this DataSet from the entries array.
|
void |
resetColors()
Resets all colors of this DataSet and recreates the colors array.
|
void |
setAxisDependency(YAxis.AxisDependency dependency)
Set the y-axis this DataSet should be plotted against (either LEFT or
RIGHT).
|
void |
setColor(int color)
Sets the one and ONLY color that should be used for this DataSet.
|
void |
setColors(int[] colors)
Sets the colors that should be used fore this DataSet.
|
void |
setColors(int[] colors,
android.content.Context c)
Sets the colors that should be used fore this DataSet.
|
void |
setColors(java.util.List<java.lang.Integer> colors)
Sets the colors that should be used fore this DataSet.
|
void |
setDrawValues(boolean enabled)
set this to true to draw y-values on the chart NOTE (for bar and
linechart): if "maxvisiblecount" is reached, no values will be drawn even
if this is enabled
|
void |
setHighlightEnabled(boolean enabled)
If set to true, value highlighting is enabled which means that values can
be highlighted programmatically or by touch gesture.
|
void |
setLabel(java.lang.String label)
Sets the label string that describes the DataSet.
|
void |
setValueFormatter(ValueFormatter f)
Sets the formatter to be used for drawing the values inside the chart.
|
void |
setValueTextColor(int color)
Sets the color the value-labels of this DataSet should have.
|
void |
setValueTextSize(float size)
Sets the text-size of the value-labels of this DataSet in dp.
|
void |
setValueTypeface(android.graphics.Typeface tf)
Sets a Typeface for the value-labels of this DataSet.
|
void |
setVisible(boolean visible)
Set the visibility of this DataSet.
|
java.lang.String |
toSimpleString()
Returns a simple string representation of the DataSet with the type and
the number of Entries.
|
java.lang.String |
toString() |
protected java.util.List<java.lang.Integer> mColors
protected java.util.List<T extends Entry> mYVals
protected float mYMax
protected float mYMin
protected int mLastStart
protected int mLastEnd
protected boolean mDrawValues
protected transient ValueFormatter mValueFormatter
protected YAxis.AxisDependency mAxisDependency
protected boolean mHighlightEnabled
public DataSet(java.util.List<T> yVals, java.lang.String label)
yVals - label - public void notifyDataSetChanged()
protected void calcMinMax(int start,
int end)
public float getAverage()
public int getEntryCount()
public float getYValForXIndex(int xIndex)
xIndex - public T getEntryForXIndex(int x)
x - public int getEntryIndex(int x)
x - public java.util.List<T> getEntriesForXIndex(int x)
x - public java.util.List<T> getYVals()
public float getYValueSum()
public float getYMin()
public float getYMax()
public int getValueCount()
public int getIndexInEntries(int xIndex)
xIndex - public abstract DataSet<T> copy()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toSimpleString()
public void setLabel(java.lang.String label)
public java.lang.String getLabel()
public void setVisible(boolean visible)
visible - public boolean isVisible()
public YAxis.AxisDependency getAxisDependency()
public void setAxisDependency(YAxis.AxisDependency dependency)
dependency - public void setDrawValues(boolean enabled)
enabled - public boolean isDrawValuesEnabled()
public void addEntry(Entry e)
e - public void addEntryOrdered(Entry e)
e - public boolean removeEntry(T e)
e - public boolean removeEntry(int xIndex)
xIndex - public boolean removeFirst()
public boolean removeLast()
public void setColors(java.util.List<java.lang.Integer> colors)
colors - public void setColors(int[] colors)
colors - public void setColors(int[] colors,
android.content.Context c)
colors - public void addColor(int color)
color - public void setColor(int color)
color - public java.util.List<java.lang.Integer> getColors()
public int getColor(int index)
index - public int getColor()
public void resetColors()
public void setHighlightEnabled(boolean enabled)
enabled - public boolean isHighlightEnabled()
public int getEntryPosition(Entry e)
e - public void setValueFormatter(ValueFormatter f)
f - public ValueFormatter getValueFormatter()
public boolean needsDefaultFormatter()
public void setValueTextColor(int color)
color - public int getValueTextColor()
public void setValueTypeface(android.graphics.Typeface tf)
tf - public android.graphics.Typeface getValueTypeface()
public void setValueTextSize(float size)
size - public float getValueTextSize()
public boolean contains(Entry e)
e - public void clear()