com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider Java Examples

The following examples show how to use com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider. 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: FragmentPrice.java    From Lunary-Ethereum-Wallet with GNU General Public License v3.0 6 votes vote down vote up
private LineData getData(ArrayList<Entry> yVals) {
    LineDataSet set1 = new LineDataSet(yVals, "");
    set1.setLineWidth(1.45f);
    set1.setColor(Color.argb(240, 255, 255, 255));
    set1.setCircleColor(Color.WHITE);
    set1.setHighLightColor(Color.WHITE);
    set1.setFillColor(getResources().getColor(R.color.chartFilled));
    set1.setDrawCircles(false);
    set1.setDrawValues(false);
    set1.setDrawFilled(true);
    set1.setFillFormatter(new IFillFormatter() {
        @Override
        public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
            return priceChart.getAxisLeft().getAxisMinimum();
        }
    });

    LineData data = new LineData(set1);
    return data;
}
 
Example #2
Source File: FragmentPrice.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
private LineData getData(ArrayList<Entry> yVals) {
    LineDataSet set1 = new LineDataSet(yVals, "");
    set1.setLineWidth(1.45f);
    set1.setColor(Color.argb(240, 255, 255, 255));
    set1.setCircleColor(Color.WHITE);
    set1.setHighLightColor(Color.WHITE);
    set1.setFillColor(getResources().getColor(R.color.chartFilled));
    set1.setDrawCircles(false);
    set1.setDrawValues(false);
    set1.setDrawFilled(true);
    set1.setFillFormatter(new IFillFormatter() {
        @Override
        public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
            return priceChart.getAxisLeft().getAxisMinimum();
        }
    });

    LineData data = new LineData(set1);
    return data;
}
 
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: LineChartRenderer.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #5
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;
}
 
Example #6
Source File: LineChartRenderer.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #7
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 #8
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #9
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #10
Source File: LineChartRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #11
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 #12
Source File: LineChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                         ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mCirclePaintInner = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirclePaintInner.setStyle(Paint.Style.FILL);
    mCirclePaintInner.setColor(Color.WHITE);
}
 
Example #13
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 #14
Source File: RangeTestFragmentView.java    From EFRConnect-android with Apache License 2.0 4 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
    return -100;
}
 
Example #15
Source File: MyFillFormatter.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
    // your logic could be here
    return fillPos;
}
 
Example #16
Source File: AppLineChartRenderer.java    From android-kline with Apache License 2.0 4 votes vote down vote up
public AppLineChartRenderer(LineDataProvider chart, ChartAnimator animator, ViewPortHandler viewPortHandler) {
    super(chart, animator, viewPortHandler);
}
 
Example #17
Source File: TimeLineChartRenderer.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
public TimeLineChartRenderer(LineDataProvider chart, ChartAnimator animator, ViewPortHandler viewPortHandler) {
    super(chart, animator, viewPortHandler);
}
 
Example #18
Source File: MyFillFormatter.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
    // your logic could be here
    return mFillPos;
}
 
Example #19
Source File: CubicLineChartActivity.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
private void setData(int count, float range) {

        ArrayList<String> xVals = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            xVals.add((1990 +i) + "");
        }

        ArrayList<Entry> vals1 = new ArrayList<Entry>();

        for (int i = 0; i < count; i++) {
            float mult = (range + 1);
            float val = (float) (Math.random() * mult) + 20;// + (float)
                                                           // ((mult *
                                                           // 0.1) / 10);
            vals1.add(new Entry(val, i));
        }
        
        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
        set1.setDrawCubic(true);
        set1.setCubicIntensity(0.2f);
        //set1.setDrawFilled(true);
        set1.setDrawCircles(false); 
        set1.setLineWidth(1.8f);
        set1.setCircleRadius(4f);
        set1.setCircleColor(Color.WHITE);
        set1.setHighLightColor(Color.rgb(244, 117, 117));
        set1.setColor(Color.WHITE);
        set1.setFillColor(Color.WHITE);
        set1.setFillAlpha(100);
        set1.setDrawHorizontalHighlightIndicator(false);
        set1.setFillFormatter(new FillFormatter() {
            @Override
            public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
                return -10;
            }
        });
        
        // create a data object with the datasets
        LineData data = new LineData(xVals, set1);
        data.setValueTypeface(tf);
        data.setValueTextSize(9f);
        data.setDrawValues(false);

        // set data
        mChart.setData(data);
    }
 
Example #20
Source File: MyLineChartRenderer.java    From shinny-futures-android with GNU General Public License v3.0 4 votes vote down vote up
public MyLineChartRenderer(LineDataProvider chart, ChartAnimator animator,
                           ViewPortHandler viewPortHandler) {
    super(chart, animator, viewPortHandler);
}
 
Example #21
Source File: IFillFormatter.java    From android-kline with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the vertical (y-axis) position where the filled-line of the
 * LineDataSet should end.
 * 
 * @param dataSet the ILineDataSet that is currently drawn
 * @param dataProvider
 * @return
 */
float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider);
 
Example #22
Source File: IFillFormatter.java    From Ticket-Analysis with MIT License 2 votes vote down vote up
/**
 * Returns the vertical (y-axis) position where the filled-line of the
 * LineDataSet should end.
 * 
 * @param dataSet the ILineDataSet that is currently drawn
 * @param dataProvider
 * @return
 */
float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider);
 
Example #23
Source File: FillFormatter.java    From Stayfit with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the vertical (y-axis) position where the filled-line of the
 * LineDataSet should end.
 * 
 * @param dataSet the ILineDataSet that is currently drawn
 * @param dataProvider
 * @return
 */
float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider);
 
Example #24
Source File: FillFormatter.java    From NetKnight with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the vertical (y-axis) position where the filled-line of the
 * LineDataSet should end.
 * 
 * @param dataSet the ILineDataSet that is currently drawn
 * @param dataProvider
 * @return
 */
float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider);
 
Example #25
Source File: IFillFormatter.java    From StockChart-MPAndroidChart with MIT License 2 votes vote down vote up
/**
 * Returns the vertical (y-axis) position where the filled-line of the
 * LineDataSet should end.
 * 
 * @param dataSet the ILineDataSet that is currently drawn
 * @param dataProvider
 * @return
 */
float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider);