PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.53k stars 9.01k forks source link

Multi-line chart with filled area issue #2879

Open HamiguaLu opened 7 years ago

HamiguaLu commented 7 years ago

Hi All First of all thanks very much for the great work fo MPAndroidChart I am now using the MPAndroidChart to draw line chart multi-line As you can see from the above screenshot, the color specified by me(showed in legend) is not the same as the finally filled in below the chart, is there any way to make sure that the different color will not mixed together? Below is the code I used to draw two of the lines

     LineDataSet vlfDs = new LineDataSet(vlfValues, "VLF");
    vlfDs.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    vlfDs.setCubicIntensity(0.2f);
    vlfDs.setDrawFilled(true);
    vlfDs.setDrawCircles(false);
    vlfDs.setLineWidth(0);
    vlfDs.setCircleRadius(4f);
    vlfDs.setColor(Color.YELLOW);
    vlfDs.setFillColor(Color.YELLOW);
    vlfDs.setFillAlpha(100);

    LineDataSet lfDs = new LineDataSet(lfValues, "LF");
    lfDs.setCubicIntensity(0.2f);
    lfDs.setDrawFilled(true);
    lfDs.setDrawCircles(false);
    lfDs.setLineWidth(0);
    lfDs.setCircleRadius(4f);
    lfDs.setCircleColor(Color.WHITE);
    lfDs.setColor(Color.GREEN);
    lfDs.setFillColor(Color.GREEN);
    lfDs.setFillAlpha(100);
    hrvLineData = new LineData(hfDs,lfDs,vlfDs, hrDs);
    hrvLineData.setValueTextSize(0);
    hrvLineData.setDrawValues(false);

    hrvChartView.setData(hrvLineData);

    hrvChartView.invalidate();
HamiguaLu commented 7 years ago

Fixed by setFillAlpha(255) instead of 100 Thanks