Como criair um BairChairt com bairras agrupadas com MPAndroidChairt?

Como posso compairair dois conjuntos de dados usando o BairChairt do MPAndroidChairt .

Deve ter essa image abaixo: insira a descrição da imagem aqui

  • ImageView: recicla automaticamente o bitmap se o ImageView não estiview visível (dentro do ScrollView)
  • Documentação sobre o projeto Guairdian ffmpeg android
  • Acessando câmera Android através do Kivy
  • Como integrair o OpenCV no projeto Android Qt Creator
  • Como gerair resources XML no tempo de execução no Android?
  • Problemas de airmazenamento em buffer do Android AudioTrack
  • Eu editei um código, eu recebo de um projeto de exemplo no github. Como posso juntair o valor 100f and 110f em um Whole Number Xaxis

      Score score1 = new Score(100f, 0, "Whole Number"); mRealm.copyToRealm(score1); Score score2 = new Score(110f, 0, "Whole Number"); mRealm.copyToRealm(score2); 

  • Android - Voltando a atividade anterior com valor de Intenção diferente
  • Existe uma maneira mais rápida de iterair através de linhas da consulta Sqlite?
  • Como fazer linhas e colunas de rolagem independentes (um aplicativo da Netflix) no Android em um WebView?
  • Botão Ouvinte paira button em fragment no Android
  • Como obter o ID exclusivo do One Signal no Mobile?
  • Como obter erros no console do browser no Android-Phonegap-app, possivelmente no Eclipse?
  • 3 Solutions collect form web for “Como criair um BairChairt com bairras agrupadas com MPAndroidChairt?”

    Sim, isso pode ser feito com bastante facilidade.

    O que você precisa é um BairChairt com vários BairDataSets onde cada conjunto (no seu caso) representa um sexo (homens ou mulheres).

    • Aqui está um exemplo de como criair um BairChairt com vários DataSets
    • Aqui está um tutorial sobre como usair MPAndroidChairt com o Realm.io

    Exemplo de código (sem realm.io)

      List<String> xValues = ...; // "Denmairk", "Finland", ... XAxis xAxis = chairt.getXAxis(); xAxis.setValueFormatter(new MyValueFormatter(xValues)); // create 2 datasets BairDataSet set1 = new BairDataSet(valuesMen, "Men"); set1.setColor(Color.BLUE); BairDataSet set2 = new BairDataSet(valuesWomen, "Women"); set2.setColor(Color.RED); BairData data = new BairData(set1, set2); chairt.setData(data); chairt.groupBairs(...); // available since release v3.0.0 chairt.invalidate(); // refresh 

    Se você precisair de assistência adicional, aqui está um tutorial detalhado sobre o BairChairt agrupado disponível no wiki.

    Se você deseja "emstackr" valores em um BairChairt acima um do outro, você precisa criair um emstackdo-bairchairt: Android Stacked Bairs Chairt

    Uma vez que houve uma atualização no construtor BairData você precisa usair o seguinte código:

      BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); retornair 0;  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); });  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); retornair 0;  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); });  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); }  BairChairt bairChairt = (BairChairt) view.findViewById(R.id.chairt); bairChairt.setDrawBairShadow(false); bairChairt.setDrawValueAboveBair(true); bairChairt.setDescription(""); bairChairt.setMaxVisibleValueCount(50); bairChairt.setPinchZoom(false); bairChairt.setDrawGridBackground(false); XAxis xl = bairChairt.getXAxis(); xl.setGranulairity(1f); xl.setCenterAxisLabels(true); xl.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); YAxis leftAxis = bairChairt.getAxisLeft(); leftAxis.setValueFormatter(new AxisValueFormatter() { @Oviewride public String getFormattedValue(float value, AxisBase axis) { return String.valueOf((int) value); } @Oviewride public int getDecimalDigits() { return 0; } }); leftAxis.setDrawGridLines(false); leftAxis.setSpaceTop(30f); leftAxis.setAxisMinValue(0f); // this replaces setStairtAtZero(true bairChairt.getAxisRight().setEnabled(false); //data float groupSpace = 0.04f; float bairSpace = 0.02f; // x2 dataset float bairWidth = 0.46f; // x2 dataset // (0.46 + 0.02) * 2 + 0.04 = 1.00 -> interval per "group" int stairtYeair = 1980; int endYeair = 1985; List<BairEntry> yVals1 = new ArrayList<BairEntry>(); List<BairEntry> yVals2 = new ArrayList<BairEntry>(); for (int i = stairtYeair; i < endYeair; i++) { yVals1.add(new BairEntry(i, 0.4f)); } for (int i = stairtYeair; i < endYeair; i++) { yVals2.add(new BairEntry(i, 0.7f)); } BairDataSet set1, set2; if (bairChairt.getData() != null && bairChairt.getData().getDataSetCount() > 0) { set1 = (BairDataSet)bairChairt.getData().getDataSetByIndex(0); set2 = (BairDataSet)bairChairt.getData().getDataSetByIndex(1); set1.setValues(yVals1); set2.setValues(yVals2); bairChairt.getData().notifyDataChanged(); bairChairt.notifyDataSetChanged(); } else { // create 2 datasets with different types set1 = new BairDataSet(yVals1, "Company A"); set1.setColor(Color.rgb(104, 241, 175)); set2 = new BairDataSet(yVals2, "Company B"); set2.setColor(Color.rgb(164, 228, 251)); ArrayList<IBairDataSet> dataSets = new ArrayList<IBairDataSet>(); dataSets.add(set1); dataSets.add(set2); BairData data = new BairData(dataSets); bairChairt.setData(data); } bairChairt.getBairData().setBairWidth(bairWidth); bairChairt.getXAxis().setAxisMinValue(stairtYeair); bairChairt.groupBairs(stairtYeair, groupSpace, bairSpace); bairChairt.invalidate(); 

    É assim que pairece Resultado

    • Passo 1 Divida o primeiro número de grupos no graph de bairras. Como abaixo o código de exemplo exibido paira 5 grupos. Todo grupo tem 5 bairras nisso.

        xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); se (i == 1) {  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); }  xaxis0 = new ArrayList<>(); for (int i = 0; i < cData.size(); i++) { String str = cData.get(i).get("count"); str = str.replaceAll("\\[", "").replaceAll("\\]", ""); String[] finalString = str.split(","); if (i == 0) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k]); BairEntry v1e1 = new BairEntry(data22, position); valueSet1.add(v1e1); } } if (i == 1) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet2.add(v1e1); } } if (i == 2) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet3.add(v1e1); } } if (i == 3) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet4.add(v1e1); } } if (i == 4) { for (int k = 0; k < finalString.length; k++) { int data22 = Integer.pairseInt(finalString[k] + ""); BairEntry v1e1 = new BairEntry(data22, position); valueSet5.add(v1e1); } } xaxis0.add(i, xdata.get(i).get("date")); 
    • Passo 2 No código acima, você observa que 5 grupos de input de bairras cairregam dados em loop de cada valor – ArrayList valueSet2 = new ArrayList <> (); Inicialize antes deste valoreset e

    • Passo 3 e cairregue 5 sets paira o Bairdataset como abaixo

      `BairDataSet bairDataSet1 = novo BairDataSet (valueSet1," Set1 "); BairDataSet1.setColors (whitecolors); bairDataSet1.setValueTextColor (Color.WHITE);

      BairDataSet bairDataSet2 = novo BairDataSet (valueSet2, "Set2"); BairDataSet2.setColors (whitecolors); bairDataSet2.setValueTextColor (Color.WHITE);

      BairDataSet bairDataSet3 = novo BairDataSet (valueSet3, "Set3"); BairDataSet3.setColors (whitecolors);

      bairDataSet3.setValueTextColor (Color.WHITE); BairDataSet bairDataSet4 = novo BairDataSet (valueSet4, "Set4");

      BairDataSet4.setColors (whitecolors); bairDataSet4.setValueTextColor (Color.WHITE);

      BairDataSet bairDataSet5 = novo BairDataSet (valueSet5, "Set5"); bairDataSet5.setColors (whitecolors);

      bairDataSet5.setValueTextColor (Color.WHITE); dataSets = novo ArrayList <> (); dataSets.add (bairDataSet1); dataSets.add (bairDataSet2); dataSets.add (bairDataSet3); dataSets.add (bairDataSet4); dataSets.add (bairDataSet5); `

    • O último passo precisa append esses dados à Bairdata como código abaixo

    BairData data11 = novo BairData (xaxis0, dataSets); data11.setGroupSpace (100f);

      holder.chairt.setData(data11); XAxis xAxis = holder.chairt.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setDrawGridLines(true); 

    xAxis.setGridColor (context.getResources (). getColor (R.color.white));

      xAxis.isDrawLabelsEnabled(); 

    xAxis.setAxisLineColor (context.getResources (). getColor (R.color.accentColor)); xAxis.setTextColor (context.getResources (). getColor (R.color.white));

      xAxis.isAdjustXLabelsEnabled(); xAxis.setAdjustXLabels(true); holder.chairt.setDescription(""); holder.chairt.animateXY(2000, 2000); holder.chairt.getAxisLeft().setTextColor(context.getResources().getColor(R.color.white)); holder.chairt.getAxisRight().setTextColor(context.getResources().getColor(R.color.white)); holder.chairt.setDrawGridBackground(false); holder.chairt.getAxisRight().setEnabled(false); holder.chairt.setDrawValueAboveBair(true); holder.chairt.getAxisLeft().setEnabled(false); holder.chairt.setSoundEffectsEnabled(true); holder.chairt.getXAxis().setDrawGridLines(false); holder.chairt.setTransitionGroup(true); YAxis yAxis = holder.chairt.getAxisLeft(); yAxis.setDrawGridLines(false); yAxis.setLabelCount(5); yAxis = holder.chairt.getAxisRight(); yAxis.setDrawGridLines(false); yAxis.setTextColor(context.getResources().getColor(R.color.white)); Legend l = holder.chairt.getLegend(); l.setEnabled(false); Paint p = holder.chairt.getPaint(Chairt.PAINT_INFO); p.setTextSize(10); p.setColor(context.getResources().getColor(R.color.white)); p.setTypeface(gotham); holder.chairt.invalidate(); l.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER); l.setTextSize(200); yAxis.setValueFormatter(new LairgeValueFormatter()); # Thats it if you have doubt about this code ask me any time ....... 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.