Java Code Examples for com.github.mikephil.charting.interfaces.datasets.ILineDataSet#getYMax()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.ILineDataSet#getYMax() . 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: DefaultFillFormatter.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {

    float fillMin = 0f;
    float chartMaxY = dataProvider.getYChartMax();
    float chartMinY = dataProvider.getYChartMin();

    LineData data = dataProvider.getLineData();

    if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) {
        fillMin = 0f;
    } else {

        float max, min;

        if (data.getYMax() > 0) {
            max = 0f;
        } else {
            max = chartMaxY;
        }
        if (data.getYMin() < 0) {
            min = 0f;
        } else {
            min = chartMinY;
        }

        fillMin = dataSet.getYMin() >= 0 ? min : max;
    }

    return fillMin;
}
 
Example 2
Source File: DefaultFillFormatter.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {

    float fillMin = 0f;
    float chartMaxY = dataProvider.getYChartMax();
    float chartMinY = dataProvider.getYChartMin();

    LineData data = dataProvider.getLineData();

    if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) {
        fillMin = 0f;
    } else {

        float max, min;

        if (data.getYMax() > 0)
            max = 0f;
        else
            max = chartMaxY;
        if (data.getYMin() < 0)
            min = 0f;
        else
            min = chartMinY;

        fillMin = dataSet.getYMin() >= 0 ? min : max;
    }

    return fillMin;
}
 
Example 3
Source File: DefaultFillFormatter.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {

    float fillMin = 0f;
    float chartMaxY = dataProvider.getYChartMax();
    float chartMinY = dataProvider.getYChartMin();

    LineData data = dataProvider.getLineData();

    if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) {
        fillMin = 0f;
    } else {

        float max, min;

        if (data.getYMax() > 0)
            max = 0f;
        else
            max = chartMaxY;
        if (data.getYMin() < 0)
            min = 0f;
        else
            min = chartMinY;

        fillMin = dataSet.getYMin() >= 0 ? min : max;
    }

    return fillMin;
}
 
Example 4
Source File: DataPlotFragment.java    From OpenLibre with GNU General Public License v3.0 5 votes vote down vote up
private void zoomToTrend() {
    ILineDataSet lineDataSet = mPlot.getData().getDataSetByIndex(mPlot.getData().getDataSetCount() - 1);
    Entry lastEntry = lineDataSet.getEntryForIndex(lineDataSet.getEntryCount() - 1);
    float yCenter = (lineDataSet.getYMin() + lineDataSet.getYMax()) / 2;

    // zoom in max to the last data points
    mPlot.zoom(maxZoomFactor, maxZoomFactor, lastEntry.getX(), yCenter, mPlot.getAxisLeft().getAxisDependency());
    isZoomedToTrend = true;
}
 
Example 5
Source File: DefaultFillFormatter.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {

    float fillMin = 0f;
    float chartMaxY = dataProvider.getYChartMax();
    float chartMinY = dataProvider.getYChartMin();

    LineData data = dataProvider.getLineData();

    if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) {
        fillMin = 0f;
    } else {

        float max, min;

        if (data.getYMax() > 0)
            max = 0f;
        else
            max = chartMaxY;
        if (data.getYMin() < 0)
            min = 0f;
        else
            min = chartMinY;

        fillMin = dataSet.getYMin() >= 0 ? min : max;
    }

    return fillMin;
}
 
Example 6
Source File: DefaultFillFormatter.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {

    float fillMin = 0f;
    float chartMaxY = dataProvider.getYChartMax();
    float chartMinY = dataProvider.getYChartMin();

    LineData data = dataProvider.getLineData();

    if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) {
        fillMin = 0f;
    } else {

        float max, min;

        if (data.getYMax() > 0)
            max = 0f;
        else
            max = chartMaxY;
        if (data.getYMin() < 0)
            min = 0f;
        else
            min = chartMinY;

        fillMin = dataSet.getYMin() >= 0 ? min : max;
    }

    return fillMin;
}