Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IDataSet#setValueFormatter()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IDataSet#setValueFormatter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Chart.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
/**
 * Sets a new data object for the chart. The data object contains all values
 * and information needed for displaying.
 *
 * @param data
 */
public void setData(T data) {

    mData = data;
    mOffsetsCalculated = false;

    if (data == null) {
        return;
    }

    // calculate how many digits are needed
    setupDefaultFormatter(data.getYMin(), data.getYMax());

    for (IDataSet set : mData.getDataSets()) {
        if (set.needsFormatter() || set.getValueFormatter() == mDefaultValueFormatter) {
            set.setValueFormatter(mDefaultValueFormatter);
        }
    }

    // let the chart know there is new data
    notifyDataSetChanged();

    if (mLogEnabled) {
        Log.i(LOG_TAG, "Data is set.");
    }
}
 
Example 2
Source File: Chart.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
/**
 * Sets a new data object for the chart. The data object contains all values
 * and information needed for displaying.
 *
 * @param data
 */
public void setData(T data) {

    mData = data;
    mOffsetsCalculated = false;

    if (data == null) {
        return;
    }

    // calculate how many digits are needed
    setupDefaultFormatter(data.getYMin(), data.getYMax());

    for (IDataSet set : mData.getDataSets()) {
        if (set.needsFormatter() || set.getValueFormatter() == mDefaultValueFormatter)
            set.setValueFormatter(mDefaultValueFormatter);
    }

    // let the chart know there is new data
    notifyDataSetChanged();

    if (mLogEnabled)
        Log.i(LOG_TAG, "Data is set.");
}
 
Example 3
Source File: Chart.java    From android-kline with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a new data object for the chart. The data object contains all values
 * and information needed for displaying.
 *
 * @param data
 */
public void setData(T data) {

    mData = data;
    mOffsetsCalculated = false;

    if (data == null) {
        return;
    }

    // calculate how many digits are needed
    setupDefaultFormatter(data.getYMin(), data.getYMax());

    for (IDataSet set : mData.getDataSets()) {
        if (set.needsFormatter() || set.getValueFormatter() == mDefaultValueFormatter)
            set.setValueFormatter(mDefaultValueFormatter);
    }

    // let the chart know there is new data
    notifyDataSetChanged();

    if (mLogEnabled)
        Log.i(LOG_TAG, "Data is set.");
}
 
Example 4
Source File: ChartData.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 5
Source File: ChartData.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Sets a custom IValueFormatter for all DataSets this data object contains.
 *
 * @param f
 */
public void setValueFormatter(IValueFormatter f) {
    if (f == null)
        return;
    else {
        for (IDataSet set : mDataSets) {
            set.setValueFormatter(f);
        }
    }
}
 
Example 6
Source File: ChartData.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a custom IValueFormatter for all DataSets this data object contains.
 *
 * @param f
 */
public void setValueFormatter(IValueFormatter f) {
    if (f == null)
        return;
    else {
        for (IDataSet set : mDataSets) {
            set.setValueFormatter(f);
        }
    }
}
 
Example 7
Source File: Chart.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a new data object for the chart. The data object contains all values
 * and information needed for displaying.
 *
 * @param data
 */
public void setData(T data) {

    if (data == null) {
        Log.e(LOG_TAG,
                "Cannot set data for chart. Provided data object is null.");
        return;
    }

    // LET THE CHART KNOW THERE IS DATA
    mOffsetsCalculated = false;
    mData = data;

    // calculate how many digits are needed
    calculateFormatter(data.getYMin(), data.getYMax());

    for (IDataSet set : mData.getDataSets()) {
        if (Utils.needsDefaultFormatter(set.getValueFormatter()))
            set.setValueFormatter(mDefaultFormatter);
    }

    // let the chart know there is new data
    notifyDataSetChanged();

    if (mLogEnabled)
        Log.i(LOG_TAG, "Data is set.");
}
 
Example 8
Source File: ChartData.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a custom ValueFormatter 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);
        }
    }
}
 
Example 9
Source File: Chart.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a new data object for the chart. The data object contains all values
 * and information needed for displaying.
 *
 * @param data
 */
public void setData(T data) {

    if (data == null) {
        Log.e(LOG_TAG,
                "Cannot set data for chart. Provided data object is null.");
        return;
    }

    // LET THE CHART KNOW THERE IS DATA
    mOffsetsCalculated = false;
    mData = data;

    // calculate how many digits are needed
    calculateFormatter(data.getYMin(), data.getYMax());

    for (IDataSet set : mData.getDataSets()) {
        if (Utils.needsDefaultFormatter(set.getValueFormatter()))
            set.setValueFormatter(mDefaultFormatter);
    }

    // let the chart know there is new data
    notifyDataSetChanged();

    if (mLogEnabled)
        Log.i(LOG_TAG, "Data is set.");
}
 
Example 10
Source File: ChartData.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a custom ValueFormatter 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);
        }
    }
}