Java Code Examples for com.github.mikephil.charting.data.LineDataSet#setDrawFilled()
The following examples show how to use
com.github.mikephil.charting.data.LineDataSet#setDrawFilled() .
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: TickChart.java From android-kline with Apache License 2.0 | 7 votes |
private ILineDataSet createSet(int type) { LineDataSet set = new LineDataSet(null, String.valueOf(type)); // set.setAxisDependency(YAxis.AxisDependency.LEFT); if (type == TYPE_FULL) { set.setHighLightColor(mLineColor); set.setDrawHighlightIndicators(true); // set.setDrawVerticalHighlightIndicator(false); set.setHighlightLineWidth(0.5f); set.setCircleColor(mLineColor); set.setCircleRadius(1.5f); set.setDrawCircleHole(false); set.setDrawFilled(true); set.setColor(mLineColor); set.setLineWidth(1f); set.setFillDrawable(new ColorDrawable(transparentColor)); } else if (type == TYPE_AVE) { set.setHighlightEnabled(true); set.setColor(ContextCompat.getColor(mContext, R.color.ave_color)); set.setLineWidth(1f); set.setCircleRadius(1.5f); set.setDrawCircleHole(false); set.setCircleColor(transparentColor); set.setLineWidth(0.5f); } else { set.setHighlightEnabled(true); set.setDrawVerticalHighlightIndicator(false); set.setHighLightColor(transparentColor); set.setColor(mLineColor); set.enableDashedLine(3, 40, 0); set.setDrawCircleHole(false); set.setCircleColor(transparentColor); set.setLineWidth(1f); set.setVisible(true); } set.setDrawCircles(false); set.setDrawValues(false); return set; }
Example 2
Source File: FragmentPrice.java From bcm-android with GNU General Public License v3.0 | 6 votes |
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: RecordingsAdapter.java From go-bees with GNU General Public License v3.0 | 6 votes |
/** * Style char lines (type, color, etc.). * * @param entries list of entries. * @return line data chart. */ private LineData styleChartLines(List<Entry> entries) { // Set styles LineDataSet lineDataSet = new LineDataSet(entries, "Recording"); lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER); lineDataSet.setCubicIntensity(0.2f); lineDataSet.setDrawValues(false); lineDataSet.setDrawCircles(false); lineDataSet.setLineWidth(1.8f); lineDataSet.setColor(ContextCompat.getColor(context, R.color.colorAccent)); if (((int) lineDataSet.getYMax()) != 0) { lineDataSet.setDrawFilled(true); lineDataSet.setFillAlpha(255); // Fix bug with vectors in API < 21 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){ Drawable drawable = ResourcesCompat.getDrawable(context.getResources(), R.drawable.chart_fade, null); lineDataSet.setFillDrawable(drawable); } else{ lineDataSet.setFillColor(ContextCompat.getColor(context, R.color.colorPrimary)); } } return new LineData(lineDataSet); }
Example 4
Source File: RangeTestFragmentView.java From EFRConnect-android with Apache License 2.0 | 6 votes |
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 5
Source File: TrainedModelViewBinder.java From Synapse with Apache License 2.0 | 6 votes |
private LineDataSet prepareInitData(@NonNull LineChart chart, @NonNull List<Entry> entries) { final LineDataSet set = new LineDataSet(entries, "Accuracy"); set.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setLineWidth(2F); set.setDrawCircleHole(false); set.setDrawCircles(false); set.setHighlightEnabled(false); set.setDrawFilled(true); final LineData group = new LineData(set); group.setDrawValues(false); chart.setData(group); return set; }
Example 6
Source File: FragmentPrice.java From Lunary-Ethereum-Wallet with GNU General Public License v3.0 | 6 votes |
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 7
Source File: GraphFragment.java From CryptoBuddy with GNU Affero General Public License v3.0 | 6 votes |
public LineDataSet setUpLineDataSet(List<Entry> entries) { LineDataSet dataSet = new LineDataSet(entries, "Price"); dataSet.setColor(chartBorderColor); dataSet.setFillColor(chartFillColor); dataSet.setDrawHighlightIndicators(true); dataSet.setDrawFilled(true); dataSet.setDrawCircles(true); dataSet.setCircleColor(chartBorderColor); dataSet.setDrawCircleHole(false); dataSet.setDrawValues(false); dataSet.setCircleRadius(1); dataSet.setHighlightLineWidth(2); dataSet.setHighlightEnabled(true); dataSet.setDrawHighlightIndicators(true); dataSet.setHighLightColor(chartBorderColor); // color for highlight indicator return dataSet; }
Example 8
Source File: PowerChart.java From AndroidApp with GNU Affero General Public License v3.0 | 5 votes |
private LineDataSet createDataSet() { LineDataSet powerDataset = new LineDataSet(null, "watts"); powerDataset.setColor(ContextCompat.getColor(context, R.color.chartBlue)); powerDataset.setValueTextColor(ContextCompat.getColor(context, R.color.lightGrey)); powerDataset.setDrawCircles(false); powerDataset.setDrawFilled(true); powerDataset.setFillColor(ContextCompat.getColor(context, R.color.chartBlue)); powerDataset.setDrawValues(false); powerDataset.setValueTextSize(R.integer.chartValueTextSize); powerDataset.setHighlightEnabled(false); return powerDataset; }
Example 9
Source File: ChartRVAdapter.java From batteryhub with Apache License 2.0 | 5 votes |
private LineData loadData(ChartCard card) { // add entries to dataset LineDataSet lineDataSet = new LineDataSet(card.entries, null); lineDataSet.setMode(LineDataSet.Mode.LINEAR); lineDataSet.setDrawValues(false); lineDataSet.setDrawCircleHole(false); lineDataSet.setColor(card.color); lineDataSet.setCircleColor(card.color); lineDataSet.setLineWidth(1.8f); lineDataSet.setDrawFilled(true); lineDataSet.setFillColor(card.color); return new LineData(lineDataSet); }
Example 10
Source File: RecordingFragment.java From go-bees with GNU General Public License v3.0 | 5 votes |
/** * Configure styles of weather charts. * * @param entries chart data. * @param formatter value formatter. * @param minVal min value to show. * @param maxVal max value to show. * @return chart formatted. */ private LineDataSet configureWeatherChart( LineChart chart, int chartName, int colorLineTempChart, int colorFillTempChart, List<Entry> entries, IAxisValueFormatter formatter, double minVal, double maxVal) { LineDataSet lineDataSet = new LineDataSet(entries, getString(chartName)); lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER); lineDataSet.setDrawValues(false); lineDataSet.setValueTextSize(10f); lineDataSet.setDrawCircles(false); lineDataSet.setLineWidth(1.8f); lineDataSet.setColor(ContextCompat.getColor(getContext(), colorLineTempChart)); lineDataSet.setLineWidth(2f); lineDataSet.setDrawFilled(true); lineDataSet.setFillColor(ContextCompat.getColor(getContext(), colorFillTempChart)); lineDataSet.setFillAlpha(255); // General setup chart.setDrawGridBackground(false); chart.setDrawBorders(false); chart.setViewPortOffsets(0, 0, 0, 0); chart.getDescription().setEnabled(false); chart.getLegend().setEnabled(false); chart.setTouchEnabled(false); // X axis setup XAxis xAxis = chart.getXAxis(); xAxis.setEnabled(false); xAxis.setAxisMinimum(0); xAxis.setAxisMaximum(lastTimestamp); // Y axis setup YAxis leftAxis = chart.getAxisLeft(); leftAxis.setEnabled(false); leftAxis.setAxisMaximum((float) (maxVal)); leftAxis.setAxisMinimum((float) (minVal)); YAxis rightAxis = chart.getAxisRight(); rightAxis.setAxisMaximum((float) (maxVal)); rightAxis.setAxisMinimum((float) (minVal)); rightAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART); rightAxis.setValueFormatter(formatter); return lineDataSet; }
Example 11
Source File: PerformanceLineChart.java From Stayfit with Apache License 2.0 | 5 votes |
private void setData(int count, float range) { ArrayList<String> xVals = new ArrayList<String>(); for (int i = 0; i < count; i++) { xVals.add((i) + ""); } ArrayList<Entry> yVals = new ArrayList<Entry>(); for (int i = 0; i < count; i++) { float mult = (range + 1); float val = (float) (Math.random() * mult) + 3;// + (float) // ((mult * // 0.1) / 10); yVals.add(new Entry(val, i)); } // create a dataset and give it a type LineDataSet set1 = new LineDataSet(yVals, "DataSet 1"); set1.setColor(Color.BLACK); set1.setLineWidth(0.5f); set1.setDrawValues(false); set1.setDrawCircles(false); set1.setDrawCubic(false); set1.setDrawFilled(false); // create a data object with the datasets LineData data = new LineData(xVals, set1); // set data mChart.setData(data); // get the legend (only possible after setting data) Legend l = mChart.getLegend(); l.setEnabled(false); }
Example 12
Source File: ModelDetailActivity.java From Synapse with Apache License 2.0 | 5 votes |
private boolean setUpChart(@NonNull Model model) { final double[] accuracies = model.getAccuracies(); if (accuracies == null || accuracies.length == 0 || model.getStepEpoch() < 1) { return false; } mAccuracyData.clear(); for (int i = 0, len = model.getStepEpoch(); i < len; ++i) { mAccuracyData.add(new Entry(i + 1, (float) accuracies[i])); } final LineDataSet set = new LineDataSet(mAccuracyData, getString(R.string.text_chart_left_axis)); set.setMode(LineDataSet.Mode.LINEAR); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setColor(ContextCompat.getColor(this, R.color.chart_left_axis)); set.setCircleColor(ContextCompat.getColor(this, R.color.chart_left_axis)); set.setHighLightColor(ContextCompat.getColor(this, R.color.chart_highlight)); set.setCircleColorHole(Color.WHITE); set.setDrawCircleHole(true); set.setHighlightEnabled(true); set.setLineWidth(2F); set.setCircleRadius(3F); set.setDrawFilled(false); final LineData group = new LineData(set); group.setDrawValues(false); setXAxis(model.getEpochs()); mChart.setData(group); mChart.invalidate(); startChartAnimate(); return true; }
Example 13
Source File: Utils.java From Aria2App with GNU General Public License v3.0 | 5 votes |
@NonNull private static LineDataSet initDownloadSet(Context context) { LineDataSet set = new LineDataSet(null, context.getString(R.string.downloadSpeed)); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setLineWidth(2f); set.setColor(ContextCompat.getColor(context, R.color.downloadColor)); set.setDrawCircles(false); set.setDrawValues(false); set.setMode(LineDataSet.Mode.CUBIC_BEZIER); set.setDrawFilled(false); return set; }
Example 14
Source File: LineChartActivity1.java From Stayfit with Apache License 2.0 | 4 votes |
private void setData(int count, float range) { ArrayList<String> xVals = new ArrayList<String>(); for (int i = 0; i < count; i++) { xVals.add((i) + ""); } ArrayList<Entry> yVals = new ArrayList<Entry>(); for (int i = 0; i < count; i++) { float mult = (range + 1); float val = (float) (Math.random() * mult) + 3;// + (float) // ((mult * // 0.1) / 10); yVals.add(new Entry(val, i)); } // create a dataset and give it a type LineDataSet set1 = new LineDataSet(yVals, "DataSet 1"); // set1.setFillAlpha(110); // set1.setFillColor(Color.RED); // set the line to be drawn like this "- - - - - -" set1.enableDashedLine(10f, 5f, 0f); set1.enableDashedHighlightLine(10f, 5f, 0f); set1.setColor(Color.BLACK); set1.setCircleColor(Color.BLACK); set1.setLineWidth(1f); set1.setCircleRadius(3f); set1.setDrawCircleHole(false); set1.setValueTextSize(9f); Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red); set1.setFillDrawable(drawable); set1.setDrawFilled(true); ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>(); dataSets.add(set1); // add the datasets // create a data object with the datasets LineData data = new LineData(xVals, dataSets); // set data mChart.setData(data); }
Example 15
Source File: DateGraph.java From fastnfitness with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void draw(ArrayList<Entry> entries) { mChart.clear(); if (entries.isEmpty()) { return; } Collections.sort(entries, new EntryXComparator()); //Log.d("DEBUG", arrayToString(entries)); LineDataSet set1 = new LineDataSet(entries, mChartName); set1.setLineWidth(3f); set1.setCircleRadius(4f); set1.setDrawFilled(true); if (Utils.getSDKInt() >= 18) { // fill drawable only supported on api level 18 and above Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.fade_blue); set1.setFillDrawable(drawable); } else { set1.setFillColor(ColorTemplate.getHoloBlue()); } set1.setFillAlpha(100); set1.setColor(mContext.getResources().getColor(R.color.toolbar_background)); set1.setCircleColor(mContext.getResources().getColor(R.color.toolbar_background)); // Create a data object with the datasets LineData data = new LineData(set1); data.setValueFormatter(new IValueFormatter() { private DecimalFormat mFormat = new DecimalFormat("#.##"); @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(value); } }); // Set data mChart.setData(data); mChart.invalidate(); //mChart.animateY(500, Easing.EasingOption.EaseInBack); //refresh graph }
Example 16
Source File: MiniDateGraph.java From fastnfitness with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void draw(ArrayList<Entry> entries) { mChart.clear(); if (entries.isEmpty()) { return; } Collections.sort(entries, new EntryXComparator()); //Log.d("DEBUG", arrayToString(entries)); LineDataSet set1 = new LineDataSet(entries, mChartName); set1.setLineWidth(3f); set1.setCircleRadius(0f); set1.setDrawFilled(true); if (Utils.getSDKInt() >= 18) { // fill drawable only supported on api level 18 and above Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.fade_blue); set1.setFillDrawable(drawable); } else { set1.setFillColor(ColorTemplate.getHoloBlue()); } set1.setFillAlpha(100); set1.setColor(mContext.getResources().getColor(R.color.toolbar_background)); set1.setCircleColor(mContext.getResources().getColor(R.color.toolbar_background)); // Create a data object with the datasets LineData data = new LineData(set1); data.setDrawValues(false); /*data.setValueFormatter(new IValueFormatter() { private DecimalFormat mFormat = new DecimalFormat("#.##"); @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(value); } });*/ // Set data mChart.setData(data); mChart.invalidate(); //mChart.animateY(500, Easing.EasingOption.EaseInBack); //refresh graph }
Example 17
Source File: CurrencyActivity.java From Travel-Mate with MIT License | 4 votes |
void setGraphData(JSONArray currencyRateTrends) { ArrayList<Entry> values = new ArrayList<>(); for (int i = 0; i < currencyRateTrends.length(); i++) { try { values.add(new Entry(i, (float) currencyRateTrends.getDouble(i))); } catch (JSONException e) { e.printStackTrace(); } } LineDataSet lineDataSet = new LineDataSet(values, GRAPH_LABEL_NAME); lineDataSet.setDrawIcons(false); lineDataSet.setColor(Color.RED); lineDataSet.setCircleColor(Color.BLUE); lineDataSet.setCircleRadius(1f); lineDataSet.setLineWidth(1f); lineDataSet.setCircleRadius(3f); lineDataSet.setDrawCircleHole(true); lineDataSet.setValueTextSize(10f); lineDataSet.setValueTextColor(Color.BLACK); lineDataSet.setDrawFilled(true); lineDataSet.setFormSize(10.f); if (Utils.getSDKInt() >= 18) { // fill drawable only supported on api level 18 and above Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_green); lineDataSet.setFillDrawable(drawable); } else { lineDataSet.setFillColor(Color.BLACK); } ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>(); dataSets.add(lineDataSet); // create a data object with the datasets LineData data = new LineData(dataSets); // set data graph.setData(data); }
Example 18
Source File: ChartUtil.java From PocketEOS-Android with GNU Lesser General Public License v3.0 | 4 votes |
/** * 曲线赋值与设置 * * @param context 上下文 * @param yDataList y轴数据 * @return LineData */ private static LineData setLineData(Context context, List<Entry> yDataList, String curveLable) { // y轴的数据集合 LineDataSet lineDataSet = new LineDataSet(yDataList, curveLable); // 用y轴的集合来设置参数 lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT); // 不显示坐标点的数据 lineDataSet.setDrawValues(false); // 显示坐标点的小圆点 lineDataSet.setDrawCircles(false); // 定位线 lineDataSet.setHighlightEnabled(false); // 线宽 lineDataSet.setLineWidth(1f); // 显示的圆形大小 lineDataSet.setCircleSize(2f); // 显示颜色 lineDataSet.setColor(context.getApplicationContext().getResources().getColor(R.color.chart_color)); // 圆形的颜色 lineDataSet.setCircleColor(context.getApplicationContext().getResources().getColor(R.color.chart_color)); // 高亮的线的颜色 lineDataSet.setHighLightColor(context.getApplicationContext().getResources() .getColor(R.color.chart_color)); // 设置填充的颜色 Drawable drawable = ContextCompat.getDrawable(context, R.drawable.fade_color); lineDataSet.setFillDrawable(drawable); // 设置坐标点为空心环状 lineDataSet.setDrawCircleHole(false); // lineDataSet.setValueTextSize(9f); lineDataSet.setFillAlpha(30); // 设置显示曲线和X轴围成的区域阴影 lineDataSet.setDrawFilled(true); // 坐标轴在左侧 lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT); // 设置每条曲线图例标签名 // lineDataSet.setLabel("标签"); lineDataSet.setValueTextSize(14f); // 曲线弧度(区间0.05f-1f,默认0.2f) lineDataSet.setCubicIntensity(0.2f); // 设置为曲线显示,false为折线 lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER); lineDataSet.setValues(yDataList); // y轴的数据 LineData lineData = new LineData(lineDataSet); return lineData; }
Example 19
Source File: CalibrationLinearityActivity.java From NoiseCapture with GNU General Public License v3.0 | 4 votes |
private void updateLineChart() { LineChart lineChart = getLineChart(); if(lineChart == null) { return; } if(freqLeqStats.isEmpty()) { return; } float YMin = Float.MAX_VALUE; float YMax = Float.MIN_VALUE; ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>(); // Read all white noise values for indexing before usage int idStep = 0; double referenceLevel = freqLeqStats.get(0).whiteNoiseLevel.getGlobaldBaValue(); for(LinearCalibrationResult result : freqLeqStats) { ArrayList<Entry> yMeasure = new ArrayList<Entry>(); int idfreq = 0; for (LeqStats leqStat : result.measure) { float dbLevel = (float)leqStat.getLeqMean(); YMax = Math.max(YMax, dbLevel); YMin = Math.min(YMin, dbLevel); yMeasure.add(new Entry(dbLevel, idfreq++)); } LineDataSet freqSet = new LineDataSet(yMeasure, String.format(Locale.getDefault(),"%d dB", (int)(result.whiteNoiseLevel.getGlobaldBaValue() - referenceLevel))); freqSet.setColor(ColorTemplate.COLORFUL_COLORS[idStep % ColorTemplate.COLORFUL_COLORS.length]); freqSet.setFillColor(ColorTemplate.COLORFUL_COLORS[idStep % ColorTemplate.COLORFUL_COLORS.length]); freqSet.setValueTextColor(Color.WHITE); freqSet.setCircleColorHole(ColorTemplate.COLORFUL_COLORS[idStep % ColorTemplate.COLORFUL_COLORS.length]); freqSet.setDrawValues(false); freqSet.setDrawFilled(true); freqSet.setFillAlpha(255); freqSet.setDrawCircles(true); freqSet.setMode(LineDataSet.Mode.LINEAR); dataSets.add(freqSet); idStep++; } ArrayList<String> xVals = new ArrayList<String>(); double[] freqs = FFTSignalProcessing.computeFFTCenterFrequency(AudioProcess.REALTIME_SAMPLE_RATE_LIMITATION); for (double freqValue : freqs) { xVals.add(Spectrogram.formatFrequency((int)freqValue)); } // create a data object with the datasets LineData data = new LineData(xVals, dataSets); lineChart.setData(data); YAxis yl = lineChart.getAxisLeft(); yl.setAxisMinValue(YMin - 3); yl.setAxisMaxValue(YMax + 3); lineChart.invalidate(); }
Example 20
Source File: DataUsageActivity.java From utexas-utilities with Apache License 2.0 | 4 votes |
private void setupChart(List<String> labels, List<Entry> downData, List<Entry> totalData) { LineDataSet totalLineDataSet = new LineDataSet(totalData, "Uploaded"); totalLineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT); totalLineDataSet.setDrawCircles(false); totalLineDataSet.setCubicIntensity(0.1f); totalLineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER); totalLineDataSet.setDrawFilled(true); totalLineDataSet.setDrawValues(false); totalLineDataSet.setColor(ContextCompat.getColor(this, R.color.data_usage_chart_upload)); totalLineDataSet.setFillColor(ContextCompat.getColor(this, R.color.data_usage_chart_upload)); totalLineDataSet.setFillAlpha(255); LineDataSet downLineDataSet = new LineDataSet(downData, "Downloaded"); downLineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT); downLineDataSet.setDrawCircles(false); downLineDataSet.setCubicIntensity(0.1f); downLineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER); downLineDataSet.setDrawFilled(true); downLineDataSet.setDrawValues(false); downLineDataSet.setColor(ContextCompat.getColor(this, R.color.data_usage_chart_download)); downLineDataSet.setFillColor(ContextCompat.getColor(this, R.color.data_usage_chart_download)); downLineDataSet.setFillAlpha(255); List<ILineDataSet> downAndUp = new ArrayList<>(); downAndUp.add(totalLineDataSet); downAndUp.add(downLineDataSet); LineData dataUsageLineData = new LineData(labels, downAndUp); chart.getAxisRight().setEnabled(true); chart.getAxisRight().setDrawAxisLine(true); chart.getAxisRight().setDrawGridLines(false); chart.getAxisRight().setDrawLabels(false); chart.getAxisLeft().setStartAtZero(true); chart.setData(dataUsageLineData); chart.setDescription(""); chart.setScaleXEnabled(true); chart.setScaleYEnabled(false); chart.setPinchZoom(true); chart.setDoubleTapToZoomEnabled(true); chart.getData().setHighlightEnabled(false); chart.getAxisLeft().setValueFormatter((value, axis) -> value + " MB"); // maximum viewable area is one day chart.setScaleMinima(downData.size() / 288f, 1f); // initially show the most recent 24 hours chart.centerViewTo(Math.max(downData.size() - 144, 0), chart.getYChartMax() / 2, YAxis.AxisDependency.LEFT); chart.setVisibility(View.VISIBLE); progressLayout.setVisibility(View.GONE); }