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.54k
stars
9.01k
forks
source link
Draw extra upper/lower limit in ListViewMultiChartActivity #4371
I have download MPAndroidChart Example in order to make some changes so I decide to change
ListViewMultiChartActivity and in LineChartItem I add upper/lower limit and run applications and it is working but when I scroll down, in linechart is added other upper/lower limits that I do not create and it is strange. I added some image and a code
I am using Android Studio and Android 8.0 API 26
holder.chart.getDescription().setEnabled(false);
holder.chart.setDrawGridBackground(false);
XAxis xAxis = holder.chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTf);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(true);
YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(5, false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(5, false);
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
LimitLine upper_limit = new LimitLine(mChartData.getYMax(), "Max Value");
upper_limit.setLineWidth(2f);
upper_limit.enableDashedLine(10f, 10f, 0f);
upper_limit.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
upper_limit.setTextSize(10f);
LimitLine lower_limit = new LimitLine(mChartData.getYMin(), "Min Value");
lower_limit.setLineWidth(2f);
lower_limit.enableDashedLine(10f, 10f, 0f);
lower_limit.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
lower_limit.setTextSize(10f);
leftAxis.addLimitLine(upper_limit);
leftAxis.addLimitLine(lower_limit);
leftAxis.setDrawLimitLinesBehindData(true);
// set data
holder.chart.setData((LineData) mChartData);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateX(750);
return convertView;
Hello
I have download MPAndroidChart Example in order to make some changes so I decide to change ListViewMultiChartActivity and in LineChartItem I add upper/lower limit and run applications and it is working but when I scroll down, in linechart is added other upper/lower limits that I do not create and it is strange. I added some image and a code
I am using Android Studio and Android 8.0 API 26