Java Code Examples for com.github.mikephil.charting.data.LineDataSet#setFillFormatter()

The following examples show how to use com.github.mikephil.charting.data.LineDataSet#setFillFormatter() . 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 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 2
Source File: RangeTestFragmentView.java    From EFRConnect-android with Apache License 2.0 6 votes vote down vote up
private LineData createChartData(int color) {
    List<Entry> entries = new ArrayList<>(1024);
    entries.add(new Entry(-2, 0));
    entries.add(new Entry(-1, 0));

    chartDataSet = new LineDataSet(entries, null);

    chartDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    chartDataSet.setCubicIntensity(0.1f);
    chartDataSet.setDrawCircles(false);
    chartDataSet.setDrawFilled(true);
    chartDataSet.setLineWidth(0f);
    chartDataSet.setColor(color);
    chartDataSet.setFillColor(color);
    chartDataSet.setFillAlpha(255);
    chartDataSet.setDrawHorizontalHighlightIndicator(false);
    chartDataSet.setDrawVerticalHighlightIndicator(false);
    chartDataSet.setFillFormatter(new CubicLineSampleFillFormatter());

    chartData = new LineData(chartDataSet);

    chartData.setDrawValues(false);

    return chartData;
}
 
Example 3
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 4
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);
    }