Open masheransari opened 5 years ago
bar scolling is not smooth in app. Code are also attached.
barChart.setDescription(""); barChart.setPinchZoom(true); barChart.setDrawBarShadow(false); barChart.setDrawValueAboveBar(true); YAxis yLabels = barChart.getAxisLeft(); yLabels.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); yLabels.setValueFormatter(new MyYValueFormatter()); barChart.getAxisRight().setValueFormatter(new MyYValueFormatter()); barChart.getAxisRight().setDrawGridLines(false); YAxis yl = barChart.getAxisLeft(); yl.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); yl.setDrawGridLines(true); yl.setEnabled(true); yl.setAxisMinValue(0f); barChart.getAxisRight().setEnabled(false); XAxis xAxis = barChart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setTypeface(Constant.getRegularTypeface(context)); xAxis.setDrawGridLines(false); xAxis.setSpaceBetweenLabels(2); xAxis.setXOffset(5f); xAxis.setYOffset(5f); xAxis.setTextSize(8f); xAxis.setLabelRotationAngle(-45); FormatterType.YAxisFormatter custom = new FormatterType.YAxisFormatter(yAxis_unit); YAxis leftAxis = barChart.getAxisLeft(); leftAxis.setValueFormatter(custom); barChart.getLegend().setEnabled(false);
//Data Setting process.
BarDataSet set1 = new BarDataSet(values, ""); set1.setBarSpacePercent(35f); set1.setColors(colors); set1.setDrawValues(true); BarChartCustomRendererImage barChartCustomRenderer = new BarChartCustomRendererImage(barChart, barChart.getAnimator(), barChart.getViewPortHandler(), bitmaps); barChart.setRenderer(barChartCustomRenderer); barChart.setRenderer(barChartCustomRenderer); ArrayList dataSets = new ArrayList<>(); dataSets.add(set1); BarData data = new BarData(xVals, dataSets); data.setValueTextSize(9f); data.setValueTypeface(Constant.getRegularTypeface(context)); barChart.setData(data);
Sorry for bad english.
I have the same problem How to fix this. Found this but dont know how to implement it https://github.com/PhilJay/MPAndroidChart/issues/1885#issuecomment-267568663
Scrolling issue in barchart
bar scolling is not smooth in app. Code are also attached.
barChart.setDescription(""); barChart.setPinchZoom(true); barChart.setDrawBarShadow(false); barChart.setDrawValueAboveBar(true); YAxis yLabels = barChart.getAxisLeft(); yLabels.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); yLabels.setValueFormatter(new MyYValueFormatter()); barChart.getAxisRight().setValueFormatter(new MyYValueFormatter()); barChart.getAxisRight().setDrawGridLines(false); YAxis yl = barChart.getAxisLeft(); yl.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); yl.setDrawGridLines(true); yl.setEnabled(true); yl.setAxisMinValue(0f); barChart.getAxisRight().setEnabled(false); XAxis xAxis = barChart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setTypeface(Constant.getRegularTypeface(context)); xAxis.setDrawGridLines(false); xAxis.setSpaceBetweenLabels(2); xAxis.setXOffset(5f); xAxis.setYOffset(5f); xAxis.setTextSize(8f); xAxis.setLabelRotationAngle(-45); FormatterType.YAxisFormatter custom = new FormatterType.YAxisFormatter(yAxis_unit); YAxis leftAxis = barChart.getAxisLeft(); leftAxis.setValueFormatter(custom); barChart.getLegend().setEnabled(false);
//Data Setting process.
BarDataSet set1 = new BarDataSet(values, ""); set1.setBarSpacePercent(35f); set1.setColors(colors); set1.setDrawValues(true); BarChartCustomRendererImage barChartCustomRenderer = new BarChartCustomRendererImage(barChart, barChart.getAnimator(), barChart.getViewPortHandler(), bitmaps); barChart.setRenderer(barChartCustomRenderer); barChart.setRenderer(barChartCustomRenderer); ArrayList dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(9f);
data.setValueTypeface(Constant.getRegularTypeface(context));
barChart.setData(data);
Sorry for bad english.