1
I am using Mpandroidchart to make charts.
The problem is this, when I have many items in the caption, it expands leaving the chart small. You can create a scroll in the caption instead of expanding it and consequently decrease the chart?
----- Edit-----
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_grafico_supervisor);
setUpToolbar();
if(getIntent().getExtras() != null){
idSupervisor = getIntent().getExtras().getInt("idSupervisor");
nomeSupervisor = getIntent().getExtras().getString("nomeSupervisor");
mes = getIntent().getExtras().getInt("mes");
ano = getIntent().getExtras().getString("ano");
} else{
// Pegar de Singleton carregado em Login
}
configurarCampos();
configurarGrafico();
}
private void configurarCampos(){
mainLayout = (LinearLayout) findViewById(R.id.linearGraficos);
mChart = (PieChart) findViewById(R.id.chart1);
}
private void configurarGrafico(){
List<VendedorMOD> vendedores = new VendedorDAO(getContext()).pesquisarPorData(idSupervisor, MascaraData.fromStringNormal(getDatas()[0]), MascaraData.fromStringNormal(getDatas()[1]));
for(VendedorMOD v : vendedores){
yData.add(v.getValor().doubleValue());
xData.add(v.getNome());
}
// add pie chart to main layout
//mainLayout.setBackgroundColor(Color.GRAY);
// configure pie chart
mChart.setUsePercentValues(true);
mChart.setDescription("");
// enable hole and configure
mChart.setDrawHoleEnabled(true);
mChart.setHoleColorTransparent(true);
mChart.setHoleRadius(7);
mChart.setTransparentCircleRadius(10);
// enable rotation of the chart by touch
mChart.setRotationAngle(0);
mChart.setRotationEnabled(true);
// add data
addData();
// customize legends
Legend l = mChart.getLegend();
l.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER);
l.setXEntrySpace(7);
l.setYEntrySpace(5);
l.setTextSize(10f);
l.setTextColor(Color.BLACK);
l.setFormSize(10f);
// legenda nao cortar na tela
mChart.getLegend().setWordWrapEnabled(true);
mChart.getLegend().setEnabled(false);
}
Welcome to SOPT. Would like to [Edit] your post and add the code you are using, so we can analyze and suggest a change. Thank you
– David